diff options
462 files changed, 10464 insertions, 9996 deletions
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index f4d0de6bac63..afb1335c05d6 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -84,8 +84,6 @@ reservation | |||
84 | 84 | ||
85 | noreservation | 85 | noreservation |
86 | 86 | ||
87 | resize= | ||
88 | |||
89 | bsddf (*) Make 'df' act like BSD. | 87 | bsddf (*) Make 'df' act like BSD. |
90 | minixdf Make 'df' act like Minix. | 88 | minixdf Make 'df' act like Minix. |
91 | 89 | ||
@@ -175,6 +173,7 @@ See manual pages to learn more. | |||
175 | tune2fs: create a ext3 journal on a ext2 partition with the -j flag. | 173 | tune2fs: create a ext3 journal on a ext2 partition with the -j flag. |
176 | mke2fs: create a ext3 partition with the -j flag. | 174 | mke2fs: create a ext3 partition with the -j flag. |
177 | debugfs: ext2 and ext3 file system debugger. | 175 | debugfs: ext2 and ext3 file system debugger. |
176 | ext2online: online (mounted) ext2 and ext3 filesystem resizer | ||
178 | 177 | ||
179 | 178 | ||
180 | References | 179 | References |
@@ -184,6 +183,7 @@ kernel source: <file:fs/ext3/> | |||
184 | <file:fs/jbd/> | 183 | <file:fs/jbd/> |
185 | 184 | ||
186 | programs: http://e2fsprogs.sourceforge.net/ | 185 | programs: http://e2fsprogs.sourceforge.net/ |
186 | http://ext2resize.sourceforge.net | ||
187 | 187 | ||
188 | useful links: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html | 188 | useful links: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html |
189 | http://www-106.ibm.com/developerworks/linux/library/l-fs7/ | 189 | http://www-106.ibm.com/developerworks/linux/library/l-fs7/ |
diff --git a/Documentation/kdump/gdbmacros.txt b/Documentation/kdump/gdbmacros.txt index bc1b9eb92ae1..dcf5580380ab 100644 --- a/Documentation/kdump/gdbmacros.txt +++ b/Documentation/kdump/gdbmacros.txt | |||
@@ -177,3 +177,25 @@ document trapinfo | |||
177 | 'trapinfo <pid>' will tell you by which trap & possibly | 177 | 'trapinfo <pid>' will tell you by which trap & possibly |
178 | addresthe kernel paniced. | 178 | addresthe kernel paniced. |
179 | end | 179 | end |
180 | |||
181 | |||
182 | define dmesg | ||
183 | set $i = 0 | ||
184 | set $end_idx = (log_end - 1) & (log_buf_len - 1) | ||
185 | |||
186 | while ($i < logged_chars) | ||
187 | set $idx = (log_end - 1 - logged_chars + $i) & (log_buf_len - 1) | ||
188 | |||
189 | if ($idx + 100 <= $end_idx) || \ | ||
190 | ($end_idx <= $idx && $idx + 100 < log_buf_len) | ||
191 | printf "%.100s", &log_buf[$idx] | ||
192 | set $i = $i + 100 | ||
193 | else | ||
194 | printf "%c", log_buf[$idx] | ||
195 | set $i = $i + 1 | ||
196 | end | ||
197 | end | ||
198 | end | ||
199 | document dmesg | ||
200 | print the kernel ring buffer | ||
201 | end | ||
diff --git a/Documentation/oops-tracing.txt b/Documentation/oops-tracing.txt index 05960f8a748e..2503404ae5c2 100644 --- a/Documentation/oops-tracing.txt +++ b/Documentation/oops-tracing.txt | |||
@@ -41,11 +41,9 @@ the disk is not available then you have three options :- | |||
41 | run a null modem to a second machine and capture the output there | 41 | run a null modem to a second machine and capture the output there |
42 | using your favourite communication program. Minicom works well. | 42 | using your favourite communication program. Minicom works well. |
43 | 43 | ||
44 | (3) Patch the kernel with one of the crash dump patches. These save | 44 | (3) Use Kdump (see Documentation/kdump/kdump.txt), |
45 | data to a floppy disk or video rom or a swap partition. None of | 45 | extract the kernel ring buffer from old memory with using dmesg |
46 | these are standard kernel patches so you have to find and apply | 46 | gdbmacro in Documentation/kdump/gdbmacros.txt. |
47 | them yourself. Search kernel archives for kmsgdump, lkcd and | ||
48 | oops+smram. | ||
49 | 47 | ||
50 | 48 | ||
51 | Full Information | 49 | Full Information |
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index e566affeed7f..72ab9b99b22c 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -125,7 +125,7 @@ SMP | |||
125 | cpumask=MASK only use cpus with bits set in mask | 125 | cpumask=MASK only use cpus with bits set in mask |
126 | 126 | ||
127 | additional_cpus=NUM Allow NUM more CPUs for hotplug | 127 | additional_cpus=NUM Allow NUM more CPUs for hotplug |
128 | (defaults are specified by the BIOS or half the available CPUs) | 128 | (defaults are specified by the BIOS, see Documentation/x86_64/cpu-hotplug-spec) |
129 | 129 | ||
130 | NUMA | 130 | NUMA |
131 | 131 | ||
diff --git a/Documentation/x86_64/cpu-hotplug-spec b/Documentation/x86_64/cpu-hotplug-spec new file mode 100644 index 000000000000..5c0fa345e556 --- /dev/null +++ b/Documentation/x86_64/cpu-hotplug-spec | |||
@@ -0,0 +1,21 @@ | |||
1 | Firmware support for CPU hotplug under Linux/x86-64 | ||
2 | --------------------------------------------------- | ||
3 | |||
4 | Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to | ||
5 | know in advance boot time the maximum number of CPUs that could be plugged | ||
6 | into the system. ACPI 3.0 currently has no official way to supply | ||
7 | this information from the firmware to the operating system. | ||
8 | |||
9 | In ACPI each CPU needs an LAPIC object in the MADT table (5.2.11.5 in the | ||
10 | ACPI 3.0 specification). ACPI already has the concept of disabled LAPIC | ||
11 | objects by setting the Enabled bit in the LAPIC object to zero. | ||
12 | |||
13 | For CPU hotplug Linux/x86-64 expects now that any possible future hotpluggable | ||
14 | CPU is already available in the MADT. If the CPU is not available yet | ||
15 | it should have its LAPIC Enabled bit set to 0. Linux will use the number | ||
16 | of disabled LAPICs to compute the maximum number of future CPUs. | ||
17 | |||
18 | In the worst case the user can overwrite this choice using a command line | ||
19 | option (additional_cpus=...), but it is recommended to supply the correct | ||
20 | number (or a reasonable approximation of it, with erring towards more not less) | ||
21 | in the MADT to avoid manual configuration. | ||
diff --git a/MAINTAINERS b/MAINTAINERS index b6416a293ec9..0db72a36e245 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2359,13 +2359,6 @@ P: Nicolas Pitre | |||
2359 | M: nico@cam.org | 2359 | M: nico@cam.org |
2360 | S: Maintained | 2360 | S: Maintained |
2361 | 2361 | ||
2362 | SNA NETWORK LAYER | ||
2363 | P: Jay Schulist | ||
2364 | M: jschlst@samba.org | ||
2365 | L: linux-sna@turbolinux.com | ||
2366 | W: http://www.linux-sna.org | ||
2367 | S: Supported | ||
2368 | |||
2369 | SOFTWARE RAID (Multiple Disks) SUPPORT | 2362 | SOFTWARE RAID (Multiple Disks) SUPPORT |
2370 | P: Ingo Molnar | 2363 | P: Ingo Molnar |
2371 | M: mingo@redhat.com | 2364 | M: mingo@redhat.com |
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c index 9903e3a79102..fff5cf93e816 100644 --- a/arch/alpha/kernel/pci-noop.c +++ b/arch/alpha/kernel/pci-noop.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/bootmem.h> | 9 | #include <linux/bootmem.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
12 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c index 72b03f201eb9..ffb82d5bedef 100644 --- a/arch/arm/common/rtctime.c +++ b/arch/arm/common/rtctime.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
18 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/capability.h> | ||
20 | #include <linux/device.h> | 21 | #include <linux/device.h> |
21 | 22 | ||
22 | #include <asm/rtc.h> | 23 | #include <asm/rtc.h> |
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c index b9df1b782bb1..766b6c05c6db 100644 --- a/arch/arm/kernel/apm.c +++ b/arch/arm/kernel/apm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
19 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
20 | #include <linux/apm_bios.h> | 20 | #include <linux/apm_bios.h> |
21 | #include <linux/capability.h> | ||
21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
22 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
23 | #include <linux/device.h> | 24 | #include <linux/device.h> |
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c index 10795f67f687..b100f26497c4 100644 --- a/arch/cris/arch-v10/drivers/ds1302.c +++ b/arch/cris/arch-v10/drivers/ds1302.c | |||
@@ -148,6 +148,7 @@ | |||
148 | #include <linux/miscdevice.h> | 148 | #include <linux/miscdevice.h> |
149 | #include <linux/delay.h> | 149 | #include <linux/delay.h> |
150 | #include <linux/bcd.h> | 150 | #include <linux/bcd.h> |
151 | #include <linux/capability.h> | ||
151 | 152 | ||
152 | #include <asm/uaccess.h> | 153 | #include <asm/uaccess.h> |
153 | #include <asm/system.h> | 154 | #include <asm/system.h> |
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c index f2c55742e90c..af517c210383 100644 --- a/arch/cris/arch-v10/drivers/pcf8563.c +++ b/arch/cris/arch-v10/drivers/pcf8563.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/ioctl.h> | 28 | #include <linux/ioctl.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/bcd.h> | 30 | #include <linux/bcd.h> |
31 | #include <linux/capability.h> | ||
31 | 32 | ||
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/system.h> | 34 | #include <asm/system.h> |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 815878ebd30f..d5d0df7f04fc 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -41,8 +41,21 @@ config ARCH_MAY_HAVE_PC_FDC | |||
41 | bool | 41 | bool |
42 | default y | 42 | default y |
43 | 43 | ||
44 | config DMI | ||
45 | bool | ||
46 | default y | ||
47 | |||
44 | source "init/Kconfig" | 48 | source "init/Kconfig" |
45 | 49 | ||
50 | config DOUBLEFAULT | ||
51 | default y | ||
52 | bool "Enable doublefault exception handler" if EMBEDDED | ||
53 | help | ||
54 | This option allows trapping of rare doublefault exceptions that | ||
55 | would otherwise cause a system to silently reboot. Disabling this | ||
56 | option saves about 4k and might cause you much additional grey | ||
57 | hair. | ||
58 | |||
46 | menu "Processor type and features" | 59 | menu "Processor type and features" |
47 | 60 | ||
48 | choice | 61 | choice |
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index 447fa9e33ffb..2111529dea77 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -108,7 +108,7 @@ char *__acpi_map_table(unsigned long phys_addr, unsigned long size) | |||
108 | if (!phys_addr || !size) | 108 | if (!phys_addr || !size) |
109 | return NULL; | 109 | return NULL; |
110 | 110 | ||
111 | if (phys_addr < (end_pfn_map << PAGE_SHIFT)) | 111 | if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE) |
112 | return __va(phys_addr); | 112 | return __va(phys_addr); |
113 | 113 | ||
114 | return NULL; | 114 | return NULL; |
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index d8f94e78de8a..acd3f1e34ca6 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel_stat.h> | 26 | #include <linux/kernel_stat.h> |
27 | #include <linux/sysdev.h> | 27 | #include <linux/sysdev.h> |
28 | #include <linux/cpu.h> | 28 | #include <linux/cpu.h> |
29 | #include <linux/module.h> | ||
29 | 30 | ||
30 | #include <asm/atomic.h> | 31 | #include <asm/atomic.h> |
31 | #include <asm/smp.h> | 32 | #include <asm/smp.h> |
@@ -37,10 +38,17 @@ | |||
37 | #include <asm/i8253.h> | 38 | #include <asm/i8253.h> |
38 | 39 | ||
39 | #include <mach_apic.h> | 40 | #include <mach_apic.h> |
41 | #include <mach_ipi.h> | ||
40 | 42 | ||
41 | #include "io_ports.h" | 43 | #include "io_ports.h" |
42 | 44 | ||
43 | /* | 45 | /* |
46 | * cpu_mask that denotes the CPUs that needs timer interrupt coming in as | ||
47 | * IPIs in place of local APIC timers | ||
48 | */ | ||
49 | static cpumask_t timer_bcast_ipi; | ||
50 | |||
51 | /* | ||
44 | * Knob to control our willingness to enable the local APIC. | 52 | * Knob to control our willingness to enable the local APIC. |
45 | */ | 53 | */ |
46 | int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ | 54 | int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ |
@@ -92,10 +100,6 @@ void __init apic_intr_init(void) | |||
92 | /* Using APIC to generate smp_local_timer_interrupt? */ | 100 | /* Using APIC to generate smp_local_timer_interrupt? */ |
93 | int using_apic_timer = 0; | 101 | int using_apic_timer = 0; |
94 | 102 | ||
95 | static DEFINE_PER_CPU(int, prof_multiplier) = 1; | ||
96 | static DEFINE_PER_CPU(int, prof_old_multiplier) = 1; | ||
97 | static DEFINE_PER_CPU(int, prof_counter) = 1; | ||
98 | |||
99 | static int enabled_via_apicbase; | 103 | static int enabled_via_apicbase; |
100 | 104 | ||
101 | void enable_NMI_through_LVT0 (void * dummy) | 105 | void enable_NMI_through_LVT0 (void * dummy) |
@@ -935,11 +939,16 @@ void (*wait_timer_tick)(void) __devinitdata = wait_8254_wraparound; | |||
935 | static void __setup_APIC_LVTT(unsigned int clocks) | 939 | static void __setup_APIC_LVTT(unsigned int clocks) |
936 | { | 940 | { |
937 | unsigned int lvtt_value, tmp_value, ver; | 941 | unsigned int lvtt_value, tmp_value, ver; |
942 | int cpu = smp_processor_id(); | ||
938 | 943 | ||
939 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | 944 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
940 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; | 945 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; |
941 | if (!APIC_INTEGRATED(ver)) | 946 | if (!APIC_INTEGRATED(ver)) |
942 | lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); | 947 | lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); |
948 | |||
949 | if (cpu_isset(cpu, timer_bcast_ipi)) | ||
950 | lvtt_value |= APIC_LVT_MASKED; | ||
951 | |||
943 | apic_write_around(APIC_LVTT, lvtt_value); | 952 | apic_write_around(APIC_LVTT, lvtt_value); |
944 | 953 | ||
945 | /* | 954 | /* |
@@ -1072,7 +1081,7 @@ void __devinit setup_secondary_APIC_clock(void) | |||
1072 | setup_APIC_timer(calibration_result); | 1081 | setup_APIC_timer(calibration_result); |
1073 | } | 1082 | } |
1074 | 1083 | ||
1075 | void __devinit disable_APIC_timer(void) | 1084 | void disable_APIC_timer(void) |
1076 | { | 1085 | { |
1077 | if (using_apic_timer) { | 1086 | if (using_apic_timer) { |
1078 | unsigned long v; | 1087 | unsigned long v; |
@@ -1084,7 +1093,10 @@ void __devinit disable_APIC_timer(void) | |||
1084 | 1093 | ||
1085 | void enable_APIC_timer(void) | 1094 | void enable_APIC_timer(void) |
1086 | { | 1095 | { |
1087 | if (using_apic_timer) { | 1096 | int cpu = smp_processor_id(); |
1097 | |||
1098 | if (using_apic_timer && | ||
1099 | !cpu_isset(cpu, timer_bcast_ipi)) { | ||
1088 | unsigned long v; | 1100 | unsigned long v; |
1089 | 1101 | ||
1090 | v = apic_read(APIC_LVTT); | 1102 | v = apic_read(APIC_LVTT); |
@@ -1092,33 +1104,31 @@ void enable_APIC_timer(void) | |||
1092 | } | 1104 | } |
1093 | } | 1105 | } |
1094 | 1106 | ||
1095 | /* | 1107 | void switch_APIC_timer_to_ipi(void *cpumask) |
1096 | * the frequency of the profiling timer can be changed | ||
1097 | * by writing a multiplier value into /proc/profile. | ||
1098 | */ | ||
1099 | int setup_profiling_timer(unsigned int multiplier) | ||
1100 | { | 1108 | { |
1101 | int i; | 1109 | cpumask_t mask = *(cpumask_t *)cpumask; |
1110 | int cpu = smp_processor_id(); | ||
1102 | 1111 | ||
1103 | /* | 1112 | if (cpu_isset(cpu, mask) && |
1104 | * Sanity check. [at least 500 APIC cycles should be | 1113 | !cpu_isset(cpu, timer_bcast_ipi)) { |
1105 | * between APIC interrupts as a rule of thumb, to avoid | 1114 | disable_APIC_timer(); |
1106 | * irqs flooding us] | 1115 | cpu_set(cpu, timer_bcast_ipi); |
1107 | */ | 1116 | } |
1108 | if ( (!multiplier) || (calibration_result/multiplier < 500)) | 1117 | } |
1109 | return -EINVAL; | 1118 | EXPORT_SYMBOL(switch_APIC_timer_to_ipi); |
1110 | |||
1111 | /* | ||
1112 | * Set the new multiplier for each CPU. CPUs don't start using the | ||
1113 | * new values until the next timer interrupt in which they do process | ||
1114 | * accounting. At that time they also adjust their APIC timers | ||
1115 | * accordingly. | ||
1116 | */ | ||
1117 | for (i = 0; i < NR_CPUS; ++i) | ||
1118 | per_cpu(prof_multiplier, i) = multiplier; | ||
1119 | 1119 | ||
1120 | return 0; | 1120 | void switch_ipi_to_APIC_timer(void *cpumask) |
1121 | { | ||
1122 | cpumask_t mask = *(cpumask_t *)cpumask; | ||
1123 | int cpu = smp_processor_id(); | ||
1124 | |||
1125 | if (cpu_isset(cpu, mask) && | ||
1126 | cpu_isset(cpu, timer_bcast_ipi)) { | ||
1127 | cpu_clear(cpu, timer_bcast_ipi); | ||
1128 | enable_APIC_timer(); | ||
1129 | } | ||
1121 | } | 1130 | } |
1131 | EXPORT_SYMBOL(switch_ipi_to_APIC_timer); | ||
1122 | 1132 | ||
1123 | #undef APIC_DIVISOR | 1133 | #undef APIC_DIVISOR |
1124 | 1134 | ||
@@ -1134,32 +1144,10 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1134 | 1144 | ||
1135 | inline void smp_local_timer_interrupt(struct pt_regs * regs) | 1145 | inline void smp_local_timer_interrupt(struct pt_regs * regs) |
1136 | { | 1146 | { |
1137 | int cpu = smp_processor_id(); | ||
1138 | |||
1139 | profile_tick(CPU_PROFILING, regs); | 1147 | profile_tick(CPU_PROFILING, regs); |
1140 | if (--per_cpu(prof_counter, cpu) <= 0) { | ||
1141 | /* | ||
1142 | * The multiplier may have changed since the last time we got | ||
1143 | * to this point as a result of the user writing to | ||
1144 | * /proc/profile. In this case we need to adjust the APIC | ||
1145 | * timer accordingly. | ||
1146 | * | ||
1147 | * Interrupts are already masked off at this point. | ||
1148 | */ | ||
1149 | per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu); | ||
1150 | if (per_cpu(prof_counter, cpu) != | ||
1151 | per_cpu(prof_old_multiplier, cpu)) { | ||
1152 | __setup_APIC_LVTT( | ||
1153 | calibration_result/ | ||
1154 | per_cpu(prof_counter, cpu)); | ||
1155 | per_cpu(prof_old_multiplier, cpu) = | ||
1156 | per_cpu(prof_counter, cpu); | ||
1157 | } | ||
1158 | |||
1159 | #ifdef CONFIG_SMP | 1148 | #ifdef CONFIG_SMP |
1160 | update_process_times(user_mode_vm(regs)); | 1149 | update_process_times(user_mode_vm(regs)); |
1161 | #endif | 1150 | #endif |
1162 | } | ||
1163 | 1151 | ||
1164 | /* | 1152 | /* |
1165 | * We take the 'long' return path, and there every subsystem | 1153 | * We take the 'long' return path, and there every subsystem |
@@ -1206,6 +1194,43 @@ fastcall void smp_apic_timer_interrupt(struct pt_regs *regs) | |||
1206 | irq_exit(); | 1194 | irq_exit(); |
1207 | } | 1195 | } |
1208 | 1196 | ||
1197 | #ifndef CONFIG_SMP | ||
1198 | static void up_apic_timer_interrupt_call(struct pt_regs *regs) | ||
1199 | { | ||
1200 | int cpu = smp_processor_id(); | ||
1201 | |||
1202 | /* | ||
1203 | * the NMI deadlock-detector uses this. | ||
1204 | */ | ||
1205 | per_cpu(irq_stat, cpu).apic_timer_irqs++; | ||
1206 | |||
1207 | smp_local_timer_interrupt(regs); | ||
1208 | } | ||
1209 | #endif | ||
1210 | |||
1211 | void smp_send_timer_broadcast_ipi(struct pt_regs *regs) | ||
1212 | { | ||
1213 | cpumask_t mask; | ||
1214 | |||
1215 | cpus_and(mask, cpu_online_map, timer_bcast_ipi); | ||
1216 | if (!cpus_empty(mask)) { | ||
1217 | #ifdef CONFIG_SMP | ||
1218 | send_IPI_mask(mask, LOCAL_TIMER_VECTOR); | ||
1219 | #else | ||
1220 | /* | ||
1221 | * We can directly call the apic timer interrupt handler | ||
1222 | * in UP case. Minus all irq related functions | ||
1223 | */ | ||
1224 | up_apic_timer_interrupt_call(regs); | ||
1225 | #endif | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | int setup_profiling_timer(unsigned int multiplier) | ||
1230 | { | ||
1231 | return -EINVAL; | ||
1232 | } | ||
1233 | |||
1209 | /* | 1234 | /* |
1210 | * This interrupt should _never_ happen with our APIC/SMP architecture | 1235 | * This interrupt should _never_ happen with our APIC/SMP architecture |
1211 | */ | 1236 | */ |
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 9d8827156e54..05312a8abb8b 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c | |||
@@ -219,6 +219,7 @@ | |||
219 | #include <linux/sched.h> | 219 | #include <linux/sched.h> |
220 | #include <linux/pm.h> | 220 | #include <linux/pm.h> |
221 | #include <linux/pm_legacy.h> | 221 | #include <linux/pm_legacy.h> |
222 | #include <linux/capability.h> | ||
222 | #include <linux/device.h> | 223 | #include <linux/device.h> |
223 | #include <linux/kernel.h> | 224 | #include <linux/kernel.h> |
224 | #include <linux/smp.h> | 225 | #include <linux/smp.h> |
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index e7697e077f6b..333578a4e91a 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c | |||
@@ -216,6 +216,12 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
216 | c->x86_max_cores = 1; | 216 | c->x86_max_cores = 1; |
217 | } | 217 | } |
218 | 218 | ||
219 | if (cpuid_eax(0x80000000) >= 0x80000007) { | ||
220 | c->x86_power = cpuid_edx(0x80000007); | ||
221 | if (c->x86_power & (1<<8)) | ||
222 | set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability); | ||
223 | } | ||
224 | |||
219 | #ifdef CONFIG_X86_HT | 225 | #ifdef CONFIG_X86_HT |
220 | /* | 226 | /* |
221 | * On a AMD dual core setup the lower bits of the APIC id | 227 | * On a AMD dual core setup the lower bits of the APIC id |
@@ -233,6 +239,7 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
233 | cpu, c->x86_max_cores, cpu_core_id[cpu]); | 239 | cpu, c->x86_max_cores, cpu_core_id[cpu]); |
234 | } | 240 | } |
235 | #endif | 241 | #endif |
242 | |||
236 | } | 243 | } |
237 | 244 | ||
238 | static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) | 245 | static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 170400879f44..15aee26ec2b6 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -204,7 +204,10 @@ static int __devinit have_cpuid_p(void) | |||
204 | 204 | ||
205 | /* Do minimum CPU detection early. | 205 | /* Do minimum CPU detection early. |
206 | Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. | 206 | Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. |
207 | The others are not touched to avoid unwanted side effects. */ | 207 | The others are not touched to avoid unwanted side effects. |
208 | |||
209 | WARNING: this function is only called on the BP. Don't add code here | ||
210 | that is supposed to run on all CPUs. */ | ||
208 | static void __init early_cpu_detect(void) | 211 | static void __init early_cpu_detect(void) |
209 | { | 212 | { |
210 | struct cpuinfo_x86 *c = &boot_cpu_data; | 213 | struct cpuinfo_x86 *c = &boot_cpu_data; |
@@ -236,12 +239,6 @@ static void __init early_cpu_detect(void) | |||
236 | if (cap0 & (1<<19)) | 239 | if (cap0 & (1<<19)) |
237 | c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; | 240 | c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; |
238 | } | 241 | } |
239 | |||
240 | early_intel_workaround(c); | ||
241 | |||
242 | #ifdef CONFIG_X86_HT | ||
243 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | ||
244 | #endif | ||
245 | } | 242 | } |
246 | 243 | ||
247 | void __devinit generic_identify(struct cpuinfo_x86 * c) | 244 | void __devinit generic_identify(struct cpuinfo_x86 * c) |
@@ -289,6 +286,12 @@ void __devinit generic_identify(struct cpuinfo_x86 * c) | |||
289 | get_model_name(c); /* Default name */ | 286 | get_model_name(c); /* Default name */ |
290 | } | 287 | } |
291 | } | 288 | } |
289 | |||
290 | early_intel_workaround(c); | ||
291 | |||
292 | #ifdef CONFIG_X86_HT | ||
293 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | ||
294 | #endif | ||
292 | } | 295 | } |
293 | 296 | ||
294 | static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | 297 | static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) |
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 871366b83b3f..7975e79d5fa4 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -40,8 +40,6 @@ | |||
40 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
41 | #include <acpi/processor.h> | 41 | #include <acpi/processor.h> |
42 | 42 | ||
43 | #include "speedstep-est-common.h" | ||
44 | |||
45 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) | 43 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) |
46 | 44 | ||
47 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); | 45 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); |
@@ -367,6 +365,7 @@ acpi_cpufreq_cpu_init ( | |||
367 | unsigned int cpu = policy->cpu; | 365 | unsigned int cpu = policy->cpu; |
368 | struct cpufreq_acpi_io *data; | 366 | struct cpufreq_acpi_io *data; |
369 | unsigned int result = 0; | 367 | unsigned int result = 0; |
368 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | ||
370 | 369 | ||
371 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | 370 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; |
372 | u32 arg0_buf[3]; | 371 | u32 arg0_buf[3]; |
@@ -390,7 +389,7 @@ acpi_cpufreq_cpu_init ( | |||
390 | if (result) | 389 | if (result) |
391 | goto err_free; | 390 | goto err_free; |
392 | 391 | ||
393 | if (is_const_loops_cpu(cpu)) { | 392 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
394 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | 393 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; |
395 | } | 394 | } |
396 | 395 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index edb9873e27e3..9a826cde4fd1 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
36 | #include <asm/cpufeature.h> | 36 | #include <asm/cpufeature.h> |
37 | 37 | ||
38 | #include "speedstep-est-common.h" | ||
39 | |||
40 | #define PFX "speedstep-centrino: " | 38 | #define PFX "speedstep-centrino: " |
41 | #define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>" | 39 | #define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>" |
42 | 40 | ||
@@ -493,12 +491,13 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) | |||
493 | unsigned l, h; | 491 | unsigned l, h; |
494 | int ret; | 492 | int ret; |
495 | int i; | 493 | int i; |
494 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | ||
496 | 495 | ||
497 | /* Only Intel makes Enhanced Speedstep-capable CPUs */ | 496 | /* Only Intel makes Enhanced Speedstep-capable CPUs */ |
498 | if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) | 497 | if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) |
499 | return -ENODEV; | 498 | return -ENODEV; |
500 | 499 | ||
501 | if (is_const_loops_cpu(policy->cpu)) { | 500 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
502 | centrino_driver.flags |= CPUFREQ_CONST_LOOPS; | 501 | centrino_driver.flags |= CPUFREQ_CONST_LOOPS; |
503 | } | 502 | } |
504 | 503 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h b/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h deleted file mode 100644 index 5ce995c9d866..000000000000 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* | ||
2 | * Routines common for drivers handling Enhanced Speedstep Technology | ||
3 | * Copyright (C) 2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
4 | * | ||
5 | * Licensed under the terms of the GNU GPL License version 2 -- see | ||
6 | * COPYING for details. | ||
7 | */ | ||
8 | |||
9 | static inline int is_const_loops_cpu(unsigned int cpu) | ||
10 | { | ||
11 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
12 | |||
13 | if (c->x86_vendor != X86_VENDOR_INTEL || !cpu_has(c, X86_FEATURE_EST)) | ||
14 | return 0; | ||
15 | |||
16 | /* | ||
17 | * on P-4s, the TSC runs with constant frequency independent of cpu freq | ||
18 | * when we use EST | ||
19 | */ | ||
20 | if (c->x86 == 0xf) | ||
21 | return 1; | ||
22 | |||
23 | return 0; | ||
24 | } | ||
25 | |||
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c index 5e2da704f0fa..8c0120186b9f 100644 --- a/arch/i386/kernel/cpu/intel.c +++ b/arch/i386/kernel/cpu/intel.c | |||
@@ -183,10 +183,13 @@ static void __devinit init_intel(struct cpuinfo_x86 *c) | |||
183 | } | 183 | } |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | if (c->x86 == 15) | 186 | if (c->x86 == 15) |
187 | set_bit(X86_FEATURE_P4, c->x86_capability); | 187 | set_bit(X86_FEATURE_P4, c->x86_capability); |
188 | if (c->x86 == 6) | 188 | if (c->x86 == 6) |
189 | set_bit(X86_FEATURE_P3, c->x86_capability); | 189 | set_bit(X86_FEATURE_P3, c->x86_capability); |
190 | if ((c->x86 == 0xf && c->x86_model >= 0x03) || | ||
191 | (c->x86 == 0x6 && c->x86_model >= 0x0e)) | ||
192 | set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability); | ||
190 | } | 193 | } |
191 | 194 | ||
192 | 195 | ||
diff --git a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c index cf39e205d33c..5ac051bb9d55 100644 --- a/arch/i386/kernel/cpu/mtrr/if.c +++ b/arch/i386/kernel/cpu/mtrr/if.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/proc_fs.h> | 2 | #include <linux/proc_fs.h> |
3 | #include <linux/capability.h> | ||
3 | #include <linux/ctype.h> | 4 | #include <linux/ctype.h> |
4 | #include <linux/module.h> | 5 | #include <linux/module.h> |
5 | #include <linux/seq_file.h> | 6 | #include <linux/seq_file.h> |
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index 6d91b274589c..89a85af33d28 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c | |||
@@ -29,7 +29,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
29 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 29 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
30 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | 30 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, |
31 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | 31 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, |
32 | NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", | 32 | NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow", |
33 | 33 | ||
34 | /* Transmeta-defined */ | 34 | /* Transmeta-defined */ |
35 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | 35 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, |
@@ -40,7 +40,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
40 | /* Other (Linux-defined) */ | 40 | /* Other (Linux-defined) */ |
41 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | 41 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", |
42 | NULL, NULL, NULL, NULL, | 42 | NULL, NULL, NULL, NULL, |
43 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 43 | "constant_tsc", NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
44 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 44 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
45 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 45 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
46 | 46 | ||
@@ -57,11 +57,21 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
57 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 57 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
58 | 58 | ||
59 | /* AMD-defined (#2) */ | 59 | /* AMD-defined (#2) */ |
60 | "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, | 60 | "lahf_lm", "cmp_legacy", "svm", NULL, "cr8legacy", NULL, NULL, NULL, |
61 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 61 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
63 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 63 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
64 | }; | 64 | }; |
65 | static char *x86_power_flags[] = { | ||
66 | "ts", /* temperature sensor */ | ||
67 | "fid", /* frequency id control */ | ||
68 | "vid", /* voltage id control */ | ||
69 | "ttp", /* thermal trip */ | ||
70 | "tm", | ||
71 | "stc", | ||
72 | NULL, | ||
73 | /* nothing */ /* constant_tsc - moved to flags */ | ||
74 | }; | ||
65 | struct cpuinfo_x86 *c = v; | 75 | struct cpuinfo_x86 *c = v; |
66 | int i, n = c - cpu_data; | 76 | int i, n = c - cpu_data; |
67 | int fpu_exception; | 77 | int fpu_exception; |
@@ -131,6 +141,17 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
131 | x86_cap_flags[i] != NULL ) | 141 | x86_cap_flags[i] != NULL ) |
132 | seq_printf(m, " %s", x86_cap_flags[i]); | 142 | seq_printf(m, " %s", x86_cap_flags[i]); |
133 | 143 | ||
144 | for (i = 0; i < 32; i++) | ||
145 | if (c->x86_power & (1 << i)) { | ||
146 | if (i < ARRAY_SIZE(x86_power_flags) && | ||
147 | x86_power_flags[i]) | ||
148 | seq_printf(m, "%s%s", | ||
149 | x86_power_flags[i][0]?" ":"", | ||
150 | x86_power_flags[i]); | ||
151 | else | ||
152 | seq_printf(m, " [%d]", i); | ||
153 | } | ||
154 | |||
134 | seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n", | 155 | seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n", |
135 | c->loops_per_jiffy/(500000/HZ), | 156 | c->loops_per_jiffy/(500000/HZ), |
136 | (c->loops_per_jiffy/(5000/HZ)) % 100); | 157 | (c->loops_per_jiffy/(5000/HZ)) % 100); |
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index 58516e2ac172..6a93d75db431 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/dmi.h> | 5 | #include <linux/dmi.h> |
6 | #include <linux/bootmem.h> | 6 | #include <linux/bootmem.h> |
7 | 7 | #include <linux/slab.h> | |
8 | 8 | ||
9 | static char * __init dmi_string(struct dmi_header *dm, u8 s) | 9 | static char * __init dmi_string(struct dmi_header *dm, u8 s) |
10 | { | 10 | { |
@@ -19,7 +19,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s) | |||
19 | } | 19 | } |
20 | 20 | ||
21 | if (*bp != 0) { | 21 | if (*bp != 0) { |
22 | str = alloc_bootmem(strlen(bp) + 1); | 22 | str = dmi_alloc(strlen(bp) + 1); |
23 | if (str != NULL) | 23 | if (str != NULL) |
24 | strcpy(str, bp); | 24 | strcpy(str, bp); |
25 | else | 25 | else |
@@ -40,7 +40,7 @@ static int __init dmi_table(u32 base, int len, int num, | |||
40 | u8 *buf, *data; | 40 | u8 *buf, *data; |
41 | int i = 0; | 41 | int i = 0; |
42 | 42 | ||
43 | buf = bt_ioremap(base, len); | 43 | buf = dmi_ioremap(base, len); |
44 | if (buf == NULL) | 44 | if (buf == NULL) |
45 | return -1; | 45 | return -1; |
46 | 46 | ||
@@ -65,7 +65,7 @@ static int __init dmi_table(u32 base, int len, int num, | |||
65 | data += 2; | 65 | data += 2; |
66 | i++; | 66 | i++; |
67 | } | 67 | } |
68 | bt_iounmap(buf, len); | 68 | dmi_iounmap(buf, len); |
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
@@ -112,7 +112,7 @@ static void __init dmi_save_devices(struct dmi_header *dm) | |||
112 | if ((*d & 0x80) == 0) | 112 | if ((*d & 0x80) == 0) |
113 | continue; | 113 | continue; |
114 | 114 | ||
115 | dev = alloc_bootmem(sizeof(*dev)); | 115 | dev = dmi_alloc(sizeof(*dev)); |
116 | if (!dev) { | 116 | if (!dev) { |
117 | printk(KERN_ERR "dmi_save_devices: out of memory.\n"); | 117 | printk(KERN_ERR "dmi_save_devices: out of memory.\n"); |
118 | break; | 118 | break; |
@@ -131,7 +131,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm) | |||
131 | struct dmi_device *dev; | 131 | struct dmi_device *dev; |
132 | void * data; | 132 | void * data; |
133 | 133 | ||
134 | data = alloc_bootmem(dm->length); | 134 | data = dmi_alloc(dm->length); |
135 | if (data == NULL) { | 135 | if (data == NULL) { |
136 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); | 136 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); |
137 | return; | 137 | return; |
@@ -139,7 +139,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm) | |||
139 | 139 | ||
140 | memcpy(data, dm, dm->length); | 140 | memcpy(data, dm, dm->length); |
141 | 141 | ||
142 | dev = alloc_bootmem(sizeof(*dev)); | 142 | dev = dmi_alloc(sizeof(*dev)); |
143 | if (!dev) { | 143 | if (!dev) { |
144 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); | 144 | printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); |
145 | return; | 145 | return; |
@@ -221,7 +221,7 @@ void __init dmi_scan_machine(void) | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | out: printk(KERN_INFO "DMI not present.\n"); | 224 | out: printk(KERN_INFO "DMI not present or invalid.\n"); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 7554f8fd874a..f2dd218d88cb 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c | |||
@@ -1649,7 +1649,7 @@ static void __init enable_IO_APIC(void) | |||
1649 | for(apic = 0; apic < nr_ioapics; apic++) { | 1649 | for(apic = 0; apic < nr_ioapics; apic++) { |
1650 | int pin; | 1650 | int pin; |
1651 | /* See if any of the pins is in ExtINT mode */ | 1651 | /* See if any of the pins is in ExtINT mode */ |
1652 | for(pin = 0; pin < nr_ioapic_registers[i]; pin++) { | 1652 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { |
1653 | struct IO_APIC_route_entry entry; | 1653 | struct IO_APIC_route_entry entry; |
1654 | spin_lock_irqsave(&ioapic_lock, flags); | 1654 | spin_lock_irqsave(&ioapic_lock, flags); |
1655 | *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); | 1655 | *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); |
diff --git a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c index b59a34dbe262..79026f026b85 100644 --- a/arch/i386/kernel/ioport.c +++ b/arch/i386/kernel/ioport.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
12 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 2f372dbd34fd..6483eeb1a4e8 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -188,6 +188,19 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
188 | kcb->kprobe_status = KPROBE_REENTER; | 188 | kcb->kprobe_status = KPROBE_REENTER; |
189 | return 1; | 189 | return 1; |
190 | } else { | 190 | } else { |
191 | if (regs->eflags & VM_MASK) { | ||
192 | /* We are in virtual-8086 mode. Return 0 */ | ||
193 | goto no_kprobe; | ||
194 | } | ||
195 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
196 | /* The breakpoint instruction was removed by | ||
197 | * another cpu right after we hit, no further | ||
198 | * handling of this interrupt is appropriate | ||
199 | */ | ||
200 | regs->eip -= sizeof(kprobe_opcode_t); | ||
201 | ret = 1; | ||
202 | goto no_kprobe; | ||
203 | } | ||
191 | p = __get_cpu_var(current_kprobe); | 204 | p = __get_cpu_var(current_kprobe); |
192 | if (p->break_handler && p->break_handler(p, regs)) { | 205 | if (p->break_handler && p->break_handler(p, regs)) { |
193 | goto ss_probe; | 206 | goto ss_probe; |
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 165f13158c60..d3fdf0057d82 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c | |||
@@ -70,6 +70,7 @@ | |||
70 | */ | 70 | */ |
71 | 71 | ||
72 | //#define DEBUG /* pr_debug */ | 72 | //#define DEBUG /* pr_debug */ |
73 | #include <linux/capability.h> | ||
73 | #include <linux/kernel.h> | 74 | #include <linux/kernel.h> |
74 | #include <linux/init.h> | 75 | #include <linux/init.h> |
75 | #include <linux/sched.h> | 76 | #include <linux/sched.h> |
@@ -165,7 +166,7 @@ static void collect_cpu_info (void *unused) | |||
165 | 166 | ||
166 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); | 167 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); |
167 | /* see notes above for revision 1.07. Apparent chip bug */ | 168 | /* see notes above for revision 1.07. Apparent chip bug */ |
168 | serialize_cpu(); | 169 | sync_core(); |
169 | /* get the current revision from MSR 0x8B */ | 170 | /* get the current revision from MSR 0x8B */ |
170 | rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev); | 171 | rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev); |
171 | pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", | 172 | pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", |
@@ -379,7 +380,7 @@ static void do_update_one (void * unused) | |||
379 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); | 380 | wrmsr(MSR_IA32_UCODE_REV, 0, 0); |
380 | 381 | ||
381 | /* see notes above for revision 1.07. Apparent chip bug */ | 382 | /* see notes above for revision 1.07. Apparent chip bug */ |
382 | serialize_cpu(); | 383 | sync_core(); |
383 | 384 | ||
384 | /* get the current revision from MSR 0x8B */ | 385 | /* get the current revision from MSR 0x8B */ |
385 | rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); | 386 | rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); |
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c index 2fa5803a759d..d207242976d3 100644 --- a/arch/i386/kernel/reboot.c +++ b/arch/i386/kernel/reboot.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/efi.h> | 12 | #include <linux/efi.h> |
13 | #include <linux/dmi.h> | 13 | #include <linux/dmi.h> |
14 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
15 | #include <linux/pm.h> | ||
15 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
16 | #include <asm/apic.h> | 17 | #include <asm/apic.h> |
17 | #include <asm/desc.h> | 18 | #include <asm/desc.h> |
@@ -355,10 +356,10 @@ void machine_halt(void) | |||
355 | 356 | ||
356 | void machine_power_off(void) | 357 | void machine_power_off(void) |
357 | { | 358 | { |
358 | machine_shutdown(); | 359 | if (pm_power_off) { |
359 | 360 | machine_shutdown(); | |
360 | if (pm_power_off) | ||
361 | pm_power_off(); | 361 | pm_power_off(); |
362 | } | ||
362 | } | 363 | } |
363 | 364 | ||
364 | 365 | ||
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index f685637a100d..51e513b4f72d 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/nodemask.h> | 45 | #include <linux/nodemask.h> |
46 | #include <linux/kexec.h> | 46 | #include <linux/kexec.h> |
47 | #include <linux/crash_dump.h> | 47 | #include <linux/crash_dump.h> |
48 | #include <linux/dmi.h> | ||
48 | 49 | ||
49 | #include <video/edid.h> | 50 | #include <video/edid.h> |
50 | 51 | ||
@@ -146,7 +147,6 @@ EXPORT_SYMBOL(ist_info); | |||
146 | struct e820map e820; | 147 | struct e820map e820; |
147 | 148 | ||
148 | extern void early_cpu_init(void); | 149 | extern void early_cpu_init(void); |
149 | extern void dmi_scan_machine(void); | ||
150 | extern void generic_apic_probe(char *); | 150 | extern void generic_apic_probe(char *); |
151 | extern int root_mountflags; | 151 | extern int root_mountflags; |
152 | 152 | ||
@@ -1584,7 +1584,7 @@ void __init setup_arch(char **cmdline_p) | |||
1584 | if (s) { | 1584 | if (s) { |
1585 | extern void setup_early_printk(char *); | 1585 | extern void setup_early_printk(char *); |
1586 | 1586 | ||
1587 | setup_early_printk(s); | 1587 | setup_early_printk(strchr(s, '=') + 1); |
1588 | printk("early console enabled\n"); | 1588 | printk("early console enabled\n"); |
1589 | } | 1589 | } |
1590 | } | 1590 | } |
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 41c5b2dc6200..a14d594bfbeb 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c | |||
@@ -302,6 +302,12 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
302 | do_timer_interrupt(irq, regs); | 302 | do_timer_interrupt(irq, regs); |
303 | 303 | ||
304 | write_sequnlock(&xtime_lock); | 304 | write_sequnlock(&xtime_lock); |
305 | |||
306 | #ifdef CONFIG_X86_LOCAL_APIC | ||
307 | if (using_apic_timer) | ||
308 | smp_send_timer_broadcast_ipi(regs); | ||
309 | #endif | ||
310 | |||
305 | return IRQ_HANDLED; | 311 | return IRQ_HANDLED; |
306 | } | 312 | } |
307 | 313 | ||
diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c index fc1993564f98..cbdb0afed76a 100644 --- a/arch/i386/kernel/vm86.c +++ b/arch/i386/kernel/vm86.c | |||
@@ -30,6 +30,7 @@ | |||
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/capability.h> | ||
33 | #include <linux/config.h> | 34 | #include <linux/config.h> |
34 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
35 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 19ee635eeb70..a346e1833bf2 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/fcntl.h> | 26 | #include <linux/fcntl.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/capability.h> | ||
29 | #include <linux/console.h> | 30 | #include <linux/console.h> |
30 | #include <linux/module.h> | 31 | #include <linux/module.h> |
31 | #include <linux/serial.h> | 32 | #include <linux/serial.h> |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 5ea38286d8d5..0668b2b7714d 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/ptrace.h> | 48 | #include <linux/ptrace.h> |
49 | #include <linux/stat.h> | 49 | #include <linux/stat.h> |
50 | #include <linux/ipc.h> | 50 | #include <linux/ipc.h> |
51 | #include <linux/capability.h> | ||
51 | #include <linux/compat.h> | 52 | #include <linux/compat.h> |
52 | #include <linux/vfs.h> | 53 | #include <linux/vfs.h> |
53 | #include <linux/mman.h> | 54 | #include <linux/mman.h> |
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 4de7f6759093..346fedf9ea47 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -638,6 +638,13 @@ static int __kprobes pre_kprobes_handler(struct die_args *args) | |||
638 | if (p->break_handler && p->break_handler(p, regs)) { | 638 | if (p->break_handler && p->break_handler(p, regs)) { |
639 | goto ss_probe; | 639 | goto ss_probe; |
640 | } | 640 | } |
641 | } else if (!is_ia64_break_inst(regs)) { | ||
642 | /* The breakpoint instruction was removed by | ||
643 | * another cpu right after we hit, no further | ||
644 | * handling of this interrupt is appropriate | ||
645 | */ | ||
646 | ret = 1; | ||
647 | goto no_kprobe; | ||
641 | } else { | 648 | } else { |
642 | /* Not our break */ | 649 | /* Not our break */ |
643 | goto no_kprobe; | 650 | goto no_kprobe; |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 410d4804fa6e..c026ac1142a6 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/pagemap.h> | 38 | #include <linux/pagemap.h> |
39 | #include <linux/mount.h> | 39 | #include <linux/mount.h> |
40 | #include <linux/bitops.h> | 40 | #include <linux/bitops.h> |
41 | #include <linux/capability.h> | ||
41 | #include <linux/rcupdate.h> | 42 | #include <linux/rcupdate.h> |
42 | 43 | ||
43 | #include <asm/errno.h> | 44 | #include <asm/errno.h> |
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index 1461dc660b43..a87a162a3086 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c | |||
@@ -29,6 +29,7 @@ | |||
29 | * Replace some NR_CPUS by cpus_online, for hotplug cpu. | 29 | * Replace some NR_CPUS by cpus_online, for hotplug cpu. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/capability.h> | ||
32 | #include <linux/types.h> | 33 | #include <linux/types.h> |
33 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
34 | #include <linux/module.h> | 35 | #include <linux/module.h> |
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c index 768c21deb2e5..493fb3f38dc3 100644 --- a/arch/ia64/sn/kernel/tiocx.c +++ b/arch/ia64/sn/kernel/tiocx.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/device.h> | 15 | #include <linux/device.h> |
15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
16 | #include <asm/system.h> | 17 | #include <asm/system.h> |
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c index eb63ca6ed94c..f7573f2bcb9c 100644 --- a/arch/m68k/bvme6000/rtc.c +++ b/arch/m68k/bvme6000/rtc.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/miscdevice.h> | 11 | #include <linux/miscdevice.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/fcntl.h> | 15 | #include <linux/fcntl.h> |
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/poll.h> | 17 | #include <linux/poll.h> |
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c index 2ed7b783f654..640895b2c51a 100644 --- a/arch/m68k/kernel/sys_m68k.c +++ b/arch/m68k/kernel/sys_m68k.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * platform. | 6 | * platform. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/capability.h> | ||
9 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
10 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
11 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c index 7977eae50af2..30f5921ece9b 100644 --- a/arch/m68k/mvme16x/rtc.c +++ b/arch/m68k/mvme16x/rtc.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/miscdevice.h> | 11 | #include <linux/miscdevice.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/fcntl.h> | 15 | #include <linux/fcntl.h> |
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/poll.h> | 17 | #include <linux/poll.h> |
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index ee98eeb65e85..006881942aa2 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | #include <linux/a.out.h> | 11 | #include <linux/a.out.h> |
12 | #include <linux/capability.h> | ||
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
13 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
14 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 52924f8ce23c..0fc3730a294f 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <linux/binfmts.h> | 10 | #include <linux/binfmts.h> |
11 | #include <linux/capability.h> | ||
11 | #include <linux/highuid.h> | 12 | #include <linux/highuid.h> |
12 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
13 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index a64fd48fbfb5..29b4d61898f2 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -22,6 +22,7 @@ | |||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/capability.h> | ||
25 | #include <linux/file.h> | 26 | #include <linux/file.h> |
26 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
27 | #include <linux/namei.h> | 28 | #include <linux/namei.h> |
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c index 79dcbcccecb8..11d406cd0b3e 100644 --- a/arch/parisc/kernel/perf.c +++ b/arch/parisc/kernel/perf.c | |||
@@ -42,6 +42,7 @@ | |||
42 | * on every box. | 42 | * on every box. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/capability.h> | ||
45 | #include <linux/init.h> | 46 | #include <linux/init.h> |
46 | #include <linux/proc_fs.h> | 47 | #include <linux/proc_fs.h> |
47 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 935d96571515..01feed0e2a15 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -71,15 +71,39 @@ config ARCH_MAY_HAVE_PC_FDC | |||
71 | bool | 71 | bool |
72 | default y | 72 | default y |
73 | 73 | ||
74 | config PPC_OF | ||
75 | def_bool y | ||
76 | |||
77 | config PPC_UDBG_16550 | ||
78 | bool | ||
79 | default n | ||
80 | |||
81 | config CRASH_DUMP | ||
82 | bool "kernel crash dumps (EXPERIMENTAL)" | ||
83 | depends on PPC_MULTIPLATFORM | ||
84 | depends on EXPERIMENTAL | ||
85 | help | ||
86 | Build a kernel suitable for use as a kdump capture kernel. | ||
87 | The kernel will be linked at a different address than normal, and | ||
88 | so can only be used for Kdump. | ||
89 | |||
90 | Don't change this unless you know what you are doing. | ||
91 | |||
92 | config GENERIC_TBSYNC | ||
93 | bool | ||
94 | default y if PPC32 && SMP | ||
95 | default n | ||
96 | |||
74 | menu "Processor support" | 97 | menu "Processor support" |
75 | choice | 98 | choice |
76 | prompt "Processor Type" | 99 | prompt "Processor Type" |
77 | depends on PPC32 | 100 | depends on PPC32 |
78 | default 6xx | 101 | default 6xx |
79 | 102 | ||
80 | config 6xx | 103 | config CLASSIC32 |
81 | bool "6xx/7xx/74xx" | 104 | bool "6xx/7xx/74xx" |
82 | select PPC_FPU | 105 | select PPC_FPU |
106 | select 6xx | ||
83 | help | 107 | help |
84 | There are four families of PowerPC chips supported. The more common | 108 | There are four families of PowerPC chips supported. The more common |
85 | types (601, 603, 604, 740, 750, 7400), the Motorola embedded | 109 | types (601, 603, 604, 740, 750, 7400), the Motorola embedded |
@@ -93,12 +117,20 @@ config 6xx | |||
93 | 117 | ||
94 | config PPC_52xx | 118 | config PPC_52xx |
95 | bool "Freescale 52xx" | 119 | bool "Freescale 52xx" |
120 | select 6xx | ||
121 | select PPC_FPU | ||
96 | 122 | ||
97 | config PPC_82xx | 123 | config PPC_82xx |
98 | bool "Freescale 82xx" | 124 | bool "Freescale 82xx" |
125 | select 6xx | ||
126 | select PPC_FPU | ||
99 | 127 | ||
100 | config PPC_83xx | 128 | config PPC_83xx |
101 | bool "Freescale 83xx" | 129 | bool "Freescale 83xx" |
130 | select 6xx | ||
131 | select FSL_SOC | ||
132 | select 83xx | ||
133 | select PPC_FPU | ||
102 | 134 | ||
103 | config 40x | 135 | config 40x |
104 | bool "AMCC 40x" | 136 | bool "AMCC 40x" |
@@ -134,6 +166,13 @@ config POWER4 | |||
134 | depends on PPC64 | 166 | depends on PPC64 |
135 | def_bool y | 167 | def_bool y |
136 | 168 | ||
169 | config 6xx | ||
170 | bool | ||
171 | |||
172 | # this is temp to handle compat with arch=ppc | ||
173 | config 83xx | ||
174 | bool | ||
175 | |||
137 | config PPC_FPU | 176 | config PPC_FPU |
138 | bool | 177 | bool |
139 | default y if PPC64 | 178 | default y if PPC64 |
@@ -166,7 +205,7 @@ config PHYS_64BIT | |||
166 | 205 | ||
167 | config ALTIVEC | 206 | config ALTIVEC |
168 | bool "AltiVec Support" | 207 | bool "AltiVec Support" |
169 | depends on 6xx || POWER4 | 208 | depends on CLASSIC32 || POWER4 |
170 | ---help--- | 209 | ---help--- |
171 | This option enables kernel support for the Altivec extensions to the | 210 | This option enables kernel support for the Altivec extensions to the |
172 | PowerPC processor. The kernel currently supports saving and restoring | 211 | PowerPC processor. The kernel currently supports saving and restoring |
@@ -239,7 +278,7 @@ endmenu | |||
239 | source "init/Kconfig" | 278 | source "init/Kconfig" |
240 | 279 | ||
241 | menu "Platform support" | 280 | menu "Platform support" |
242 | depends on PPC64 || 6xx | 281 | depends on PPC64 || CLASSIC32 |
243 | 282 | ||
244 | choice | 283 | choice |
245 | prompt "Machine type" | 284 | prompt "Machine type" |
@@ -330,9 +369,6 @@ config PPC_CELL | |||
330 | select MMIO_NVRAM | 369 | select MMIO_NVRAM |
331 | select PPC_UDBG_16550 | 370 | select PPC_UDBG_16550 |
332 | 371 | ||
333 | config PPC_OF | ||
334 | def_bool y | ||
335 | |||
336 | config XICS | 372 | config XICS |
337 | depends on PPC_PSERIES | 373 | depends on PPC_PSERIES |
338 | bool | 374 | bool |
@@ -375,26 +411,11 @@ config MPIC_BROKEN_U3 | |||
375 | depends on PPC_MAPLE | 411 | depends on PPC_MAPLE |
376 | default y | 412 | default y |
377 | 413 | ||
378 | config PPC_UDBG_16550 | ||
379 | bool | ||
380 | default n | ||
381 | |||
382 | config CELL_IIC | 414 | config CELL_IIC |
383 | depends on PPC_CELL | 415 | depends on PPC_CELL |
384 | bool | 416 | bool |
385 | default y | 417 | default y |
386 | 418 | ||
387 | config CRASH_DUMP | ||
388 | bool "kernel crash dumps (EXPERIMENTAL)" | ||
389 | depends on PPC_MULTIPLATFORM | ||
390 | depends on EXPERIMENTAL | ||
391 | help | ||
392 | Build a kernel suitable for use as a kdump capture kernel. | ||
393 | The kernel will be linked at a different address than normal, and | ||
394 | so can only be used for Kdump. | ||
395 | |||
396 | Don't change this unless you know what you are doing. | ||
397 | |||
398 | config IBMVIO | 419 | config IBMVIO |
399 | depends on PPC_PSERIES || PPC_ISERIES | 420 | depends on PPC_PSERIES || PPC_ISERIES |
400 | bool | 421 | bool |
@@ -410,11 +431,6 @@ config PPC_MPC106 | |||
410 | bool | 431 | bool |
411 | default n | 432 | default n |
412 | 433 | ||
413 | config GENERIC_TBSYNC | ||
414 | bool | ||
415 | default y if PPC32 && SMP | ||
416 | default n | ||
417 | |||
418 | source "drivers/cpufreq/Kconfig" | 434 | source "drivers/cpufreq/Kconfig" |
419 | 435 | ||
420 | config CPU_FREQ_PMAC | 436 | config CPU_FREQ_PMAC |
@@ -495,6 +511,7 @@ endmenu | |||
495 | 511 | ||
496 | source arch/powerpc/platforms/embedded6xx/Kconfig | 512 | source arch/powerpc/platforms/embedded6xx/Kconfig |
497 | source arch/powerpc/platforms/4xx/Kconfig | 513 | source arch/powerpc/platforms/4xx/Kconfig |
514 | source arch/powerpc/platforms/83xx/Kconfig | ||
498 | source arch/powerpc/platforms/85xx/Kconfig | 515 | source arch/powerpc/platforms/85xx/Kconfig |
499 | source arch/powerpc/platforms/8xx/Kconfig | 516 | source arch/powerpc/platforms/8xx/Kconfig |
500 | source arch/powerpc/platforms/cell/Kconfig | 517 | source arch/powerpc/platforms/cell/Kconfig |
@@ -718,7 +735,7 @@ config PPC_I8259 | |||
718 | config PPC_INDIRECT_PCI | 735 | config PPC_INDIRECT_PCI |
719 | bool | 736 | bool |
720 | depends on PCI | 737 | depends on PCI |
721 | default y if 40x || 44x || 85xx || 83xx | 738 | default y if 40x || 44x || 85xx |
722 | default n | 739 | default n |
723 | 740 | ||
724 | config EISA | 741 | config EISA |
@@ -727,13 +744,16 @@ config EISA | |||
727 | config SBUS | 744 | config SBUS |
728 | bool | 745 | bool |
729 | 746 | ||
747 | config FSL_SOC | ||
748 | bool | ||
749 | |||
730 | # Yes MCA RS/6000s exist but Linux-PPC does not currently support any | 750 | # Yes MCA RS/6000s exist but Linux-PPC does not currently support any |
731 | config MCA | 751 | config MCA |
732 | bool | 752 | bool |
733 | 753 | ||
734 | config PCI | 754 | config PCI |
735 | bool "PCI support" if 40x || CPM2 || 83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) | 755 | bool "PCI support" if 40x || CPM2 || PPC_83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) |
736 | default y if !40x && !CPM2 && !8xx && !APUS && !83xx && !85xx | 756 | default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !85xx |
737 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS | 757 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS |
738 | default PCI_QSPAN if !4xx && !CPM2 && 8xx | 758 | default PCI_QSPAN if !4xx && !CPM2 && 8xx |
739 | help | 759 | help |
@@ -746,11 +766,6 @@ config PCI_DOMAINS | |||
746 | bool | 766 | bool |
747 | default PCI | 767 | default PCI |
748 | 768 | ||
749 | config MPC83xx_PCI2 | ||
750 | bool " Supprt for 2nd PCI host controller" | ||
751 | depends on PCI && MPC834x | ||
752 | default y if MPC834x_SYS | ||
753 | |||
754 | config PCI_QSPAN | 769 | config PCI_QSPAN |
755 | bool "QSpan PCI" | 770 | bool "QSpan PCI" |
756 | depends on !4xx && !CPM2 && 8xx | 771 | depends on !4xx && !CPM2 && 8xx |
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index 30a30bf559ea..9254806f7032 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -115,4 +115,46 @@ config PPC_OCP | |||
115 | depends on IBM_OCP || XILINX_OCP | 115 | depends on IBM_OCP || XILINX_OCP |
116 | default y | 116 | default y |
117 | 117 | ||
118 | choice | ||
119 | prompt "Early debugging (dangerous)" | ||
120 | bool | ||
121 | optional | ||
122 | help | ||
123 | Enable early debugging. Careful, if you enable debugging for the | ||
124 | wrong type of machine your kernel _will not boot_. | ||
125 | |||
126 | config PPC_EARLY_DEBUG_LPAR | ||
127 | bool "LPAR HV Console" | ||
128 | depends on PPC_PSERIES | ||
129 | help | ||
130 | Select this to enable early debugging for a machine with a HVC | ||
131 | console on vterm 0. | ||
132 | |||
133 | config PPC_EARLY_DEBUG_G5 | ||
134 | bool "Apple G5" | ||
135 | depends on PPC_PMAC64 | ||
136 | help | ||
137 | Select this to enable early debugging for Apple G5 machines. | ||
138 | |||
139 | config PPC_EARLY_DEBUG_RTAS | ||
140 | bool "RTAS Panel" | ||
141 | depends on PPC_RTAS | ||
142 | help | ||
143 | Select this to enable early debugging via the RTAS panel. | ||
144 | |||
145 | config PPC_EARLY_DEBUG_MAPLE | ||
146 | bool "Maple real mode" | ||
147 | depends on PPC_MAPLE | ||
148 | help | ||
149 | Select this to enable early debugging for Maple. | ||
150 | |||
151 | config PPC_EARLY_DEBUG_ISERIES | ||
152 | bool "iSeries HV Console" | ||
153 | depends on PPC_ISERIES | ||
154 | help | ||
155 | Select this to enable early debugging for legacy iSeries. You need | ||
156 | to hit "Ctrl-x Ctrl-x" to see the messages on the console. | ||
157 | |||
158 | endchoice | ||
159 | |||
118 | endmenu | 160 | endmenu |
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore new file mode 100644 index 000000000000..45c9ad23526e --- /dev/null +++ b/arch/powerpc/boot/.gitignore | |||
@@ -0,0 +1,20 @@ | |||
1 | addnote | ||
2 | infblock.c | ||
3 | infblock.h | ||
4 | infcodes.c | ||
5 | infcodes.h | ||
6 | inffast.c | ||
7 | inffast.h | ||
8 | inflate.c | ||
9 | inftrees.c | ||
10 | inftrees.h | ||
11 | infutil.c | ||
12 | infutil.h | ||
13 | kernel-vmlinux.strip.c | ||
14 | kernel-vmlinux.strip.gz | ||
15 | uImage | ||
16 | zImage | ||
17 | zImage.vmode | ||
18 | zconf.h | ||
19 | zlib.h | ||
20 | zutil.h | ||
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 22726aefc8ea..b53d677f6742 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile | |||
@@ -176,4 +176,4 @@ $(obj)/uImage: $(obj)/vmlinux.gz | |||
176 | install: $(CONFIGURE) $(BOOTIMAGE) | 176 | install: $(CONFIGURE) $(BOOTIMAGE) |
177 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)" | 177 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)" |
178 | 178 | ||
179 | clean-files := $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip) | 179 | clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip) |
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index 347f4391db8d..0b2b55a79c3c 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig | |||
@@ -878,7 +878,7 @@ CONFIG_HVCS=m | |||
878 | # | 878 | # |
879 | # CONFIG_WATCHDOG is not set | 879 | # CONFIG_WATCHDOG is not set |
880 | # CONFIG_RTC is not set | 880 | # CONFIG_RTC is not set |
881 | # CONFIG_GEN_RTC is not set | 881 | CONFIG_GEN_RTC=y |
882 | # CONFIG_DTLK is not set | 882 | # CONFIG_DTLK is not set |
883 | # CONFIG_R3964 is not set | 883 | # CONFIG_R3964 is not set |
884 | # CONFIG_APPLICOM is not set | 884 | # CONFIG_APPLICOM is not set |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 144e284d21dd..bbfa1bdceb4d 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -61,9 +61,9 @@ obj-$(CONFIG_MODULES) += $(module-y) | |||
61 | pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \ | 61 | pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \ |
62 | pci_direct_iommu.o iomap.o | 62 | pci_direct_iommu.o iomap.o |
63 | obj-$(CONFIG_PCI) += $(pci64-y) | 63 | obj-$(CONFIG_PCI) += $(pci64-y) |
64 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o | 64 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o crash.o |
65 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o | 65 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o |
66 | obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y) | 66 | obj-$(CONFIG_KEXEC) += machine_kexec.o $(kexec-y) |
67 | 67 | ||
68 | ifeq ($(CONFIG_PPC_ISERIES),y) | 68 | ifeq ($(CONFIG_PPC_ISERIES),y) |
69 | $(obj)/head_64.o: $(obj)/lparmap.s | 69 | $(obj)/head_64.o: $(obj)/lparmap.s |
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 4681155121ef..5f248e3fdf82 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/kexec.h> | 18 | #include <linux/kexec.h> |
19 | #include <linux/bootmem.h> | 19 | #include <linux/bootmem.h> |
20 | #include <linux/crash_dump.h> | 20 | #include <linux/crash_dump.h> |
21 | #include <linux/irq.h> | ||
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/elf.h> | 22 | #include <linux/elf.h> |
24 | #include <linux/elfcore.h> | 23 | #include <linux/elfcore.h> |
@@ -30,6 +29,7 @@ | |||
30 | #include <asm/kdump.h> | 29 | #include <asm/kdump.h> |
31 | #include <asm/lmb.h> | 30 | #include <asm/lmb.h> |
32 | #include <asm/firmware.h> | 31 | #include <asm/firmware.h> |
32 | #include <asm/smp.h> | ||
33 | 33 | ||
34 | #ifdef DEBUG | 34 | #ifdef DEBUG |
35 | #include <asm/udbg.h> | 35 | #include <asm/udbg.h> |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 87effa3f21a7..211d72653ea6 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -55,6 +55,7 @@ void __init kdump_setup(void) | |||
55 | DBG(" <- kdump_setup()\n"); | 55 | DBG(" <- kdump_setup()\n"); |
56 | } | 56 | } |
57 | 57 | ||
58 | #ifdef CONFIG_PROC_VMCORE | ||
58 | static int __init parse_elfcorehdr(char *p) | 59 | static int __init parse_elfcorehdr(char *p) |
59 | { | 60 | { |
60 | if (p) | 61 | if (p) |
@@ -63,6 +64,7 @@ static int __init parse_elfcorehdr(char *p) | |||
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | __setup("elfcorehdr=", parse_elfcorehdr); | 66 | __setup("elfcorehdr=", parse_elfcorehdr); |
67 | #endif | ||
66 | 68 | ||
67 | static int __init parse_savemaxmem(char *p) | 69 | static int __init parse_savemaxmem(char *p) |
68 | { | 70 | { |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 27b0c40601fb..cfab48566db1 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -179,6 +179,18 @@ static inline int kprobe_handler(struct pt_regs *regs) | |||
179 | kcb->kprobe_status = KPROBE_REENTER; | 179 | kcb->kprobe_status = KPROBE_REENTER; |
180 | return 1; | 180 | return 1; |
181 | } else { | 181 | } else { |
182 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
183 | /* If trap variant, then it belongs not to us */ | ||
184 | kprobe_opcode_t cur_insn = *addr; | ||
185 | if (is_trap(cur_insn)) | ||
186 | goto no_kprobe; | ||
187 | /* The breakpoint instruction was removed by | ||
188 | * another cpu right after we hit, no further | ||
189 | * handling of this interrupt is appropriate | ||
190 | */ | ||
191 | ret = 1; | ||
192 | goto no_kprobe; | ||
193 | } | ||
182 | p = __get_cpu_var(current_kprobe); | 194 | p = __get_cpu_var(current_kprobe); |
183 | if (p->break_handler && p->break_handler(p, regs)) { | 195 | if (p->break_handler && p->break_handler(p, regs)) { |
184 | goto ss_probe; | 196 | goto ss_probe; |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index a91e40c9ae45..a81ca1b841ec 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -14,12 +14,6 @@ | |||
14 | #include <linux/threads.h> | 14 | #include <linux/threads.h> |
15 | #include <asm/machdep.h> | 15 | #include <asm/machdep.h> |
16 | 16 | ||
17 | /* | ||
18 | * Provide a dummy crash_notes definition until crash dump is implemented. | ||
19 | * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. | ||
20 | */ | ||
21 | note_buf_t crash_notes[NR_CPUS]; | ||
22 | |||
23 | void machine_crash_shutdown(struct pt_regs *regs) | 17 | void machine_crash_shutdown(struct pt_regs *regs) |
24 | { | 18 | { |
25 | if (ppc_md.machine_crash_shutdown) | 19 | if (ppc_md.machine_crash_shutdown) |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index ba21a6c4f467..24fe70f40b66 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -271,6 +271,9 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *b) | |||
271 | list_for_each_entry(child_bus, &b->children, node) | 271 | list_for_each_entry(child_bus, &b->children, node) |
272 | pcibios_claim_one_bus(child_bus); | 272 | pcibios_claim_one_bus(child_bus); |
273 | } | 273 | } |
274 | #ifdef CONFIG_HOTPLUG | ||
275 | EXPORT_SYMBOL_GPL(pcibios_claim_one_bus); | ||
276 | #endif | ||
274 | 277 | ||
275 | #ifndef CONFIG_PPC_ISERIES | 278 | #ifndef CONFIG_PPC_ISERIES |
276 | static void __init pcibios_claim_of_setup(void) | 279 | static void __init pcibios_claim_of_setup(void) |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index ae2e2a31a705..4b9cfe4637b1 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/capability.h> | ||
20 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
21 | 22 | ||
22 | #include <asm/prom.h> | 23 | #include <asm/prom.h> |
@@ -29,6 +30,7 @@ | |||
29 | #include <asm/delay.h> | 30 | #include <asm/delay.h> |
30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
31 | #include <asm/lmb.h> | 32 | #include <asm/lmb.h> |
33 | #include <asm/udbg.h> | ||
32 | 34 | ||
33 | struct rtas_t rtas = { | 35 | struct rtas_t rtas = { |
34 | .lock = SPIN_LOCK_UNLOCKED | 36 | .lock = SPIN_LOCK_UNLOCKED |
@@ -52,7 +54,7 @@ EXPORT_SYMBOL(rtas_flash_term_hook); | |||
52 | * are designed only for very early low-level debugging, which | 54 | * are designed only for very early low-level debugging, which |
53 | * is why the token is hard-coded to 10. | 55 | * is why the token is hard-coded to 10. |
54 | */ | 56 | */ |
55 | void call_rtas_display_status(unsigned char c) | 57 | static void call_rtas_display_status(char c) |
56 | { | 58 | { |
57 | struct rtas_args *args = &rtas.args; | 59 | struct rtas_args *args = &rtas.args; |
58 | unsigned long s; | 60 | unsigned long s; |
@@ -65,14 +67,14 @@ void call_rtas_display_status(unsigned char c) | |||
65 | args->nargs = 1; | 67 | args->nargs = 1; |
66 | args->nret = 1; | 68 | args->nret = 1; |
67 | args->rets = (rtas_arg_t *)&(args->args[1]); | 69 | args->rets = (rtas_arg_t *)&(args->args[1]); |
68 | args->args[0] = (int)c; | 70 | args->args[0] = (unsigned char)c; |
69 | 71 | ||
70 | enter_rtas(__pa(args)); | 72 | enter_rtas(__pa(args)); |
71 | 73 | ||
72 | spin_unlock_irqrestore(&rtas.lock, s); | 74 | spin_unlock_irqrestore(&rtas.lock, s); |
73 | } | 75 | } |
74 | 76 | ||
75 | void call_rtas_display_status_delay(unsigned char c) | 77 | static void call_rtas_display_status_delay(char c) |
76 | { | 78 | { |
77 | static int pending_newline = 0; /* did last write end with unprinted newline? */ | 79 | static int pending_newline = 0; /* did last write end with unprinted newline? */ |
78 | static int width = 16; | 80 | static int width = 16; |
@@ -96,6 +98,11 @@ void call_rtas_display_status_delay(unsigned char c) | |||
96 | } | 98 | } |
97 | } | 99 | } |
98 | 100 | ||
101 | void __init udbg_init_rtas(void) | ||
102 | { | ||
103 | udbg_putc = call_rtas_display_status_delay; | ||
104 | } | ||
105 | |||
99 | void rtas_progress(char *s, unsigned short hex) | 106 | void rtas_progress(char *s, unsigned short hex) |
100 | { | 107 | { |
101 | struct device_node *root; | 108 | struct device_node *root; |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index c4b76961d6de..e29b275e09e0 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/unistd.h> | 33 | #include <linux/unistd.h> |
34 | #include <linux/serial.h> | 34 | #include <linux/serial.h> |
35 | #include <linux/serial_8250.h> | 35 | #include <linux/serial_8250.h> |
36 | #include <linux/bootmem.h> | ||
36 | #include <asm/io.h> | 37 | #include <asm/io.h> |
37 | #include <asm/kdump.h> | 38 | #include <asm/kdump.h> |
38 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
@@ -70,33 +71,6 @@ | |||
70 | #define DBG(fmt...) | 71 | #define DBG(fmt...) |
71 | #endif | 72 | #endif |
72 | 73 | ||
73 | /* | ||
74 | * Here are some early debugging facilities. You can enable one | ||
75 | * but your kernel will not boot on anything else if you do so | ||
76 | */ | ||
77 | |||
78 | /* This one is for use on LPAR machines that support an HVC console | ||
79 | * on vterm 0 | ||
80 | */ | ||
81 | extern void udbg_init_debug_lpar(void); | ||
82 | /* This one is for use on Apple G5 machines | ||
83 | */ | ||
84 | extern void udbg_init_pmac_realmode(void); | ||
85 | /* That's RTAS panel debug */ | ||
86 | extern void call_rtas_display_status_delay(unsigned char c); | ||
87 | /* Here's maple real mode debug */ | ||
88 | extern void udbg_init_maple_realmode(void); | ||
89 | |||
90 | #define EARLY_DEBUG_INIT() do {} while(0) | ||
91 | |||
92 | #if 0 | ||
93 | #define EARLY_DEBUG_INIT() udbg_init_debug_lpar() | ||
94 | #define EARLY_DEBUG_INIT() udbg_init_maple_realmode() | ||
95 | #define EARLY_DEBUG_INIT() udbg_init_pmac_realmode() | ||
96 | #define EARLY_DEBUG_INIT() \ | ||
97 | do { udbg_putc = call_rtas_display_status_delay; } while(0) | ||
98 | #endif | ||
99 | |||
100 | int have_of = 1; | 74 | int have_of = 1; |
101 | int boot_cpuid = 0; | 75 | int boot_cpuid = 0; |
102 | int boot_cpuid_phys = 0; | 76 | int boot_cpuid_phys = 0; |
@@ -237,11 +211,8 @@ void __init early_setup(unsigned long dt_ptr) | |||
237 | struct paca_struct *lpaca = get_paca(); | 211 | struct paca_struct *lpaca = get_paca(); |
238 | static struct machdep_calls **mach; | 212 | static struct machdep_calls **mach; |
239 | 213 | ||
240 | /* | 214 | /* Enable early debugging if any specified (see udbg.h) */ |
241 | * Enable early debugging if any specified (see top of | 215 | udbg_early_init(); |
242 | * this file) | ||
243 | */ | ||
244 | EARLY_DEBUG_INIT(); | ||
245 | 216 | ||
246 | DBG(" -> early_setup()\n"); | 217 | DBG(" -> early_setup()\n"); |
247 | 218 | ||
@@ -684,3 +655,28 @@ void cpu_die(void) | |||
684 | if (ppc_md.cpu_die) | 655 | if (ppc_md.cpu_die) |
685 | ppc_md.cpu_die(); | 656 | ppc_md.cpu_die(); |
686 | } | 657 | } |
658 | |||
659 | #ifdef CONFIG_SMP | ||
660 | void __init setup_per_cpu_areas(void) | ||
661 | { | ||
662 | int i; | ||
663 | unsigned long size; | ||
664 | char *ptr; | ||
665 | |||
666 | /* Copy section for each CPU (we discard the original) */ | ||
667 | size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); | ||
668 | #ifdef CONFIG_MODULES | ||
669 | if (size < PERCPU_ENOUGH_ROOM) | ||
670 | size = PERCPU_ENOUGH_ROOM; | ||
671 | #endif | ||
672 | |||
673 | for_each_cpu(i) { | ||
674 | ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size); | ||
675 | if (!ptr) | ||
676 | panic("Cannot allocate cpu data for CPU %d\n", i); | ||
677 | |||
678 | paca[i].data_offset = ptr - __per_cpu_start; | ||
679 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | ||
680 | } | ||
681 | } | ||
682 | #endif | ||
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c index 558c1ceb2b93..3774e80094f5 100644 --- a/arch/powerpc/kernel/udbg.c +++ b/arch/powerpc/kernel/udbg.c | |||
@@ -15,11 +15,36 @@ | |||
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/console.h> | 16 | #include <linux/console.h> |
17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
18 | #include <asm/udbg.h> | ||
18 | 19 | ||
19 | void (*udbg_putc)(char c); | 20 | void (*udbg_putc)(char c); |
20 | int (*udbg_getc)(void); | 21 | int (*udbg_getc)(void); |
21 | int (*udbg_getc_poll)(void); | 22 | int (*udbg_getc_poll)(void); |
22 | 23 | ||
24 | /* | ||
25 | * Early debugging facilities. You can enable _one_ of these via .config, | ||
26 | * if you do so your kernel _will not boot_ on anything else. Be careful. | ||
27 | */ | ||
28 | void __init udbg_early_init(void) | ||
29 | { | ||
30 | #if defined(CONFIG_PPC_EARLY_DEBUG_LPAR) | ||
31 | /* For LPAR machines that have an HVC console on vterm 0 */ | ||
32 | udbg_init_debug_lpar(); | ||
33 | #elif defined(CONFIG_PPC_EARLY_DEBUG_G5) | ||
34 | /* For use on Apple G5 machines */ | ||
35 | udbg_init_pmac_realmode(); | ||
36 | #elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS) | ||
37 | /* RTAS panel debug */ | ||
38 | udbg_init_rtas(); | ||
39 | #elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) | ||
40 | /* Maple real mode debug */ | ||
41 | udbg_init_maple_realmode(); | ||
42 | #elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES) | ||
43 | /* For iSeries - hit Ctrl-x Ctrl-x to see the output */ | ||
44 | udbg_init_iseries(); | ||
45 | #endif | ||
46 | } | ||
47 | |||
23 | /* udbg library, used by xmon et al */ | 48 | /* udbg library, used by xmon et al */ |
24 | void udbg_puts(const char *s) | 49 | void udbg_puts(const char *s) |
25 | { | 50 | { |
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c index 7541bf44d2da..2da65a9c93f6 100644 --- a/arch/powerpc/kernel/udbg_16550.c +++ b/arch/powerpc/kernel/udbg_16550.c | |||
@@ -155,7 +155,7 @@ void udbg_maple_real_putc(unsigned char c) | |||
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | void udbg_init_maple_realmode(void) | 158 | void __init udbg_init_maple_realmode(void) |
159 | { | 159 | { |
160 | udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8; | 160 | udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8; |
161 | 161 | ||
diff --git a/arch/powerpc/kernel/vdso32/.gitignore b/arch/powerpc/kernel/vdso32/.gitignore new file mode 100644 index 000000000000..e45fba9d0ced --- /dev/null +++ b/arch/powerpc/kernel/vdso32/.gitignore | |||
@@ -0,0 +1 @@ | |||
vdso32.lds | |||
diff --git a/arch/powerpc/kernel/vdso64/.gitignore b/arch/powerpc/kernel/vdso64/.gitignore new file mode 100644 index 000000000000..3fd18cf9fec2 --- /dev/null +++ b/arch/powerpc/kernel/vdso64/.gitignore | |||
@@ -0,0 +1 @@ | |||
vdso64.lds | |||
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig new file mode 100644 index 000000000000..b20812d460e6 --- /dev/null +++ b/arch/powerpc/platforms/83xx/Kconfig | |||
@@ -0,0 +1,26 @@ | |||
1 | menu "Platform support" | ||
2 | depends on PPC_83xx | ||
3 | |||
4 | choice | ||
5 | prompt "Machine Type" | ||
6 | default MPC834x_SYS | ||
7 | |||
8 | config MPC834x_SYS | ||
9 | bool "Freescale MPC834x SYS" | ||
10 | help | ||
11 | This option enables support for the MPC 834x SYS evaluation board. | ||
12 | |||
13 | Be aware that PCI buses can only function when SYS board is plugged | ||
14 | into the PIB (Platform IO Board) board from Freescale which provide | ||
15 | 3 PCI slots. The PIBs PCI initialization is the bootloader's | ||
16 | responsiblilty. | ||
17 | |||
18 | endchoice | ||
19 | |||
20 | config MPC834x | ||
21 | bool | ||
22 | select PPC_UDBG_16550 | ||
23 | select PPC_INDIRECT_PCI | ||
24 | default y if MPC834x_SYS | ||
25 | |||
26 | endmenu | ||
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile new file mode 100644 index 000000000000..9d8b28ef3343 --- /dev/null +++ b/arch/powerpc/platforms/83xx/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | # | ||
2 | # Makefile for the PowerPC 83xx linux kernel. | ||
3 | # | ||
4 | obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o pci.o | ||
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile index 8836b3a00668..04073fd987ec 100644 --- a/arch/powerpc/platforms/Makefile +++ b/arch/powerpc/platforms/Makefile | |||
@@ -7,6 +7,7 @@ endif | |||
7 | endif | 7 | endif |
8 | obj-$(CONFIG_PPC_CHRP) += chrp/ | 8 | obj-$(CONFIG_PPC_CHRP) += chrp/ |
9 | obj-$(CONFIG_4xx) += 4xx/ | 9 | obj-$(CONFIG_4xx) += 4xx/ |
10 | obj-$(CONFIG_PPC_83xx) += 83xx/ | ||
10 | obj-$(CONFIG_85xx) += 85xx/ | 11 | obj-$(CONFIG_85xx) += 85xx/ |
11 | obj-$(CONFIG_PPC_PSERIES) += pseries/ | 12 | obj-$(CONFIG_PPC_PSERIES) += pseries/ |
12 | obj-$(CONFIG_PPC_ISERIES) += iseries/ | 13 | obj-$(CONFIG_PPC_ISERIES) += iseries/ |
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c index 1061c12b2edb..212db28531fa 100644 --- a/arch/powerpc/platforms/cell/spufs/switch.c +++ b/arch/powerpc/platforms/cell/spufs/switch.c | |||
@@ -169,11 +169,33 @@ static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu) | |||
169 | struct spu_priv2 __iomem *priv2 = spu->priv2; | 169 | struct spu_priv2 __iomem *priv2 = spu->priv2; |
170 | 170 | ||
171 | /* Save, Step 8: | 171 | /* Save, Step 8: |
172 | * Read and save MFC_CNTL[Ss]. | 172 | * Suspend DMA and save MFC_CNTL. |
173 | */ | 173 | */ |
174 | if (csa) { | 174 | switch (in_be64(&priv2->mfc_control_RW) & |
175 | csa->priv2.mfc_control_RW = in_be64(&priv2->mfc_control_RW) & | 175 | MFC_CNTL_SUSPEND_DMA_STATUS_MASK) { |
176 | MFC_CNTL_SUSPEND_DMA_STATUS_MASK; | 176 | case MFC_CNTL_SUSPEND_IN_PROGRESS: |
177 | POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) & | ||
178 | MFC_CNTL_SUSPEND_DMA_STATUS_MASK) == | ||
179 | MFC_CNTL_SUSPEND_COMPLETE); | ||
180 | /* fall through */ | ||
181 | case MFC_CNTL_SUSPEND_COMPLETE: | ||
182 | if (csa) { | ||
183 | csa->priv2.mfc_control_RW = | ||
184 | in_be64(&priv2->mfc_control_RW) | | ||
185 | MFC_CNTL_SUSPEND_DMA_QUEUE; | ||
186 | } | ||
187 | break; | ||
188 | case MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION: | ||
189 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_SUSPEND_DMA_QUEUE); | ||
190 | POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) & | ||
191 | MFC_CNTL_SUSPEND_DMA_STATUS_MASK) == | ||
192 | MFC_CNTL_SUSPEND_COMPLETE); | ||
193 | if (csa) { | ||
194 | csa->priv2.mfc_control_RW = | ||
195 | in_be64(&priv2->mfc_control_RW) & | ||
196 | ~MFC_CNTL_SUSPEND_DMA_QUEUE; | ||
197 | } | ||
198 | break; | ||
177 | } | 199 | } |
178 | } | 200 | } |
179 | 201 | ||
@@ -237,6 +259,8 @@ static inline void save_mfc_decr(struct spu_state *csa, struct spu *spu) | |||
237 | eieio(); | 259 | eieio(); |
238 | csa->spu_chnldata_RW[7] = in_be64(&priv2->spu_chnldata_RW); | 260 | csa->spu_chnldata_RW[7] = in_be64(&priv2->spu_chnldata_RW); |
239 | eieio(); | 261 | eieio(); |
262 | } else { | ||
263 | csa->priv2.mfc_control_RW &= ~MFC_CNTL_DECREMENTER_RUNNING; | ||
240 | } | 264 | } |
241 | } | 265 | } |
242 | 266 | ||
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index 81250090f98d..4fdbc9ae876b 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig | |||
@@ -144,16 +144,6 @@ config LITE5200 | |||
144 | much but it's only been tested on this board version. I think this | 144 | much but it's only been tested on this board version. I think this |
145 | board is also known as IceCube. | 145 | board is also known as IceCube. |
146 | 146 | ||
147 | config MPC834x_SYS | ||
148 | bool "Freescale MPC834x SYS" | ||
149 | help | ||
150 | This option enables support for the MPC 834x SYS evaluation board. | ||
151 | |||
152 | Be aware that PCI buses can only function when SYS board is plugged | ||
153 | into the PIB (Platform IO Board) board from Freescale which provide | ||
154 | 3 PCI slots. The PIBs PCI initialization is the bootloader's | ||
155 | responsiblilty. | ||
156 | |||
157 | config EV64360 | 147 | config EV64360 |
158 | bool "Marvell-EV64360BP" | 148 | bool "Marvell-EV64360BP" |
159 | help | 149 | help |
@@ -192,14 +182,6 @@ config 8272 | |||
192 | The MPC8272 CPM has a different internal dpram setup than other CPM2 | 182 | The MPC8272 CPM has a different internal dpram setup than other CPM2 |
193 | devices | 183 | devices |
194 | 184 | ||
195 | config 83xx | ||
196 | bool | ||
197 | default y if MPC834x_SYS | ||
198 | |||
199 | config MPC834x | ||
200 | bool | ||
201 | default y if MPC834x_SYS | ||
202 | |||
203 | config CPM2 | 185 | config CPM2 |
204 | bool | 186 | bool |
205 | depends on 8260 || MPC8560 || MPC8555 | 187 | depends on 8260 || MPC8560 || MPC8555 |
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index ad5ef80500ce..c6bbe5c25107 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <asm/iseries/mf.h> | 52 | #include <asm/iseries/mf.h> |
53 | #include <asm/iseries/hv_lp_event.h> | 53 | #include <asm/iseries/hv_lp_event.h> |
54 | #include <asm/iseries/lpar_map.h> | 54 | #include <asm/iseries/lpar_map.h> |
55 | #include <asm/udbg.h> | ||
55 | 56 | ||
56 | #include "naca.h" | 57 | #include "naca.h" |
57 | #include "setup.h" | 58 | #include "setup.h" |
@@ -62,10 +63,8 @@ | |||
62 | #include "call_sm.h" | 63 | #include "call_sm.h" |
63 | #include "call_hpt.h" | 64 | #include "call_hpt.h" |
64 | 65 | ||
65 | extern void hvlog(char *fmt, ...); | ||
66 | |||
67 | #ifdef DEBUG | 66 | #ifdef DEBUG |
68 | #define DBG(fmt...) hvlog(fmt) | 67 | #define DBG(fmt...) udbg_printf(fmt) |
69 | #else | 68 | #else |
70 | #define DBG(fmt...) | 69 | #define DBG(fmt...) |
71 | #endif | 70 | #endif |
@@ -474,14 +473,6 @@ static unsigned long __init build_iSeries_Memory_Map(void) | |||
474 | printk("HPT absolute addr = %016lx, size = %dK\n", | 473 | printk("HPT absolute addr = %016lx, size = %dK\n", |
475 | chunk_to_addr(hptFirstChunk), hptSizeChunks * 256); | 474 | chunk_to_addr(hptFirstChunk), hptSizeChunks * 256); |
476 | 475 | ||
477 | ppc64_pft_size = __ilog2(hptSizePages * HW_PAGE_SIZE); | ||
478 | |||
479 | /* | ||
480 | * The actual hashed page table is in the hypervisor, | ||
481 | * we have no direct access | ||
482 | */ | ||
483 | htab_address = NULL; | ||
484 | |||
485 | /* | 476 | /* |
486 | * Determine if absolute memory has any | 477 | * Determine if absolute memory has any |
487 | * holes so that we can interpret the | 478 | * holes so that we can interpret the |
@@ -861,6 +852,11 @@ void dt_prop_u64_list(struct iseries_flat_dt *dt, char *name, u64 *data, int n) | |||
861 | dt_prop(dt, name, (char *)data, sizeof(u64) * n); | 852 | dt_prop(dt, name, (char *)data, sizeof(u64) * n); |
862 | } | 853 | } |
863 | 854 | ||
855 | void dt_prop_u32_list(struct iseries_flat_dt *dt, char *name, u32 *data, int n) | ||
856 | { | ||
857 | dt_prop(dt, name, (char *)data, sizeof(u32) * n); | ||
858 | } | ||
859 | |||
864 | void dt_prop_empty(struct iseries_flat_dt *dt, char *name) | 860 | void dt_prop_empty(struct iseries_flat_dt *dt, char *name) |
865 | { | 861 | { |
866 | dt_prop(dt, name, NULL, 0); | 862 | dt_prop(dt, name, NULL, 0); |
@@ -872,6 +868,7 @@ void dt_cpus(struct iseries_flat_dt *dt) | |||
872 | unsigned char *p; | 868 | unsigned char *p; |
873 | unsigned int i, index; | 869 | unsigned int i, index; |
874 | struct IoHriProcessorVpd *d; | 870 | struct IoHriProcessorVpd *d; |
871 | u32 pft_size[2]; | ||
875 | 872 | ||
876 | /* yuck */ | 873 | /* yuck */ |
877 | snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name); | 874 | snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name); |
@@ -882,6 +879,9 @@ void dt_cpus(struct iseries_flat_dt *dt) | |||
882 | dt_prop_u32(dt, "#address-cells", 1); | 879 | dt_prop_u32(dt, "#address-cells", 1); |
883 | dt_prop_u32(dt, "#size-cells", 0); | 880 | dt_prop_u32(dt, "#size-cells", 0); |
884 | 881 | ||
882 | pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */ | ||
883 | pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE); | ||
884 | |||
885 | for (i = 0; i < NR_CPUS; i++) { | 885 | for (i = 0; i < NR_CPUS; i++) { |
886 | if (paca[i].lppaca.dyn_proc_status >= 2) | 886 | if (paca[i].lppaca.dyn_proc_status >= 2) |
887 | continue; | 887 | continue; |
@@ -908,6 +908,8 @@ void dt_cpus(struct iseries_flat_dt *dt) | |||
908 | 908 | ||
909 | dt_prop_u32(dt, "reg", i); | 909 | dt_prop_u32(dt, "reg", i); |
910 | 910 | ||
911 | dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2); | ||
912 | |||
911 | dt_end_node(dt); | 913 | dt_end_node(dt); |
912 | } | 914 | } |
913 | 915 | ||
@@ -984,3 +986,16 @@ static int __init early_parsemem(char *p) | |||
984 | return 0; | 986 | return 0; |
985 | } | 987 | } |
986 | early_param("mem", early_parsemem); | 988 | early_param("mem", early_parsemem); |
989 | |||
990 | static void hvputc(char c) | ||
991 | { | ||
992 | if (c == '\n') | ||
993 | hvputc('\r'); | ||
994 | |||
995 | HvCall_writeLogBuffer(&c, 1); | ||
996 | } | ||
997 | |||
998 | void __init udbg_init_iseries(void) | ||
999 | { | ||
1000 | udbg_putc = hvputc; | ||
1001 | } | ||
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c index e87d53acfb61..c4352a8db644 100644 --- a/arch/powerpc/platforms/powermac/udbg_scc.c +++ b/arch/powerpc/platforms/powermac/udbg_scc.c | |||
@@ -153,7 +153,7 @@ static void udbg_real_scc_putc(char c) | |||
153 | udbg_real_scc_putc('\r'); | 153 | udbg_real_scc_putc('\r'); |
154 | } | 154 | } |
155 | 155 | ||
156 | void udbg_init_pmac_realmode(void) | 156 | void __init udbg_init_pmac_realmode(void) |
157 | { | 157 | { |
158 | sccc = (volatile u8 __iomem *)0x80013020ul; | 158 | sccc = (volatile u8 __iomem *)0x80013020ul; |
159 | sccd = (volatile u8 __iomem *)0x80013030ul; | 159 | sccd = (volatile u8 __iomem *)0x80013030ul; |
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 14b9abde2d27..0ae841347a09 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile | |||
@@ -6,4 +6,4 @@ obj-$(CONFIG_BOOKE) += dcr.o | |||
6 | obj-$(CONFIG_40x) += dcr.o | 6 | obj-$(CONFIG_40x) += dcr.o |
7 | obj-$(CONFIG_U3_DART) += dart_iommu.o | 7 | obj-$(CONFIG_U3_DART) += dart_iommu.o |
8 | obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o | 8 | obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o |
9 | obj-$(CONFIG_83xx) += ipic.o | 9 | obj-$(CONFIG_PPC_83xx) += ipic.o |
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c index 84d96b857e4a..ebc4db8fcc63 100644 --- a/arch/ppc/4xx_io/serial_sicc.c +++ b/arch/ppc/4xx_io/serial_sicc.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/mm.h> | 47 | #include <linux/mm.h> |
48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/capability.h> | ||
50 | #include <linux/circ_buf.h> | 51 | #include <linux/circ_buf.h> |
51 | #include <linux/serial.h> | 52 | #include <linux/serial.h> |
52 | #include <linux/console.h> | 53 | #include <linux/console.h> |
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index e396f4591d59..d65810108bc3 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -743,6 +743,10 @@ config MPC834x | |||
743 | bool | 743 | bool |
744 | default y if MPC834x_SYS | 744 | default y if MPC834x_SYS |
745 | 745 | ||
746 | config PPC_83xx | ||
747 | bool | ||
748 | default y if 83xx | ||
749 | |||
746 | config CPM1 | 750 | config CPM1 |
747 | bool | 751 | bool |
748 | depends on 8xx | 752 | depends on 8xx |
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c index ca810025993f..2f5c7650274f 100644 --- a/arch/ppc/kernel/ppc_htab.c +++ b/arch/ppc/kernel/ppc_htab.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/proc_fs.h> | 16 | #include <linux/proc_fs.h> |
17 | #include <linux/stat.h> | 17 | #include <linux/stat.h> |
18 | #include <linux/sysctl.h> | 18 | #include <linux/sysctl.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
20 | #include <linux/threads.h> | 21 | #include <linux/threads.h> |
21 | #include <linux/smp_lock.h> | 22 | #include <linux/smp_lock.h> |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index cd3b3c3e7a9f..bf9a7a361b34 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/syscalls.h> | 55 | #include <linux/syscalls.h> |
56 | #include <linux/sysctl.h> | 56 | #include <linux/sysctl.h> |
57 | #include <linux/binfmts.h> | 57 | #include <linux/binfmts.h> |
58 | #include <linux/capability.h> | ||
58 | #include <linux/compat.h> | 59 | #include <linux/compat.h> |
59 | #include <linux/vfs.h> | 60 | #include <linux/vfs.h> |
60 | #include <linux/ptrace.h> | 61 | #include <linux/ptrace.h> |
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index d07ae02101ad..288de276d9ff 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/stat.h> | 30 | #include <linux/stat.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/pagemap.h> | 32 | #include <linux/pagemap.h> |
33 | #include <linux/capability.h> | ||
33 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
34 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
35 | #include <linux/smp_lock.h> | 36 | #include <linux/smp_lock.h> |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index b775ceb4cf98..ab733be9af08 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -179,7 +179,7 @@ config HUGETLB_PAGE_SIZE_512K | |||
179 | bool "512K" | 179 | bool "512K" |
180 | 180 | ||
181 | config HUGETLB_PAGE_SIZE_64K | 181 | config HUGETLB_PAGE_SIZE_64K |
182 | depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512K | 182 | depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB |
183 | bool "64K" | 183 | bool "64K" |
184 | 184 | ||
185 | endchoice | 185 | endchoice |
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index ff5e9d5cad50..b9a9ce70e55c 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -135,6 +135,14 @@ static int __kprobes kprobe_handler(struct pt_regs *regs) | |||
135 | prepare_singlestep(p, regs, kcb); | 135 | prepare_singlestep(p, regs, kcb); |
136 | return 1; | 136 | return 1; |
137 | } else { | 137 | } else { |
138 | if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) { | ||
139 | /* The breakpoint instruction was removed by | ||
140 | * another cpu right after we hit, no further | ||
141 | * handling of this interrupt is appropriate | ||
142 | */ | ||
143 | ret = 1; | ||
144 | goto no_kprobe; | ||
145 | } | ||
138 | p = __get_cpu_var(current_kprobe); | 146 | p = __get_cpu_var(current_kprobe); |
139 | if (p->break_handler && p->break_handler(p, regs)) | 147 | if (p->break_handler && p->break_handler(p, regs)) |
140 | goto ss_probe; | 148 | goto ss_probe; |
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index de342ee3116b..d4b7a100cb8a 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
15 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
16 | #include <linux/file.h> | 17 | #include <linux/file.h> |
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index bfa4aa68312d..ae5b32f817f0 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/capability.h> | ||
15 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
16 | #include <linux/mman.h> | 17 | #include <linux/mman.h> |
17 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c index d7c99fa89661..4885ca6cbc77 100644 --- a/arch/sparc64/solaris/fs.c +++ b/arch/sparc64/solaris/fs.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/capability.h> | ||
13 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
14 | #include <linux/namei.h> | 15 | #include <linux/namei.h> |
15 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index b4ff2e576021..8ff3bcbce5fc 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -35,12 +35,12 @@ menu "UML-specific options" | |||
35 | 35 | ||
36 | config MODE_TT | 36 | config MODE_TT |
37 | bool "Tracing thread support" | 37 | bool "Tracing thread support" |
38 | default y | 38 | default n |
39 | help | 39 | help |
40 | This option controls whether tracing thread support is compiled | 40 | This option controls whether tracing thread support is compiled |
41 | into UML. Normally, this should be set to Y. If you intend to | 41 | into UML. This option is largely obsolete, given that skas0 provides |
42 | use only skas mode (and the host has the skas patch applied to it), | 42 | skas security and performance without needing to patch the host. |
43 | then it is OK to say N here. | 43 | It is safe to say 'N' here. |
44 | 44 | ||
45 | config STATIC_LINK | 45 | config STATIC_LINK |
46 | bool "Force a static link" | 46 | bool "Force a static link" |
diff --git a/arch/um/Makefile b/arch/um/Makefile index 1b12feeba368..322972fd064e 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -189,6 +189,12 @@ define filechk_umlconfig | |||
189 | sed 's/ CONFIG/ UML_CONFIG/' | 189 | sed 's/ CONFIG/ UML_CONFIG/' |
190 | endef | 190 | endef |
191 | 191 | ||
192 | $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h | ||
193 | $(call filechk,umlconfig) | ||
194 | |||
195 | $(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c | ||
196 | $(CC) $(USER_CFLAGS) -S -o $@ $< | ||
197 | |||
192 | define filechk_gen-asm-offsets | 198 | define filechk_gen-asm-offsets |
193 | (set -e; \ | 199 | (set -e; \ |
194 | echo "/*"; \ | 200 | echo "/*"; \ |
@@ -202,24 +208,13 @@ define filechk_gen-asm-offsets | |||
202 | echo ""; ) | 208 | echo ""; ) |
203 | endef | 209 | endef |
204 | 210 | ||
205 | $(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h | ||
206 | $(call filechk,umlconfig) | ||
207 | |||
208 | $(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c | ||
209 | $(CC) $(USER_CFLAGS) -S -o $@ $< | ||
210 | |||
211 | $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s | 211 | $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s |
212 | $(call filechk,gen-asm-offsets) | 212 | $(call filechk,gen-asm-offsets) |
213 | 213 | ||
214 | CLEAN_FILES += $(ARCH_DIR)/user-offsets.s | 214 | CLEAN_FILES += $(ARCH_DIR)/user-offsets.s |
215 | 215 | ||
216 | $(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \ | 216 | $(ARCH_DIR)/include/kern_constants.h: |
217 | archprepare | 217 | @echo ' SYMLINK $@' |
218 | $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $< | 218 | $(Q) ln -sf ../../../include/asm-um/asm-offsets.h $@ |
219 | |||
220 | $(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/kernel-offsets.s | ||
221 | $(call filechk,gen-asm-offsets) | ||
222 | |||
223 | CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s | ||
224 | 219 | ||
225 | export SUBARCH USER_CFLAGS OS | 220 | export SUBARCH USER_CFLAGS OS |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index be610125429f..e3d576567172 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -500,7 +500,7 @@ static void console_write(struct console *console, const char *string, | |||
500 | 500 | ||
501 | static struct console mc_console = { .name = "mc", | 501 | static struct console mc_console = { .name = "mc", |
502 | .write = console_write, | 502 | .write = console_write, |
503 | .flags = CON_PRINTBUFFER | CON_ENABLED, | 503 | .flags = CON_ENABLED, |
504 | .index = -1 }; | 504 | .index = -1 }; |
505 | 505 | ||
506 | static int mc_add_console(void) | 506 | static int mc_add_console(void) |
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 3a93c6f772fa..7696f8d2d89c 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -1073,7 +1073,6 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
1073 | static int ubd_ioctl(struct inode * inode, struct file * file, | 1073 | static int ubd_ioctl(struct inode * inode, struct file * file, |
1074 | unsigned int cmd, unsigned long arg) | 1074 | unsigned int cmd, unsigned long arg) |
1075 | { | 1075 | { |
1076 | struct hd_geometry __user *loc = (struct hd_geometry __user *) arg; | ||
1077 | struct ubd *dev = inode->i_bdev->bd_disk->private_data; | 1076 | struct ubd *dev = inode->i_bdev->bd_disk->private_data; |
1078 | struct hd_driveid ubd_id = { | 1077 | struct hd_driveid ubd_id = { |
1079 | .cyls = 0, | 1078 | .cyls = 0, |
diff --git a/arch/um/sys-i386/kernel-offsets.c b/arch/um/include/sysdep-i386/kernel-offsets.h index 35db85057506..82f96c574144 100644 --- a/arch/um/sys-i386/kernel-offsets.c +++ b/arch/um/include/sysdep-i386/kernel-offsets.h | |||
@@ -1,12 +1,9 @@ | |||
1 | #include <linux/config.h> | ||
2 | #include <linux/stddef.h> | 1 | #include <linux/stddef.h> |
3 | #include <linux/sched.h> | 2 | #include <linux/sched.h> |
4 | #include <linux/time.h> | ||
5 | #include <linux/elf.h> | 3 | #include <linux/elf.h> |
6 | #include <asm/page.h> | ||
7 | 4 | ||
8 | #define DEFINE(sym, val) \ | 5 | #define DEFINE(sym, val) \ |
9 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 6 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
10 | 7 | ||
11 | #define STR(x) #x | 8 | #define STR(x) #x |
12 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) | 9 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) |
diff --git a/arch/um/sys-x86_64/kernel-offsets.c b/arch/um/include/sysdep-x86_64/kernel-offsets.h index bfcb104b846e..5ce93abd0b54 100644 --- a/arch/um/sys-x86_64/kernel-offsets.c +++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <asm/page.h> | 6 | #include <asm/page.h> |
7 | 7 | ||
8 | #define DEFINE(sym, val) \ | 8 | #define DEFINE(sym, val) \ |
9 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 9 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
10 | 10 | ||
11 | #define DEFINE_STR1(x) #x | 11 | #define DEFINE_STR1(x) #x |
12 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : ) | 12 | #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : ) |
diff --git a/arch/um/kernel/asm-offsets.c b/arch/um/kernel/asm-offsets.c index c13a64a288f6..91ea538e1612 100644 --- a/arch/um/kernel/asm-offsets.c +++ b/arch/um/kernel/asm-offsets.c | |||
@@ -1 +1 @@ | |||
/* Dummy file to make kbuild happy - unused! */ | #include "sysdep/kernel-offsets.h" | ||
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index 9264d4021dfe..3b3955d84407 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -68,7 +68,7 @@ void wait_stub_done(int pid, int sig, char * fname) | |||
68 | 68 | ||
69 | if((n < 0) || !WIFSTOPPED(status) || | 69 | if((n < 0) || !WIFSTOPPED(status) || |
70 | (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ | 70 | (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ |
71 | unsigned long regs[FRAME_SIZE]; | 71 | unsigned long regs[HOST_FRAME_SIZE]; |
72 | if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) | 72 | if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) |
73 | printk("Failed to get registers from stub, " | 73 | printk("Failed to get registers from stub, " |
74 | "errno = %d\n", errno); | 74 | "errno = %d\n", errno); |
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, char * fname) | |||
76 | int i; | 76 | int i; |
77 | 77 | ||
78 | printk("Stub registers -\n"); | 78 | printk("Stub registers -\n"); |
79 | for(i = 0; i < FRAME_SIZE; i++) | 79 | for(i = 0; i < HOST_FRAME_SIZE; i++) |
80 | printk("\t%d - %lx\n", i, regs[i]); | 80 | printk("\t%d - %lx\n", i, regs[i]); |
81 | } | 81 | } |
82 | panic("%s : failed to wait for SIGUSR1/SIGTRAP, " | 82 | panic("%s : failed to wait for SIGUSR1/SIGTRAP, " |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 73747ac19774..e2d3ca445ef5 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -243,10 +243,6 @@ static int __init mode_tt_setup(char *line, int *add) | |||
243 | return(0); | 243 | return(0); |
244 | } | 244 | } |
245 | 245 | ||
246 | #else | ||
247 | |||
248 | #error Either CONFIG_MODE_TT or CONFIG_MODE_SKAS must be enabled | ||
249 | |||
250 | #endif | 246 | #endif |
251 | #endif | 247 | #endif |
252 | #endif | 248 | #endif |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 348b4a0d0d6f..2efc4be22709 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -69,12 +69,34 @@ config ARCH_MAY_HAVE_PC_FDC | |||
69 | bool | 69 | bool |
70 | default y | 70 | default y |
71 | 71 | ||
72 | config DMI | ||
73 | bool | ||
74 | default y | ||
75 | |||
72 | source "init/Kconfig" | 76 | source "init/Kconfig" |
73 | 77 | ||
74 | 78 | ||
75 | menu "Processor type and features" | 79 | menu "Processor type and features" |
76 | 80 | ||
77 | choice | 81 | choice |
82 | prompt "Subarchitecture Type" | ||
83 | default X86_PC | ||
84 | |||
85 | config X86_PC | ||
86 | bool "PC-compatible" | ||
87 | help | ||
88 | Choose this option if your computer is a standard PC or compatible. | ||
89 | |||
90 | config X86_VSMP | ||
91 | bool "Support for ScaleMP vSMP" | ||
92 | help | ||
93 | Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is | ||
94 | supposed to run on these EM64T-based machines. Only choose this option | ||
95 | if you have one of these machines. | ||
96 | |||
97 | endchoice | ||
98 | |||
99 | choice | ||
78 | prompt "Processor family" | 100 | prompt "Processor family" |
79 | default MK8 | 101 | default MK8 |
80 | 102 | ||
@@ -347,32 +369,24 @@ config HPET_EMULATE_RTC | |||
347 | depends on HPET_TIMER && RTC=y | 369 | depends on HPET_TIMER && RTC=y |
348 | 370 | ||
349 | config GART_IOMMU | 371 | config GART_IOMMU |
350 | bool "IOMMU support" | 372 | bool "K8 GART IOMMU support" |
351 | default y | 373 | default y |
374 | select SWIOTLB | ||
352 | depends on PCI | 375 | depends on PCI |
353 | help | 376 | help |
354 | Support the IOMMU. Needed to run systems with more than 3GB of memory | 377 | Support the IOMMU. Needed to run systems with more than 3GB of memory |
355 | properly with 32-bit PCI devices that do not support DAC (Double Address | 378 | properly with 32-bit PCI devices that do not support DAC (Double Address |
356 | Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. | 379 | Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. |
357 | Normally the kernel will take the right choice by itself. | 380 | Normally the kernel will take the right choice by itself. |
358 | This option includes a driver for the AMD Opteron/Athlon64 IOMMU | 381 | This option includes a driver for the AMD Opteron/Athlon64 northbridge IOMMU |
359 | and a software emulation used on some other systems. | 382 | and a software emulation used on other systems. |
360 | If unsure, say Y. | 383 | If unsure, say Y. |
361 | 384 | ||
362 | # need this always enabled with GART_IOMMU for the VIA workaround | 385 | # need this always enabled with GART_IOMMU for the VIA workaround |
363 | config SWIOTLB | 386 | config SWIOTLB |
364 | bool | ||
365 | depends on GART_IOMMU | ||
366 | default y | ||
367 | |||
368 | config DUMMY_IOMMU | ||
369 | bool | 387 | bool |
370 | depends on !GART_IOMMU && !SWIOTLB | ||
371 | default y | 388 | default y |
372 | help | 389 | depends on GART_IOMMU |
373 | Don't use IOMMU code. This will cause problems when you have more than 4GB | ||
374 | of memory and any 32-bit devices. Don't turn on unless you know what you | ||
375 | are doing. | ||
376 | 390 | ||
377 | config X86_MCE | 391 | config X86_MCE |
378 | bool "Machine check support" if EMBEDDED | 392 | bool "Machine check support" if EMBEDDED |
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 51d83288d62b..d7fd46479c55 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile | |||
@@ -31,6 +31,7 @@ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) | |||
31 | cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) | 31 | cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) |
32 | CFLAGS += $(cflags-y) | 32 | CFLAGS += $(cflags-y) |
33 | 33 | ||
34 | CFLAGS += -m64 | ||
34 | CFLAGS += -mno-red-zone | 35 | CFLAGS += -mno-red-zone |
35 | CFLAGS += -mcmodel=kernel | 36 | CFLAGS += -mcmodel=kernel |
36 | CFLAGS += -pipe | 37 | CFLAGS += -pipe |
@@ -38,8 +39,10 @@ CFLAGS += -pipe | |||
38 | # actually it makes the kernel smaller too. | 39 | # actually it makes the kernel smaller too. |
39 | CFLAGS += -fno-reorder-blocks | 40 | CFLAGS += -fno-reorder-blocks |
40 | CFLAGS += -Wno-sign-compare | 41 | CFLAGS += -Wno-sign-compare |
41 | ifneq ($(CONFIG_DEBUG_INFO),y) | 42 | ifneq ($(CONFIG_UNWIND_INFO),y) |
42 | CFLAGS += -fno-asynchronous-unwind-tables | 43 | CFLAGS += -fno-asynchronous-unwind-tables |
44 | endif | ||
45 | ifneq ($(CONFIG_DEBUG_INFO),y) | ||
43 | # -fweb shrinks the kernel a bit, but the difference is very small | 46 | # -fweb shrinks the kernel a bit, but the difference is very small |
44 | # it also messes up debugging, so don't use it for now. | 47 | # it also messes up debugging, so don't use it for now. |
45 | #CFLAGS += $(call cc-option,-fweb) | 48 | #CFLAGS += $(call cc-option,-fweb) |
@@ -50,6 +53,8 @@ CFLAGS += $(call cc-option,-funit-at-a-time) | |||
50 | # prevent gcc from generating any FP code by mistake | 53 | # prevent gcc from generating any FP code by mistake |
51 | CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) | 54 | CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) |
52 | 55 | ||
56 | AFLAGS += -m64 | ||
57 | |||
53 | head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o | 58 | head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o |
54 | 59 | ||
55 | libs-y += arch/x86_64/lib/ | 60 | libs-y += arch/x86_64/lib/ |
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index 5d56542fb68f..054dcd8a5e9d 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.14-git7 | 3 | # Linux kernel version: 2.6.15-git7 |
4 | # Sat Nov 5 15:55:50 2005 | 4 | # Wed Jan 11 11:57:36 2006 |
5 | # | 5 | # |
6 | CONFIG_X86_64=y | 6 | CONFIG_X86_64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
@@ -15,6 +15,7 @@ CONFIG_EARLY_PRINTK=y | |||
15 | CONFIG_GENERIC_ISA_DMA=y | 15 | CONFIG_GENERIC_ISA_DMA=y |
16 | CONFIG_GENERIC_IOMAP=y | 16 | CONFIG_GENERIC_IOMAP=y |
17 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y | 17 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y |
18 | CONFIG_DMI=y | ||
18 | 19 | ||
19 | # | 20 | # |
20 | # Code maturity level options | 21 | # Code maturity level options |
@@ -35,18 +36,21 @@ CONFIG_POSIX_MQUEUE=y | |||
35 | # CONFIG_BSD_PROCESS_ACCT is not set | 36 | # CONFIG_BSD_PROCESS_ACCT is not set |
36 | CONFIG_SYSCTL=y | 37 | CONFIG_SYSCTL=y |
37 | # CONFIG_AUDIT is not set | 38 | # CONFIG_AUDIT is not set |
38 | CONFIG_HOTPLUG=y | ||
39 | CONFIG_KOBJECT_UEVENT=y | ||
40 | CONFIG_IKCONFIG=y | 39 | CONFIG_IKCONFIG=y |
41 | CONFIG_IKCONFIG_PROC=y | 40 | CONFIG_IKCONFIG_PROC=y |
42 | # CONFIG_CPUSETS is not set | 41 | # CONFIG_CPUSETS is not set |
43 | CONFIG_INITRAMFS_SOURCE="" | 42 | CONFIG_INITRAMFS_SOURCE="" |
43 | CONFIG_UID16=y | ||
44 | CONFIG_VM86=y | ||
45 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
44 | # CONFIG_EMBEDDED is not set | 46 | # CONFIG_EMBEDDED is not set |
45 | CONFIG_KALLSYMS=y | 47 | CONFIG_KALLSYMS=y |
46 | CONFIG_KALLSYMS_ALL=y | 48 | CONFIG_KALLSYMS_ALL=y |
47 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 49 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
50 | CONFIG_HOTPLUG=y | ||
48 | CONFIG_PRINTK=y | 51 | CONFIG_PRINTK=y |
49 | CONFIG_BUG=y | 52 | CONFIG_BUG=y |
53 | CONFIG_ELF_CORE=y | ||
50 | CONFIG_BASE_FULL=y | 54 | CONFIG_BASE_FULL=y |
51 | CONFIG_FUTEX=y | 55 | CONFIG_FUTEX=y |
52 | CONFIG_EPOLL=y | 56 | CONFIG_EPOLL=y |
@@ -55,8 +59,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0 | |||
55 | CONFIG_CC_ALIGN_LABELS=0 | 59 | CONFIG_CC_ALIGN_LABELS=0 |
56 | CONFIG_CC_ALIGN_LOOPS=0 | 60 | CONFIG_CC_ALIGN_LOOPS=0 |
57 | CONFIG_CC_ALIGN_JUMPS=0 | 61 | CONFIG_CC_ALIGN_JUMPS=0 |
62 | CONFIG_SLAB=y | ||
58 | # CONFIG_TINY_SHMEM is not set | 63 | # CONFIG_TINY_SHMEM is not set |
59 | CONFIG_BASE_SMALL=0 | 64 | CONFIG_BASE_SMALL=0 |
65 | # CONFIG_SLOB is not set | ||
60 | 66 | ||
61 | # | 67 | # |
62 | # Loadable module support | 68 | # Loadable module support |
@@ -71,8 +77,28 @@ CONFIG_OBSOLETE_MODPARM=y | |||
71 | CONFIG_STOP_MACHINE=y | 77 | CONFIG_STOP_MACHINE=y |
72 | 78 | ||
73 | # | 79 | # |
80 | # Block layer | ||
81 | # | ||
82 | CONFIG_LBD=y | ||
83 | |||
84 | # | ||
85 | # IO Schedulers | ||
86 | # | ||
87 | CONFIG_IOSCHED_NOOP=y | ||
88 | # CONFIG_IOSCHED_AS is not set | ||
89 | CONFIG_IOSCHED_DEADLINE=y | ||
90 | CONFIG_IOSCHED_CFQ=y | ||
91 | # CONFIG_DEFAULT_AS is not set | ||
92 | # CONFIG_DEFAULT_DEADLINE is not set | ||
93 | CONFIG_DEFAULT_CFQ=y | ||
94 | # CONFIG_DEFAULT_NOOP is not set | ||
95 | CONFIG_DEFAULT_IOSCHED="cfq" | ||
96 | |||
97 | # | ||
74 | # Processor type and features | 98 | # Processor type and features |
75 | # | 99 | # |
100 | CONFIG_X86_PC=y | ||
101 | # CONFIG_X86_VSMP is not set | ||
76 | # CONFIG_MK8 is not set | 102 | # CONFIG_MK8 is not set |
77 | # CONFIG_MPSC is not set | 103 | # CONFIG_MPSC is not set |
78 | CONFIG_GENERIC_CPU=y | 104 | CONFIG_GENERIC_CPU=y |
@@ -89,14 +115,14 @@ CONFIG_X86_LOCAL_APIC=y | |||
89 | CONFIG_MTRR=y | 115 | CONFIG_MTRR=y |
90 | CONFIG_SMP=y | 116 | CONFIG_SMP=y |
91 | CONFIG_SCHED_SMT=y | 117 | CONFIG_SCHED_SMT=y |
92 | CONFIG_PREEMPT_NONE=y | 118 | # CONFIG_PREEMPT_NONE is not set |
93 | # CONFIG_PREEMPT_VOLUNTARY is not set | 119 | CONFIG_PREEMPT_VOLUNTARY=y |
94 | # CONFIG_PREEMPT is not set | 120 | # CONFIG_PREEMPT is not set |
95 | CONFIG_PREEMPT_BKL=y | 121 | CONFIG_PREEMPT_BKL=y |
96 | CONFIG_NUMA=y | 122 | CONFIG_NUMA=y |
97 | CONFIG_K8_NUMA=y | 123 | CONFIG_K8_NUMA=y |
98 | CONFIG_X86_64_ACPI_NUMA=y | 124 | CONFIG_X86_64_ACPI_NUMA=y |
99 | # CONFIG_NUMA_EMU is not set | 125 | CONFIG_NUMA_EMU=y |
100 | CONFIG_ARCH_DISCONTIGMEM_ENABLE=y | 126 | CONFIG_ARCH_DISCONTIGMEM_ENABLE=y |
101 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y | 127 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y |
102 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | 128 | CONFIG_ARCH_SPARSEMEM_ENABLE=y |
@@ -109,6 +135,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y | |||
109 | CONFIG_NEED_MULTIPLE_NODES=y | 135 | CONFIG_NEED_MULTIPLE_NODES=y |
110 | # CONFIG_SPARSEMEM_STATIC is not set | 136 | # CONFIG_SPARSEMEM_STATIC is not set |
111 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 137 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
138 | CONFIG_MIGRATION=y | ||
112 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y | 139 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y |
113 | CONFIG_NR_CPUS=32 | 140 | CONFIG_NR_CPUS=32 |
114 | CONFIG_HOTPLUG_CPU=y | 141 | CONFIG_HOTPLUG_CPU=y |
@@ -120,8 +147,9 @@ CONFIG_SWIOTLB=y | |||
120 | CONFIG_X86_MCE=y | 147 | CONFIG_X86_MCE=y |
121 | CONFIG_X86_MCE_INTEL=y | 148 | CONFIG_X86_MCE_INTEL=y |
122 | CONFIG_X86_MCE_AMD=y | 149 | CONFIG_X86_MCE_AMD=y |
123 | CONFIG_PHYSICAL_START=0x100000 | ||
124 | # CONFIG_KEXEC is not set | 150 | # CONFIG_KEXEC is not set |
151 | # CONFIG_CRASH_DUMP is not set | ||
152 | CONFIG_PHYSICAL_START=0x100000 | ||
125 | CONFIG_SECCOMP=y | 153 | CONFIG_SECCOMP=y |
126 | # CONFIG_HZ_100 is not set | 154 | # CONFIG_HZ_100 is not set |
127 | CONFIG_HZ_250=y | 155 | CONFIG_HZ_250=y |
@@ -136,6 +164,7 @@ CONFIG_GENERIC_PENDING_IRQ=y | |||
136 | # Power management options | 164 | # Power management options |
137 | # | 165 | # |
138 | CONFIG_PM=y | 166 | CONFIG_PM=y |
167 | # CONFIG_PM_LEGACY is not set | ||
139 | # CONFIG_PM_DEBUG is not set | 168 | # CONFIG_PM_DEBUG is not set |
140 | CONFIG_SOFTWARE_SUSPEND=y | 169 | CONFIG_SOFTWARE_SUSPEND=y |
141 | CONFIG_PM_STD_PARTITION="" | 170 | CONFIG_PM_STD_PARTITION="" |
@@ -152,7 +181,7 @@ CONFIG_ACPI_AC=y | |||
152 | CONFIG_ACPI_BATTERY=y | 181 | CONFIG_ACPI_BATTERY=y |
153 | CONFIG_ACPI_BUTTON=y | 182 | CONFIG_ACPI_BUTTON=y |
154 | # CONFIG_ACPI_VIDEO is not set | 183 | # CONFIG_ACPI_VIDEO is not set |
155 | CONFIG_ACPI_HOTKEY=m | 184 | # CONFIG_ACPI_HOTKEY is not set |
156 | CONFIG_ACPI_FAN=y | 185 | CONFIG_ACPI_FAN=y |
157 | CONFIG_ACPI_PROCESSOR=y | 186 | CONFIG_ACPI_PROCESSOR=y |
158 | CONFIG_ACPI_HOTPLUG_CPU=y | 187 | CONFIG_ACPI_HOTPLUG_CPU=y |
@@ -205,7 +234,7 @@ CONFIG_PCI=y | |||
205 | CONFIG_PCI_DIRECT=y | 234 | CONFIG_PCI_DIRECT=y |
206 | CONFIG_PCI_MMCONFIG=y | 235 | CONFIG_PCI_MMCONFIG=y |
207 | CONFIG_UNORDERED_IO=y | 236 | CONFIG_UNORDERED_IO=y |
208 | # CONFIG_PCIEPORTBUS is not set | 237 | CONFIG_PCIEPORTBUS=y |
209 | CONFIG_PCI_MSI=y | 238 | CONFIG_PCI_MSI=y |
210 | # CONFIG_PCI_LEGACY_PROC is not set | 239 | # CONFIG_PCI_LEGACY_PROC is not set |
211 | # CONFIG_PCI_DEBUG is not set | 240 | # CONFIG_PCI_DEBUG is not set |
@@ -229,7 +258,6 @@ CONFIG_IA32_EMULATION=y | |||
229 | CONFIG_IA32_AOUT=y | 258 | CONFIG_IA32_AOUT=y |
230 | CONFIG_COMPAT=y | 259 | CONFIG_COMPAT=y |
231 | CONFIG_SYSVIPC_COMPAT=y | 260 | CONFIG_SYSVIPC_COMPAT=y |
232 | CONFIG_UID16=y | ||
233 | 261 | ||
234 | # | 262 | # |
235 | # Networking | 263 | # Networking |
@@ -294,8 +322,11 @@ CONFIG_IPV6=y | |||
294 | # CONFIG_NET_DIVERT is not set | 322 | # CONFIG_NET_DIVERT is not set |
295 | # CONFIG_ECONET is not set | 323 | # CONFIG_ECONET is not set |
296 | # CONFIG_WAN_ROUTER is not set | 324 | # CONFIG_WAN_ROUTER is not set |
325 | |||
326 | # | ||
327 | # QoS and/or fair queueing | ||
328 | # | ||
297 | # CONFIG_NET_SCHED is not set | 329 | # CONFIG_NET_SCHED is not set |
298 | # CONFIG_NET_CLS_ROUTE is not set | ||
299 | 330 | ||
300 | # | 331 | # |
301 | # Network testing | 332 | # Network testing |
@@ -315,7 +346,7 @@ CONFIG_IPV6=y | |||
315 | # | 346 | # |
316 | CONFIG_STANDALONE=y | 347 | CONFIG_STANDALONE=y |
317 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 348 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
318 | # CONFIG_FW_LOADER is not set | 349 | CONFIG_FW_LOADER=y |
319 | # CONFIG_DEBUG_DRIVER is not set | 350 | # CONFIG_DEBUG_DRIVER is not set |
320 | 351 | ||
321 | # | 352 | # |
@@ -356,21 +387,7 @@ CONFIG_BLK_DEV_RAM=y | |||
356 | CONFIG_BLK_DEV_RAM_COUNT=16 | 387 | CONFIG_BLK_DEV_RAM_COUNT=16 |
357 | CONFIG_BLK_DEV_RAM_SIZE=4096 | 388 | CONFIG_BLK_DEV_RAM_SIZE=4096 |
358 | CONFIG_BLK_DEV_INITRD=y | 389 | CONFIG_BLK_DEV_INITRD=y |
359 | CONFIG_LBD=y | ||
360 | # CONFIG_CDROM_PKTCDVD is not set | 390 | # CONFIG_CDROM_PKTCDVD is not set |
361 | |||
362 | # | ||
363 | # IO Schedulers | ||
364 | # | ||
365 | CONFIG_IOSCHED_NOOP=y | ||
366 | # CONFIG_IOSCHED_AS is not set | ||
367 | CONFIG_IOSCHED_DEADLINE=y | ||
368 | CONFIG_IOSCHED_CFQ=y | ||
369 | # CONFIG_DEFAULT_AS is not set | ||
370 | CONFIG_DEFAULT_DEADLINE=y | ||
371 | # CONFIG_DEFAULT_CFQ is not set | ||
372 | # CONFIG_DEFAULT_NOOP is not set | ||
373 | CONFIG_DEFAULT_IOSCHED="cfq" | ||
374 | # CONFIG_ATA_OVER_ETH is not set | 391 | # CONFIG_ATA_OVER_ETH is not set |
375 | 392 | ||
376 | # | 393 | # |
@@ -410,7 +427,7 @@ CONFIG_IDEDMA_PCI_AUTO=y | |||
410 | # CONFIG_BLK_DEV_AEC62XX is not set | 427 | # CONFIG_BLK_DEV_AEC62XX is not set |
411 | # CONFIG_BLK_DEV_ALI15X3 is not set | 428 | # CONFIG_BLK_DEV_ALI15X3 is not set |
412 | CONFIG_BLK_DEV_AMD74XX=y | 429 | CONFIG_BLK_DEV_AMD74XX=y |
413 | # CONFIG_BLK_DEV_ATIIXP is not set | 430 | CONFIG_BLK_DEV_ATIIXP=y |
414 | # CONFIG_BLK_DEV_CMD64X is not set | 431 | # CONFIG_BLK_DEV_CMD64X is not set |
415 | # CONFIG_BLK_DEV_TRIFLEX is not set | 432 | # CONFIG_BLK_DEV_TRIFLEX is not set |
416 | # CONFIG_BLK_DEV_CY82C693 is not set | 433 | # CONFIG_BLK_DEV_CY82C693 is not set |
@@ -458,20 +475,21 @@ CONFIG_BLK_DEV_SD=y | |||
458 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | 475 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs |
459 | # | 476 | # |
460 | # CONFIG_SCSI_MULTI_LUN is not set | 477 | # CONFIG_SCSI_MULTI_LUN is not set |
461 | # CONFIG_SCSI_CONSTANTS is not set | 478 | CONFIG_SCSI_CONSTANTS=y |
462 | # CONFIG_SCSI_LOGGING is not set | 479 | # CONFIG_SCSI_LOGGING is not set |
463 | 480 | ||
464 | # | 481 | # |
465 | # SCSI Transport Attributes | 482 | # SCSI Transport Attributes |
466 | # | 483 | # |
467 | CONFIG_SCSI_SPI_ATTRS=y | 484 | CONFIG_SCSI_SPI_ATTRS=y |
468 | # CONFIG_SCSI_FC_ATTRS is not set | 485 | CONFIG_SCSI_FC_ATTRS=y |
469 | # CONFIG_SCSI_ISCSI_ATTRS is not set | 486 | # CONFIG_SCSI_ISCSI_ATTRS is not set |
470 | # CONFIG_SCSI_SAS_ATTRS is not set | 487 | # CONFIG_SCSI_SAS_ATTRS is not set |
471 | 488 | ||
472 | # | 489 | # |
473 | # SCSI low-level drivers | 490 | # SCSI low-level drivers |
474 | # | 491 | # |
492 | # CONFIG_ISCSI_TCP is not set | ||
475 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | 493 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set |
476 | # CONFIG_SCSI_3W_9XXX is not set | 494 | # CONFIG_SCSI_3W_9XXX is not set |
477 | # CONFIG_SCSI_ACARD is not set | 495 | # CONFIG_SCSI_ACARD is not set |
@@ -485,11 +503,13 @@ CONFIG_AIC79XX_RESET_DELAY_MS=4000 | |||
485 | # CONFIG_AIC79XX_DEBUG_ENABLE is not set | 503 | # CONFIG_AIC79XX_DEBUG_ENABLE is not set |
486 | CONFIG_AIC79XX_DEBUG_MASK=0 | 504 | CONFIG_AIC79XX_DEBUG_MASK=0 |
487 | # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set | 505 | # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set |
488 | # CONFIG_MEGARAID_NEWGEN is not set | 506 | CONFIG_MEGARAID_NEWGEN=y |
507 | CONFIG_MEGARAID_MM=y | ||
508 | CONFIG_MEGARAID_MAILBOX=y | ||
489 | # CONFIG_MEGARAID_LEGACY is not set | 509 | # CONFIG_MEGARAID_LEGACY is not set |
490 | # CONFIG_MEGARAID_SAS is not set | 510 | CONFIG_MEGARAID_SAS=y |
491 | CONFIG_SCSI_SATA=y | 511 | CONFIG_SCSI_SATA=y |
492 | # CONFIG_SCSI_SATA_AHCI is not set | 512 | CONFIG_SCSI_SATA_AHCI=y |
493 | # CONFIG_SCSI_SATA_SVW is not set | 513 | # CONFIG_SCSI_SATA_SVW is not set |
494 | CONFIG_SCSI_ATA_PIIX=y | 514 | CONFIG_SCSI_ATA_PIIX=y |
495 | # CONFIG_SCSI_SATA_MV is not set | 515 | # CONFIG_SCSI_SATA_MV is not set |
@@ -498,7 +518,7 @@ CONFIG_SCSI_SATA_NV=y | |||
498 | # CONFIG_SCSI_SATA_QSTOR is not set | 518 | # CONFIG_SCSI_SATA_QSTOR is not set |
499 | # CONFIG_SCSI_SATA_PROMISE is not set | 519 | # CONFIG_SCSI_SATA_PROMISE is not set |
500 | # CONFIG_SCSI_SATA_SX4 is not set | 520 | # CONFIG_SCSI_SATA_SX4 is not set |
501 | # CONFIG_SCSI_SATA_SIL is not set | 521 | CONFIG_SCSI_SATA_SIL=y |
502 | # CONFIG_SCSI_SATA_SIL24 is not set | 522 | # CONFIG_SCSI_SATA_SIL24 is not set |
503 | # CONFIG_SCSI_SATA_SIS is not set | 523 | # CONFIG_SCSI_SATA_SIS is not set |
504 | # CONFIG_SCSI_SATA_ULI is not set | 524 | # CONFIG_SCSI_SATA_ULI is not set |
@@ -518,12 +538,7 @@ CONFIG_SCSI_SATA_INTEL_COMBINED=y | |||
518 | # CONFIG_SCSI_QLOGIC_FC is not set | 538 | # CONFIG_SCSI_QLOGIC_FC is not set |
519 | # CONFIG_SCSI_QLOGIC_1280 is not set | 539 | # CONFIG_SCSI_QLOGIC_1280 is not set |
520 | CONFIG_SCSI_QLA2XXX=y | 540 | CONFIG_SCSI_QLA2XXX=y |
521 | # CONFIG_SCSI_QLA21XX is not set | 541 | # CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE is not set |
522 | # CONFIG_SCSI_QLA22XX is not set | ||
523 | # CONFIG_SCSI_QLA2300 is not set | ||
524 | # CONFIG_SCSI_QLA2322 is not set | ||
525 | # CONFIG_SCSI_QLA6312 is not set | ||
526 | # CONFIG_SCSI_QLA24XX is not set | ||
527 | # CONFIG_SCSI_LPFC is not set | 542 | # CONFIG_SCSI_LPFC is not set |
528 | # CONFIG_SCSI_DC395x is not set | 543 | # CONFIG_SCSI_DC395x is not set |
529 | # CONFIG_SCSI_DC390T is not set | 544 | # CONFIG_SCSI_DC390T is not set |
@@ -633,6 +648,7 @@ CONFIG_E1000=y | |||
633 | # CONFIG_R8169 is not set | 648 | # CONFIG_R8169 is not set |
634 | # CONFIG_SIS190 is not set | 649 | # CONFIG_SIS190 is not set |
635 | # CONFIG_SKGE is not set | 650 | # CONFIG_SKGE is not set |
651 | # CONFIG_SKY2 is not set | ||
636 | # CONFIG_SK98LIN is not set | 652 | # CONFIG_SK98LIN is not set |
637 | # CONFIG_VIA_VELOCITY is not set | 653 | # CONFIG_VIA_VELOCITY is not set |
638 | CONFIG_TIGON3=y | 654 | CONFIG_TIGON3=y |
@@ -645,7 +661,6 @@ CONFIG_TIGON3=y | |||
645 | # CONFIG_IXGB is not set | 661 | # CONFIG_IXGB is not set |
646 | CONFIG_S2IO=m | 662 | CONFIG_S2IO=m |
647 | # CONFIG_S2IO_NAPI is not set | 663 | # CONFIG_S2IO_NAPI is not set |
648 | # CONFIG_2BUFF_MODE is not set | ||
649 | 664 | ||
650 | # | 665 | # |
651 | # Token Ring devices | 666 | # Token Ring devices |
@@ -744,6 +759,7 @@ CONFIG_SERIAL_8250=y | |||
744 | CONFIG_SERIAL_8250_CONSOLE=y | 759 | CONFIG_SERIAL_8250_CONSOLE=y |
745 | # CONFIG_SERIAL_8250_ACPI is not set | 760 | # CONFIG_SERIAL_8250_ACPI is not set |
746 | CONFIG_SERIAL_8250_NR_UARTS=4 | 761 | CONFIG_SERIAL_8250_NR_UARTS=4 |
762 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | ||
747 | # CONFIG_SERIAL_8250_EXTENDED is not set | 763 | # CONFIG_SERIAL_8250_EXTENDED is not set |
748 | 764 | ||
749 | # | 765 | # |
@@ -751,7 +767,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4 | |||
751 | # | 767 | # |
752 | CONFIG_SERIAL_CORE=y | 768 | CONFIG_SERIAL_CORE=y |
753 | CONFIG_SERIAL_CORE_CONSOLE=y | 769 | CONFIG_SERIAL_CORE_CONSOLE=y |
754 | # CONFIG_SERIAL_JSM is not set | ||
755 | CONFIG_UNIX98_PTYS=y | 770 | CONFIG_UNIX98_PTYS=y |
756 | CONFIG_LEGACY_PTYS=y | 771 | CONFIG_LEGACY_PTYS=y |
757 | CONFIG_LEGACY_PTY_COUNT=256 | 772 | CONFIG_LEGACY_PTY_COUNT=256 |
@@ -817,10 +832,10 @@ CONFIG_AGP_INTEL=y | |||
817 | # CONFIG_DRM is not set | 832 | # CONFIG_DRM is not set |
818 | # CONFIG_MWAVE is not set | 833 | # CONFIG_MWAVE is not set |
819 | CONFIG_RAW_DRIVER=y | 834 | CONFIG_RAW_DRIVER=y |
835 | CONFIG_MAX_RAW_DEVS=256 | ||
820 | CONFIG_HPET=y | 836 | CONFIG_HPET=y |
821 | # CONFIG_HPET_RTC_IRQ is not set | 837 | # CONFIG_HPET_RTC_IRQ is not set |
822 | CONFIG_HPET_MMAP=y | 838 | CONFIG_HPET_MMAP=y |
823 | CONFIG_MAX_RAW_DEVS=256 | ||
824 | # CONFIG_HANGCHECK_TIMER is not set | 839 | # CONFIG_HANGCHECK_TIMER is not set |
825 | 840 | ||
826 | # | 841 | # |
@@ -892,6 +907,7 @@ CONFIG_SOUND=y | |||
892 | # Open Sound System | 907 | # Open Sound System |
893 | # | 908 | # |
894 | CONFIG_SOUND_PRIME=y | 909 | CONFIG_SOUND_PRIME=y |
910 | CONFIG_OBSOLETE_OSS_DRIVER=y | ||
895 | # CONFIG_SOUND_BT878 is not set | 911 | # CONFIG_SOUND_BT878 is not set |
896 | # CONFIG_SOUND_CMPCI is not set | 912 | # CONFIG_SOUND_CMPCI is not set |
897 | # CONFIG_SOUND_EMU10K1 is not set | 913 | # CONFIG_SOUND_EMU10K1 is not set |
@@ -968,7 +984,8 @@ CONFIG_USB_STORAGE=y | |||
968 | # CONFIG_USB_STORAGE_SDDR09 is not set | 984 | # CONFIG_USB_STORAGE_SDDR09 is not set |
969 | # CONFIG_USB_STORAGE_SDDR55 is not set | 985 | # CONFIG_USB_STORAGE_SDDR55 is not set |
970 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | 986 | # CONFIG_USB_STORAGE_JUMPSHOT is not set |
971 | # CONFIG_USB_STORAGE_ONETOUCH is not set | 987 | # CONFIG_USB_STORAGE_ALAUDA is not set |
988 | # CONFIG_USB_LIBUSUAL is not set | ||
972 | 989 | ||
973 | # | 990 | # |
974 | # USB Input Devices | 991 | # USB Input Devices |
@@ -988,6 +1005,7 @@ CONFIG_USB_HIDINPUT=y | |||
988 | # CONFIG_USB_YEALINK is not set | 1005 | # CONFIG_USB_YEALINK is not set |
989 | # CONFIG_USB_XPAD is not set | 1006 | # CONFIG_USB_XPAD is not set |
990 | # CONFIG_USB_ATI_REMOTE is not set | 1007 | # CONFIG_USB_ATI_REMOTE is not set |
1008 | # CONFIG_USB_ATI_REMOTE2 is not set | ||
991 | # CONFIG_USB_KEYSPAN_REMOTE is not set | 1009 | # CONFIG_USB_KEYSPAN_REMOTE is not set |
992 | # CONFIG_USB_APPLETOUCH is not set | 1010 | # CONFIG_USB_APPLETOUCH is not set |
993 | 1011 | ||
@@ -1097,6 +1115,7 @@ CONFIG_REISERFS_FS_POSIX_ACL=y | |||
1097 | # CONFIG_JFS_FS is not set | 1115 | # CONFIG_JFS_FS is not set |
1098 | CONFIG_FS_POSIX_ACL=y | 1116 | CONFIG_FS_POSIX_ACL=y |
1099 | # CONFIG_XFS_FS is not set | 1117 | # CONFIG_XFS_FS is not set |
1118 | # CONFIG_OCFS2_FS is not set | ||
1100 | # CONFIG_MINIX_FS is not set | 1119 | # CONFIG_MINIX_FS is not set |
1101 | # CONFIG_ROMFS_FS is not set | 1120 | # CONFIG_ROMFS_FS is not set |
1102 | CONFIG_INOTIFY=y | 1121 | CONFIG_INOTIFY=y |
@@ -1135,6 +1154,7 @@ CONFIG_HUGETLBFS=y | |||
1135 | CONFIG_HUGETLB_PAGE=y | 1154 | CONFIG_HUGETLB_PAGE=y |
1136 | CONFIG_RAMFS=y | 1155 | CONFIG_RAMFS=y |
1137 | CONFIG_RELAYFS_FS=y | 1156 | CONFIG_RELAYFS_FS=y |
1157 | # CONFIG_CONFIGFS_FS is not set | ||
1138 | 1158 | ||
1139 | # | 1159 | # |
1140 | # Miscellaneous filesystems | 1160 | # Miscellaneous filesystems |
@@ -1232,21 +1252,23 @@ CONFIG_NLS_ISO8859_15=y | |||
1232 | CONFIG_NLS_UTF8=y | 1252 | CONFIG_NLS_UTF8=y |
1233 | 1253 | ||
1234 | # | 1254 | # |
1235 | # Profiling support | 1255 | # Instrumentation Support |
1236 | # | 1256 | # |
1237 | CONFIG_PROFILING=y | 1257 | CONFIG_PROFILING=y |
1238 | CONFIG_OPROFILE=y | 1258 | CONFIG_OPROFILE=y |
1259 | CONFIG_KPROBES=y | ||
1239 | 1260 | ||
1240 | # | 1261 | # |
1241 | # Kernel hacking | 1262 | # Kernel hacking |
1242 | # | 1263 | # |
1243 | # CONFIG_PRINTK_TIME is not set | 1264 | # CONFIG_PRINTK_TIME is not set |
1244 | CONFIG_DEBUG_KERNEL=y | ||
1245 | CONFIG_MAGIC_SYSRQ=y | 1265 | CONFIG_MAGIC_SYSRQ=y |
1266 | CONFIG_DEBUG_KERNEL=y | ||
1246 | CONFIG_LOG_BUF_SHIFT=18 | 1267 | CONFIG_LOG_BUF_SHIFT=18 |
1247 | CONFIG_DETECT_SOFTLOCKUP=y | 1268 | CONFIG_DETECT_SOFTLOCKUP=y |
1248 | # CONFIG_SCHEDSTATS is not set | 1269 | # CONFIG_SCHEDSTATS is not set |
1249 | # CONFIG_DEBUG_SLAB is not set | 1270 | # CONFIG_DEBUG_SLAB is not set |
1271 | # CONFIG_DEBUG_MUTEXES is not set | ||
1250 | # CONFIG_DEBUG_SPINLOCK is not set | 1272 | # CONFIG_DEBUG_SPINLOCK is not set |
1251 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1273 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1252 | # CONFIG_DEBUG_KOBJECT is not set | 1274 | # CONFIG_DEBUG_KOBJECT is not set |
@@ -1256,8 +1278,8 @@ CONFIG_DEBUG_FS=y | |||
1256 | # CONFIG_FRAME_POINTER is not set | 1278 | # CONFIG_FRAME_POINTER is not set |
1257 | # CONFIG_RCU_TORTURE_TEST is not set | 1279 | # CONFIG_RCU_TORTURE_TEST is not set |
1258 | CONFIG_INIT_DEBUG=y | 1280 | CONFIG_INIT_DEBUG=y |
1281 | # CONFIG_DEBUG_RODATA is not set | ||
1259 | # CONFIG_IOMMU_DEBUG is not set | 1282 | # CONFIG_IOMMU_DEBUG is not set |
1260 | CONFIG_KPROBES=y | ||
1261 | 1283 | ||
1262 | # | 1284 | # |
1263 | # Security options | 1285 | # Security options |
diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c index 0903cc1faef2..e0a92439f634 100644 --- a/arch/x86_64/ia32/ia32_signal.c +++ b/arch/x86_64/ia32/ia32_signal.c | |||
@@ -353,7 +353,6 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __ | |||
353 | struct pt_regs *regs, unsigned int mask) | 353 | struct pt_regs *regs, unsigned int mask) |
354 | { | 354 | { |
355 | int tmp, err = 0; | 355 | int tmp, err = 0; |
356 | u32 eflags; | ||
357 | 356 | ||
358 | tmp = 0; | 357 | tmp = 0; |
359 | __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); | 358 | __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); |
@@ -378,10 +377,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __ | |||
378 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 377 | err |= __put_user(current->thread.trap_no, &sc->trapno); |
379 | err |= __put_user(current->thread.error_code, &sc->err); | 378 | err |= __put_user(current->thread.error_code, &sc->err); |
380 | err |= __put_user((u32)regs->rip, &sc->eip); | 379 | err |= __put_user((u32)regs->rip, &sc->eip); |
381 | eflags = regs->eflags; | 380 | err |= __put_user((u32)regs->eflags, &sc->eflags); |
382 | if (current->ptrace & PT_PTRACED) | ||
383 | eflags &= ~TF_MASK; | ||
384 | err |= __put_user((u32)eflags, &sc->eflags); | ||
385 | err |= __put_user((u32)regs->rsp, &sc->esp_at_signal); | 381 | err |= __put_user((u32)regs->rsp, &sc->esp_at_signal); |
386 | 382 | ||
387 | tmp = save_i387_ia32(current, fpstate, regs, 0); | 383 | tmp = save_i387_ia32(current, fpstate, regs, 0); |
@@ -505,13 +501,9 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
505 | regs->ss = __USER32_DS; | 501 | regs->ss = __USER32_DS; |
506 | 502 | ||
507 | set_fs(USER_DS); | 503 | set_fs(USER_DS); |
508 | if (regs->eflags & TF_MASK) { | 504 | regs->eflags &= ~TF_MASK; |
509 | if (current->ptrace & PT_PTRACED) { | 505 | if (test_thread_flag(TIF_SINGLESTEP)) |
510 | ptrace_notify(SIGTRAP); | 506 | ptrace_notify(SIGTRAP); |
511 | } else { | ||
512 | regs->eflags &= ~TF_MASK; | ||
513 | } | ||
514 | } | ||
515 | 507 | ||
516 | #if DEBUG_SIG | 508 | #if DEBUG_SIG |
517 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", | 509 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", |
@@ -605,13 +597,9 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
605 | regs->ss = __USER32_DS; | 597 | regs->ss = __USER32_DS; |
606 | 598 | ||
607 | set_fs(USER_DS); | 599 | set_fs(USER_DS); |
608 | if (regs->eflags & TF_MASK) { | 600 | regs->eflags &= ~TF_MASK; |
609 | if (current->ptrace & PT_PTRACED) { | 601 | if (test_thread_flag(TIF_SINGLESTEP)) |
610 | ptrace_notify(SIGTRAP); | 602 | ptrace_notify(SIGTRAP); |
611 | } else { | ||
612 | regs->eflags &= ~TF_MASK; | ||
613 | } | ||
614 | } | ||
615 | 603 | ||
616 | #if DEBUG_SIG | 604 | #if DEBUG_SIG |
617 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", | 605 | printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", |
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 2ff07b47ea9c..58f5bfb52c63 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S | |||
@@ -35,6 +35,18 @@ | |||
35 | movq %rax,R8(%rsp) | 35 | movq %rax,R8(%rsp) |
36 | .endm | 36 | .endm |
37 | 37 | ||
38 | .macro CFI_STARTPROC32 simple | ||
39 | CFI_STARTPROC \simple | ||
40 | CFI_UNDEFINED r8 | ||
41 | CFI_UNDEFINED r9 | ||
42 | CFI_UNDEFINED r10 | ||
43 | CFI_UNDEFINED r11 | ||
44 | CFI_UNDEFINED r12 | ||
45 | CFI_UNDEFINED r13 | ||
46 | CFI_UNDEFINED r14 | ||
47 | CFI_UNDEFINED r15 | ||
48 | .endm | ||
49 | |||
38 | /* | 50 | /* |
39 | * 32bit SYSENTER instruction entry. | 51 | * 32bit SYSENTER instruction entry. |
40 | * | 52 | * |
@@ -55,7 +67,7 @@ | |||
55 | * with the int 0x80 path. | 67 | * with the int 0x80 path. |
56 | */ | 68 | */ |
57 | ENTRY(ia32_sysenter_target) | 69 | ENTRY(ia32_sysenter_target) |
58 | CFI_STARTPROC simple | 70 | CFI_STARTPROC32 simple |
59 | CFI_DEF_CFA rsp,0 | 71 | CFI_DEF_CFA rsp,0 |
60 | CFI_REGISTER rsp,rbp | 72 | CFI_REGISTER rsp,rbp |
61 | swapgs | 73 | swapgs |
@@ -92,6 +104,7 @@ ENTRY(ia32_sysenter_target) | |||
92 | .quad 1b,ia32_badarg | 104 | .quad 1b,ia32_badarg |
93 | .previous | 105 | .previous |
94 | GET_THREAD_INFO(%r10) | 106 | GET_THREAD_INFO(%r10) |
107 | orl $TS_COMPAT,threadinfo_status(%r10) | ||
95 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 108 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
96 | CFI_REMEMBER_STATE | 109 | CFI_REMEMBER_STATE |
97 | jnz sysenter_tracesys | 110 | jnz sysenter_tracesys |
@@ -105,6 +118,7 @@ sysenter_do_call: | |||
105 | cli | 118 | cli |
106 | testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) | 119 | testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) |
107 | jnz int_ret_from_sys_call | 120 | jnz int_ret_from_sys_call |
121 | andl $~TS_COMPAT,threadinfo_status(%r10) | ||
108 | /* clear IF, that popfq doesn't enable interrupts early */ | 122 | /* clear IF, that popfq doesn't enable interrupts early */ |
109 | andl $~0x200,EFLAGS-R11(%rsp) | 123 | andl $~0x200,EFLAGS-R11(%rsp) |
110 | RESTORE_ARGS 1,24,1,1,1,1 | 124 | RESTORE_ARGS 1,24,1,1,1,1 |
@@ -161,7 +175,7 @@ sysenter_tracesys: | |||
161 | * with the int 0x80 path. | 175 | * with the int 0x80 path. |
162 | */ | 176 | */ |
163 | ENTRY(ia32_cstar_target) | 177 | ENTRY(ia32_cstar_target) |
164 | CFI_STARTPROC simple | 178 | CFI_STARTPROC32 simple |
165 | CFI_DEF_CFA rsp,0 | 179 | CFI_DEF_CFA rsp,0 |
166 | CFI_REGISTER rip,rcx | 180 | CFI_REGISTER rip,rcx |
167 | /*CFI_REGISTER rflags,r11*/ | 181 | /*CFI_REGISTER rflags,r11*/ |
@@ -191,6 +205,7 @@ ENTRY(ia32_cstar_target) | |||
191 | .quad 1b,ia32_badarg | 205 | .quad 1b,ia32_badarg |
192 | .previous | 206 | .previous |
193 | GET_THREAD_INFO(%r10) | 207 | GET_THREAD_INFO(%r10) |
208 | orl $TS_COMPAT,threadinfo_status(%r10) | ||
194 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 209 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
195 | CFI_REMEMBER_STATE | 210 | CFI_REMEMBER_STATE |
196 | jnz cstar_tracesys | 211 | jnz cstar_tracesys |
@@ -204,6 +219,7 @@ cstar_do_call: | |||
204 | cli | 219 | cli |
205 | testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) | 220 | testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) |
206 | jnz int_ret_from_sys_call | 221 | jnz int_ret_from_sys_call |
222 | andl $~TS_COMPAT,threadinfo_status(%r10) | ||
207 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 | 223 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 |
208 | movl RIP-ARGOFFSET(%rsp),%ecx | 224 | movl RIP-ARGOFFSET(%rsp),%ecx |
209 | CFI_REGISTER rip,rcx | 225 | CFI_REGISTER rip,rcx |
@@ -276,6 +292,7 @@ ENTRY(ia32_syscall) | |||
276 | this could be a problem. */ | 292 | this could be a problem. */ |
277 | SAVE_ARGS 0,0,1 | 293 | SAVE_ARGS 0,0,1 |
278 | GET_THREAD_INFO(%r10) | 294 | GET_THREAD_INFO(%r10) |
295 | orl $TS_COMPAT,threadinfo_status(%r10) | ||
279 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 296 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
280 | jnz ia32_tracesys | 297 | jnz ia32_tracesys |
281 | ia32_do_syscall: | 298 | ia32_do_syscall: |
@@ -318,7 +335,7 @@ quiet_ni_syscall: | |||
318 | jmp ia32_ptregs_common | 335 | jmp ia32_ptregs_common |
319 | .endm | 336 | .endm |
320 | 337 | ||
321 | CFI_STARTPROC | 338 | CFI_STARTPROC32 |
322 | 339 | ||
323 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi | 340 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi |
324 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi | 341 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi |
@@ -333,8 +350,19 @@ quiet_ni_syscall: | |||
333 | 350 | ||
334 | ENTRY(ia32_ptregs_common) | 351 | ENTRY(ia32_ptregs_common) |
335 | popq %r11 | 352 | popq %r11 |
336 | CFI_ADJUST_CFA_OFFSET -8 | 353 | CFI_ENDPROC |
337 | CFI_REGISTER rip, r11 | 354 | CFI_STARTPROC32 simple |
355 | CFI_DEF_CFA rsp,SS+8-ARGOFFSET | ||
356 | CFI_REL_OFFSET rax,RAX-ARGOFFSET | ||
357 | CFI_REL_OFFSET rcx,RCX-ARGOFFSET | ||
358 | CFI_REL_OFFSET rdx,RDX-ARGOFFSET | ||
359 | CFI_REL_OFFSET rsi,RSI-ARGOFFSET | ||
360 | CFI_REL_OFFSET rdi,RDI-ARGOFFSET | ||
361 | CFI_REL_OFFSET rip,RIP-ARGOFFSET | ||
362 | /* CFI_REL_OFFSET cs,CS-ARGOFFSET*/ | ||
363 | /* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ | ||
364 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET | ||
365 | /* CFI_REL_OFFSET ss,SS-ARGOFFSET*/ | ||
338 | SAVE_REST | 366 | SAVE_REST |
339 | call *%rax | 367 | call *%rax |
340 | RESTORE_REST | 368 | RESTORE_REST |
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c index 5f4cdfa56901..ea4394e021d6 100644 --- a/arch/x86_64/ia32/ptrace32.c +++ b/arch/x86_64/ia32/ptrace32.c | |||
@@ -28,9 +28,12 @@ | |||
28 | #include <asm/i387.h> | 28 | #include <asm/i387.h> |
29 | #include <asm/fpu32.h> | 29 | #include <asm/fpu32.h> |
30 | 30 | ||
31 | /* determines which flags the user has access to. */ | 31 | /* |
32 | /* 1 = access 0 = no access */ | 32 | * Determines which flags the user has access to [1 = access, 0 = no access]. |
33 | #define FLAG_MASK 0x44dd5UL | 33 | * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9). |
34 | * Also masks reserved bits (31-22, 15, 5, 3, 1). | ||
35 | */ | ||
36 | #define FLAG_MASK 0x54dd5UL | ||
34 | 37 | ||
35 | #define R32(l,q) \ | 38 | #define R32(l,q) \ |
36 | case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break | 39 | case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break |
diff --git a/arch/x86_64/ia32/vsyscall-sigreturn.S b/arch/x86_64/ia32/vsyscall-sigreturn.S index 8b5a4b060bb5..d90321fe9bba 100644 --- a/arch/x86_64/ia32/vsyscall-sigreturn.S +++ b/arch/x86_64/ia32/vsyscall-sigreturn.S | |||
@@ -7,6 +7,7 @@ | |||
7 | * by doing ".balign 32" must match in both versions of the page. | 7 | * by doing ".balign 32" must match in both versions of the page. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | .code32 | ||
10 | .section .text.sigreturn,"ax" | 11 | .section .text.sigreturn,"ax" |
11 | .balign 32 | 12 | .balign 32 |
12 | .globl __kernel_sigreturn | 13 | .globl __kernel_sigreturn |
diff --git a/arch/x86_64/ia32/vsyscall-syscall.S b/arch/x86_64/ia32/vsyscall-syscall.S index b024965bb689..cf9ef678de3e 100644 --- a/arch/x86_64/ia32/vsyscall-syscall.S +++ b/arch/x86_64/ia32/vsyscall-syscall.S | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <asm/asm-offsets.h> | 6 | #include <asm/asm-offsets.h> |
7 | #include <asm/segment.h> | 7 | #include <asm/segment.h> |
8 | 8 | ||
9 | .code32 | ||
9 | .text | 10 | .text |
10 | .section .text.vsyscall,"ax" | 11 | .section .text.vsyscall,"ax" |
11 | .globl __kernel_vsyscall | 12 | .globl __kernel_vsyscall |
diff --git a/arch/x86_64/ia32/vsyscall-sysenter.S b/arch/x86_64/ia32/vsyscall-sysenter.S index 71f3de586b56..ae056e553d13 100644 --- a/arch/x86_64/ia32/vsyscall-sysenter.S +++ b/arch/x86_64/ia32/vsyscall-sysenter.S | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <asm/ia32_unistd.h> | 5 | #include <asm/ia32_unistd.h> |
6 | #include <asm/asm-offsets.h> | 6 | #include <asm/asm-offsets.h> |
7 | 7 | ||
8 | .code32 | ||
8 | .text | 9 | .text |
9 | .section .text.vsyscall,"ax" | 10 | .section .text.vsyscall,"ax" |
10 | .globl __kernel_vsyscall | 11 | .globl __kernel_vsyscall |
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index 12bc54005e2f..72fe60c20d39 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile | |||
@@ -7,7 +7,8 @@ EXTRA_AFLAGS := -traditional | |||
7 | obj-y := process.o signal.o entry.o traps.o irq.o \ | 7 | obj-y := process.o signal.o entry.o traps.o irq.o \ |
8 | ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ | 8 | ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ |
9 | x8664_ksyms.o i387.o syscall.o vsyscall.o \ | 9 | x8664_ksyms.o i387.o syscall.o vsyscall.o \ |
10 | setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o | 10 | setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \ |
11 | dmi_scan.o pci-dma.o pci-nommu.o | ||
11 | 12 | ||
12 | obj-$(CONFIG_X86_MCE) += mce.o | 13 | obj-$(CONFIG_X86_MCE) += mce.o |
13 | obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o | 14 | obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o |
@@ -28,9 +29,10 @@ obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o | |||
28 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ | 29 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ |
29 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 30 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
30 | obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o | 31 | obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o |
31 | obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o | 32 | obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o |
32 | obj-$(CONFIG_KPROBES) += kprobes.o | 33 | obj-$(CONFIG_KPROBES) += kprobes.o |
33 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o | 34 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o |
35 | obj-$(CONFIG_X86_VSMP) += vsmp.o | ||
34 | 36 | ||
35 | obj-$(CONFIG_MODULES) += module.o | 37 | obj-$(CONFIG_MODULES) += module.o |
36 | 38 | ||
@@ -47,3 +49,5 @@ intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o | |||
47 | quirks-y += ../../i386/kernel/quirks.o | 49 | quirks-y += ../../i386/kernel/quirks.o |
48 | i8237-y += ../../i386/kernel/i8237.o | 50 | i8237-y += ../../i386/kernel/i8237.o |
49 | msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o | 51 | msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o |
52 | dmi_scan-y += ../../i386/kernel/dmi_scan.o | ||
53 | |||
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c index c7f4fdd20f05..e4e2b7d01f89 100644 --- a/arch/x86_64/kernel/aperture.c +++ b/arch/x86_64/kernel/aperture.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/io.h> | 23 | #include <asm/io.h> |
24 | #include <asm/proto.h> | 24 | #include <asm/proto.h> |
25 | #include <asm/pci-direct.h> | 25 | #include <asm/pci-direct.h> |
26 | #include <asm/dma.h> | ||
26 | 27 | ||
27 | int iommu_aperture; | 28 | int iommu_aperture; |
28 | int iommu_aperture_disabled __initdata = 0; | 29 | int iommu_aperture_disabled __initdata = 0; |
@@ -247,7 +248,7 @@ void __init iommu_hole_init(void) | |||
247 | /* Got the aperture from the AGP bridge */ | 248 | /* Got the aperture from the AGP bridge */ |
248 | } else if (swiotlb && !valid_agp) { | 249 | } else if (swiotlb && !valid_agp) { |
249 | /* Do nothing */ | 250 | /* Do nothing */ |
250 | } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) || | 251 | } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) || |
251 | force_iommu || | 252 | force_iommu || |
252 | valid_agp || | 253 | valid_agp || |
253 | fallback_aper_force) { | 254 | fallback_aper_force) { |
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c index 18691ce4c759..8fdd089fd17e 100644 --- a/arch/x86_64/kernel/apic.c +++ b/arch/x86_64/kernel/apic.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mc146818rtc.h> | 25 | #include <linux/mc146818rtc.h> |
26 | #include <linux/kernel_stat.h> | 26 | #include <linux/kernel_stat.h> |
27 | #include <linux/sysdev.h> | 27 | #include <linux/sysdev.h> |
28 | #include <linux/module.h> | ||
28 | 29 | ||
29 | #include <asm/atomic.h> | 30 | #include <asm/atomic.h> |
30 | #include <asm/smp.h> | 31 | #include <asm/smp.h> |
@@ -33,36 +34,36 @@ | |||
33 | #include <asm/pgalloc.h> | 34 | #include <asm/pgalloc.h> |
34 | #include <asm/mach_apic.h> | 35 | #include <asm/mach_apic.h> |
35 | #include <asm/nmi.h> | 36 | #include <asm/nmi.h> |
37 | #include <asm/idle.h> | ||
36 | 38 | ||
37 | int apic_verbosity; | 39 | int apic_verbosity; |
38 | 40 | ||
39 | int disable_apic_timer __initdata; | 41 | int disable_apic_timer __initdata; |
40 | 42 | ||
43 | /* | ||
44 | * cpu_mask that denotes the CPUs that needs timer interrupt coming in as | ||
45 | * IPIs in place of local APIC timers | ||
46 | */ | ||
47 | static cpumask_t timer_interrupt_broadcast_ipi_mask; | ||
48 | |||
41 | /* Using APIC to generate smp_local_timer_interrupt? */ | 49 | /* Using APIC to generate smp_local_timer_interrupt? */ |
42 | int using_apic_timer = 0; | 50 | int using_apic_timer = 0; |
43 | 51 | ||
44 | static DEFINE_PER_CPU(int, prof_multiplier) = 1; | ||
45 | static DEFINE_PER_CPU(int, prof_old_multiplier) = 1; | ||
46 | static DEFINE_PER_CPU(int, prof_counter) = 1; | ||
47 | |||
48 | static void apic_pm_activate(void); | 52 | static void apic_pm_activate(void); |
49 | 53 | ||
50 | void enable_NMI_through_LVT0 (void * dummy) | 54 | void enable_NMI_through_LVT0 (void * dummy) |
51 | { | 55 | { |
52 | unsigned int v, ver; | 56 | unsigned int v; |
53 | 57 | ||
54 | ver = apic_read(APIC_LVR); | ||
55 | ver = GET_APIC_VERSION(ver); | ||
56 | v = APIC_DM_NMI; /* unmask and set to NMI */ | 58 | v = APIC_DM_NMI; /* unmask and set to NMI */ |
57 | apic_write_around(APIC_LVT0, v); | 59 | apic_write(APIC_LVT0, v); |
58 | } | 60 | } |
59 | 61 | ||
60 | int get_maxlvt(void) | 62 | int get_maxlvt(void) |
61 | { | 63 | { |
62 | unsigned int v, ver, maxlvt; | 64 | unsigned int v, maxlvt; |
63 | 65 | ||
64 | v = apic_read(APIC_LVR); | 66 | v = apic_read(APIC_LVR); |
65 | ver = GET_APIC_VERSION(v); | ||
66 | maxlvt = GET_APIC_MAXLVT(v); | 67 | maxlvt = GET_APIC_MAXLVT(v); |
67 | return maxlvt; | 68 | return maxlvt; |
68 | } | 69 | } |
@@ -80,33 +81,33 @@ void clear_local_APIC(void) | |||
80 | */ | 81 | */ |
81 | if (maxlvt >= 3) { | 82 | if (maxlvt >= 3) { |
82 | v = ERROR_APIC_VECTOR; /* any non-zero vector will do */ | 83 | v = ERROR_APIC_VECTOR; /* any non-zero vector will do */ |
83 | apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED); | 84 | apic_write(APIC_LVTERR, v | APIC_LVT_MASKED); |
84 | } | 85 | } |
85 | /* | 86 | /* |
86 | * Careful: we have to set masks only first to deassert | 87 | * Careful: we have to set masks only first to deassert |
87 | * any level-triggered sources. | 88 | * any level-triggered sources. |
88 | */ | 89 | */ |
89 | v = apic_read(APIC_LVTT); | 90 | v = apic_read(APIC_LVTT); |
90 | apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED); | 91 | apic_write(APIC_LVTT, v | APIC_LVT_MASKED); |
91 | v = apic_read(APIC_LVT0); | 92 | v = apic_read(APIC_LVT0); |
92 | apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); | 93 | apic_write(APIC_LVT0, v | APIC_LVT_MASKED); |
93 | v = apic_read(APIC_LVT1); | 94 | v = apic_read(APIC_LVT1); |
94 | apic_write_around(APIC_LVT1, v | APIC_LVT_MASKED); | 95 | apic_write(APIC_LVT1, v | APIC_LVT_MASKED); |
95 | if (maxlvt >= 4) { | 96 | if (maxlvt >= 4) { |
96 | v = apic_read(APIC_LVTPC); | 97 | v = apic_read(APIC_LVTPC); |
97 | apic_write_around(APIC_LVTPC, v | APIC_LVT_MASKED); | 98 | apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); |
98 | } | 99 | } |
99 | 100 | ||
100 | /* | 101 | /* |
101 | * Clean APIC state for other OSs: | 102 | * Clean APIC state for other OSs: |
102 | */ | 103 | */ |
103 | apic_write_around(APIC_LVTT, APIC_LVT_MASKED); | 104 | apic_write(APIC_LVTT, APIC_LVT_MASKED); |
104 | apic_write_around(APIC_LVT0, APIC_LVT_MASKED); | 105 | apic_write(APIC_LVT0, APIC_LVT_MASKED); |
105 | apic_write_around(APIC_LVT1, APIC_LVT_MASKED); | 106 | apic_write(APIC_LVT1, APIC_LVT_MASKED); |
106 | if (maxlvt >= 3) | 107 | if (maxlvt >= 3) |
107 | apic_write_around(APIC_LVTERR, APIC_LVT_MASKED); | 108 | apic_write(APIC_LVTERR, APIC_LVT_MASKED); |
108 | if (maxlvt >= 4) | 109 | if (maxlvt >= 4) |
109 | apic_write_around(APIC_LVTPC, APIC_LVT_MASKED); | 110 | apic_write(APIC_LVTPC, APIC_LVT_MASKED); |
110 | v = GET_APIC_VERSION(apic_read(APIC_LVR)); | 111 | v = GET_APIC_VERSION(apic_read(APIC_LVR)); |
111 | apic_write(APIC_ESR, 0); | 112 | apic_write(APIC_ESR, 0); |
112 | apic_read(APIC_ESR); | 113 | apic_read(APIC_ESR); |
@@ -151,7 +152,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
151 | value &= ~APIC_VECTOR_MASK; | 152 | value &= ~APIC_VECTOR_MASK; |
152 | value |= APIC_SPIV_APIC_ENABLED; | 153 | value |= APIC_SPIV_APIC_ENABLED; |
153 | value |= 0xf; | 154 | value |= 0xf; |
154 | apic_write_around(APIC_SPIV, value); | 155 | apic_write(APIC_SPIV, value); |
155 | 156 | ||
156 | if (!virt_wire_setup) { | 157 | if (!virt_wire_setup) { |
157 | /* For LVT0 make it edge triggered, active high, external and enabled */ | 158 | /* For LVT0 make it edge triggered, active high, external and enabled */ |
@@ -161,11 +162,11 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
161 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED ); | 162 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED ); |
162 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; | 163 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; |
163 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); | 164 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); |
164 | apic_write_around(APIC_LVT0, value); | 165 | apic_write(APIC_LVT0, value); |
165 | } | 166 | } |
166 | else { | 167 | else { |
167 | /* Disable LVT0 */ | 168 | /* Disable LVT0 */ |
168 | apic_write_around(APIC_LVT0, APIC_LVT_MASKED); | 169 | apic_write(APIC_LVT0, APIC_LVT_MASKED); |
169 | } | 170 | } |
170 | 171 | ||
171 | /* For LVT1 make it edge triggered, active high, nmi and enabled */ | 172 | /* For LVT1 make it edge triggered, active high, nmi and enabled */ |
@@ -176,7 +177,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
176 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); | 177 | APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); |
177 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; | 178 | value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; |
178 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); | 179 | value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); |
179 | apic_write_around(APIC_LVT1, value); | 180 | apic_write(APIC_LVT1, value); |
180 | } | 181 | } |
181 | } | 182 | } |
182 | 183 | ||
@@ -192,7 +193,7 @@ void disable_local_APIC(void) | |||
192 | */ | 193 | */ |
193 | value = apic_read(APIC_SPIV); | 194 | value = apic_read(APIC_SPIV); |
194 | value &= ~APIC_SPIV_APIC_ENABLED; | 195 | value &= ~APIC_SPIV_APIC_ENABLED; |
195 | apic_write_around(APIC_SPIV, value); | 196 | apic_write(APIC_SPIV, value); |
196 | } | 197 | } |
197 | 198 | ||
198 | /* | 199 | /* |
@@ -269,7 +270,7 @@ void __init sync_Arb_IDs(void) | |||
269 | apic_wait_icr_idle(); | 270 | apic_wait_icr_idle(); |
270 | 271 | ||
271 | apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); | 272 | apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); |
272 | apic_write_around(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | 273 | apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG |
273 | | APIC_DM_INIT); | 274 | | APIC_DM_INIT); |
274 | } | 275 | } |
275 | 276 | ||
@@ -280,7 +281,7 @@ extern void __error_in_apic_c (void); | |||
280 | */ | 281 | */ |
281 | void __init init_bsp_APIC(void) | 282 | void __init init_bsp_APIC(void) |
282 | { | 283 | { |
283 | unsigned int value, ver; | 284 | unsigned int value; |
284 | 285 | ||
285 | /* | 286 | /* |
286 | * Don't do the setup now if we have a SMP BIOS as the | 287 | * Don't do the setup now if we have a SMP BIOS as the |
@@ -290,7 +291,6 @@ void __init init_bsp_APIC(void) | |||
290 | return; | 291 | return; |
291 | 292 | ||
292 | value = apic_read(APIC_LVR); | 293 | value = apic_read(APIC_LVR); |
293 | ver = GET_APIC_VERSION(value); | ||
294 | 294 | ||
295 | /* | 295 | /* |
296 | * Do not trust the local APIC being empty at bootup. | 296 | * Do not trust the local APIC being empty at bootup. |
@@ -305,22 +305,21 @@ void __init init_bsp_APIC(void) | |||
305 | value |= APIC_SPIV_APIC_ENABLED; | 305 | value |= APIC_SPIV_APIC_ENABLED; |
306 | value |= APIC_SPIV_FOCUS_DISABLED; | 306 | value |= APIC_SPIV_FOCUS_DISABLED; |
307 | value |= SPURIOUS_APIC_VECTOR; | 307 | value |= SPURIOUS_APIC_VECTOR; |
308 | apic_write_around(APIC_SPIV, value); | 308 | apic_write(APIC_SPIV, value); |
309 | 309 | ||
310 | /* | 310 | /* |
311 | * Set up the virtual wire mode. | 311 | * Set up the virtual wire mode. |
312 | */ | 312 | */ |
313 | apic_write_around(APIC_LVT0, APIC_DM_EXTINT); | 313 | apic_write(APIC_LVT0, APIC_DM_EXTINT); |
314 | value = APIC_DM_NMI; | 314 | value = APIC_DM_NMI; |
315 | apic_write_around(APIC_LVT1, value); | 315 | apic_write(APIC_LVT1, value); |
316 | } | 316 | } |
317 | 317 | ||
318 | void __cpuinit setup_local_APIC (void) | 318 | void __cpuinit setup_local_APIC (void) |
319 | { | 319 | { |
320 | unsigned int value, ver, maxlvt; | 320 | unsigned int value, maxlvt; |
321 | 321 | ||
322 | value = apic_read(APIC_LVR); | 322 | value = apic_read(APIC_LVR); |
323 | ver = GET_APIC_VERSION(value); | ||
324 | 323 | ||
325 | if ((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f) | 324 | if ((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f) |
326 | __error_in_apic_c(); | 325 | __error_in_apic_c(); |
@@ -345,7 +344,7 @@ void __cpuinit setup_local_APIC (void) | |||
345 | */ | 344 | */ |
346 | value = apic_read(APIC_TASKPRI); | 345 | value = apic_read(APIC_TASKPRI); |
347 | value &= ~APIC_TPRI_MASK; | 346 | value &= ~APIC_TPRI_MASK; |
348 | apic_write_around(APIC_TASKPRI, value); | 347 | apic_write(APIC_TASKPRI, value); |
349 | 348 | ||
350 | /* | 349 | /* |
351 | * Now that we are all set up, enable the APIC | 350 | * Now that we are all set up, enable the APIC |
@@ -387,7 +386,7 @@ void __cpuinit setup_local_APIC (void) | |||
387 | * Set spurious IRQ vector | 386 | * Set spurious IRQ vector |
388 | */ | 387 | */ |
389 | value |= SPURIOUS_APIC_VECTOR; | 388 | value |= SPURIOUS_APIC_VECTOR; |
390 | apic_write_around(APIC_SPIV, value); | 389 | apic_write(APIC_SPIV, value); |
391 | 390 | ||
392 | /* | 391 | /* |
393 | * Set up LVT0, LVT1: | 392 | * Set up LVT0, LVT1: |
@@ -407,7 +406,7 @@ void __cpuinit setup_local_APIC (void) | |||
407 | value = APIC_DM_EXTINT | APIC_LVT_MASKED; | 406 | value = APIC_DM_EXTINT | APIC_LVT_MASKED; |
408 | apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id()); | 407 | apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id()); |
409 | } | 408 | } |
410 | apic_write_around(APIC_LVT0, value); | 409 | apic_write(APIC_LVT0, value); |
411 | 410 | ||
412 | /* | 411 | /* |
413 | * only the BP should see the LINT1 NMI signal, obviously. | 412 | * only the BP should see the LINT1 NMI signal, obviously. |
@@ -416,14 +415,14 @@ void __cpuinit setup_local_APIC (void) | |||
416 | value = APIC_DM_NMI; | 415 | value = APIC_DM_NMI; |
417 | else | 416 | else |
418 | value = APIC_DM_NMI | APIC_LVT_MASKED; | 417 | value = APIC_DM_NMI | APIC_LVT_MASKED; |
419 | apic_write_around(APIC_LVT1, value); | 418 | apic_write(APIC_LVT1, value); |
420 | 419 | ||
421 | { | 420 | { |
422 | unsigned oldvalue; | 421 | unsigned oldvalue; |
423 | maxlvt = get_maxlvt(); | 422 | maxlvt = get_maxlvt(); |
424 | oldvalue = apic_read(APIC_ESR); | 423 | oldvalue = apic_read(APIC_ESR); |
425 | value = ERROR_APIC_VECTOR; // enables sending errors | 424 | value = ERROR_APIC_VECTOR; // enables sending errors |
426 | apic_write_around(APIC_LVTERR, value); | 425 | apic_write(APIC_LVTERR, value); |
427 | /* | 426 | /* |
428 | * spec says clear errors after enabling vector. | 427 | * spec says clear errors after enabling vector. |
429 | */ | 428 | */ |
@@ -660,20 +659,25 @@ void __init init_apic_mappings(void) | |||
660 | static void __setup_APIC_LVTT(unsigned int clocks) | 659 | static void __setup_APIC_LVTT(unsigned int clocks) |
661 | { | 660 | { |
662 | unsigned int lvtt_value, tmp_value, ver; | 661 | unsigned int lvtt_value, tmp_value, ver; |
662 | int cpu = smp_processor_id(); | ||
663 | 663 | ||
664 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | 664 | ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
665 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; | 665 | lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; |
666 | apic_write_around(APIC_LVTT, lvtt_value); | 666 | |
667 | if (cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) | ||
668 | lvtt_value |= APIC_LVT_MASKED; | ||
669 | |||
670 | apic_write(APIC_LVTT, lvtt_value); | ||
667 | 671 | ||
668 | /* | 672 | /* |
669 | * Divide PICLK by 16 | 673 | * Divide PICLK by 16 |
670 | */ | 674 | */ |
671 | tmp_value = apic_read(APIC_TDCR); | 675 | tmp_value = apic_read(APIC_TDCR); |
672 | apic_write_around(APIC_TDCR, (tmp_value | 676 | apic_write(APIC_TDCR, (tmp_value |
673 | & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) | 677 | & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
674 | | APIC_TDR_DIV_16); | 678 | | APIC_TDR_DIV_16); |
675 | 679 | ||
676 | apic_write_around(APIC_TMICT, clocks/APIC_DIVISOR); | 680 | apic_write(APIC_TMICT, clocks/APIC_DIVISOR); |
677 | } | 681 | } |
678 | 682 | ||
679 | static void setup_APIC_timer(unsigned int clocks) | 683 | static void setup_APIC_timer(unsigned int clocks) |
@@ -682,12 +686,6 @@ static void setup_APIC_timer(unsigned int clocks) | |||
682 | 686 | ||
683 | local_irq_save(flags); | 687 | local_irq_save(flags); |
684 | 688 | ||
685 | /* For some reasons this doesn't work on Simics, so fake it for now */ | ||
686 | if (!strstr(boot_cpu_data.x86_model_id, "Screwdriver")) { | ||
687 | __setup_APIC_LVTT(clocks); | ||
688 | return; | ||
689 | } | ||
690 | |||
691 | /* wait for irq slice */ | 689 | /* wait for irq slice */ |
692 | if (vxtime.hpet_address) { | 690 | if (vxtime.hpet_address) { |
693 | int trigger = hpet_readl(HPET_T0_CMP); | 691 | int trigger = hpet_readl(HPET_T0_CMP); |
@@ -700,7 +698,7 @@ static void setup_APIC_timer(unsigned int clocks) | |||
700 | outb_p(0x00, 0x43); | 698 | outb_p(0x00, 0x43); |
701 | c2 = inb_p(0x40); | 699 | c2 = inb_p(0x40); |
702 | c2 |= inb_p(0x40) << 8; | 700 | c2 |= inb_p(0x40) << 8; |
703 | do { | 701 | do { |
704 | c1 = c2; | 702 | c1 = c2; |
705 | outb_p(0x00, 0x43); | 703 | outb_p(0x00, 0x43); |
706 | c2 = inb_p(0x40); | 704 | c2 = inb_p(0x40); |
@@ -785,52 +783,68 @@ void __cpuinit setup_secondary_APIC_clock(void) | |||
785 | local_irq_enable(); | 783 | local_irq_enable(); |
786 | } | 784 | } |
787 | 785 | ||
788 | void __cpuinit disable_APIC_timer(void) | 786 | void disable_APIC_timer(void) |
789 | { | 787 | { |
790 | if (using_apic_timer) { | 788 | if (using_apic_timer) { |
791 | unsigned long v; | 789 | unsigned long v; |
792 | 790 | ||
793 | v = apic_read(APIC_LVTT); | 791 | v = apic_read(APIC_LVTT); |
794 | apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED); | 792 | apic_write(APIC_LVTT, v | APIC_LVT_MASKED); |
795 | } | 793 | } |
796 | } | 794 | } |
797 | 795 | ||
798 | void enable_APIC_timer(void) | 796 | void enable_APIC_timer(void) |
799 | { | 797 | { |
800 | if (using_apic_timer) { | 798 | int cpu = smp_processor_id(); |
799 | |||
800 | if (using_apic_timer && | ||
801 | !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) { | ||
801 | unsigned long v; | 802 | unsigned long v; |
802 | 803 | ||
803 | v = apic_read(APIC_LVTT); | 804 | v = apic_read(APIC_LVTT); |
804 | apic_write_around(APIC_LVTT, v & ~APIC_LVT_MASKED); | 805 | apic_write(APIC_LVTT, v & ~APIC_LVT_MASKED); |
805 | } | 806 | } |
806 | } | 807 | } |
807 | 808 | ||
808 | /* | 809 | void switch_APIC_timer_to_ipi(void *cpumask) |
809 | * the frequency of the profiling timer can be changed | ||
810 | * by writing a multiplier value into /proc/profile. | ||
811 | */ | ||
812 | int setup_profiling_timer(unsigned int multiplier) | ||
813 | { | 810 | { |
814 | int i; | 811 | cpumask_t mask = *(cpumask_t *)cpumask; |
812 | int cpu = smp_processor_id(); | ||
815 | 813 | ||
816 | /* | 814 | if (cpu_isset(cpu, mask) && |
817 | * Sanity check. [at least 500 APIC cycles should be | 815 | !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) { |
818 | * between APIC interrupts as a rule of thumb, to avoid | 816 | disable_APIC_timer(); |
819 | * irqs flooding us] | 817 | cpu_set(cpu, timer_interrupt_broadcast_ipi_mask); |
820 | */ | 818 | } |
821 | if ( (!multiplier) || (calibration_result/multiplier < 500)) | 819 | } |
822 | return -EINVAL; | 820 | EXPORT_SYMBOL(switch_APIC_timer_to_ipi); |
823 | |||
824 | /* | ||
825 | * Set the new multiplier for each CPU. CPUs don't start using the | ||
826 | * new values until the next timer interrupt in which they do process | ||
827 | * accounting. At that time they also adjust their APIC timers | ||
828 | * accordingly. | ||
829 | */ | ||
830 | for (i = 0; i < NR_CPUS; ++i) | ||
831 | per_cpu(prof_multiplier, i) = multiplier; | ||
832 | 821 | ||
833 | return 0; | 822 | void smp_send_timer_broadcast_ipi(void) |
823 | { | ||
824 | cpumask_t mask; | ||
825 | |||
826 | cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask); | ||
827 | if (!cpus_empty(mask)) { | ||
828 | send_IPI_mask(mask, LOCAL_TIMER_VECTOR); | ||
829 | } | ||
830 | } | ||
831 | |||
832 | void switch_ipi_to_APIC_timer(void *cpumask) | ||
833 | { | ||
834 | cpumask_t mask = *(cpumask_t *)cpumask; | ||
835 | int cpu = smp_processor_id(); | ||
836 | |||
837 | if (cpu_isset(cpu, mask) && | ||
838 | cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) { | ||
839 | cpu_clear(cpu, timer_interrupt_broadcast_ipi_mask); | ||
840 | enable_APIC_timer(); | ||
841 | } | ||
842 | } | ||
843 | EXPORT_SYMBOL(switch_ipi_to_APIC_timer); | ||
844 | |||
845 | int setup_profiling_timer(unsigned int multiplier) | ||
846 | { | ||
847 | return -EINVAL; | ||
834 | } | 848 | } |
835 | 849 | ||
836 | #ifdef CONFIG_X86_MCE_AMD | 850 | #ifdef CONFIG_X86_MCE_AMD |
@@ -857,32 +871,10 @@ void setup_threshold_lvt(unsigned long lvt_off) | |||
857 | 871 | ||
858 | void smp_local_timer_interrupt(struct pt_regs *regs) | 872 | void smp_local_timer_interrupt(struct pt_regs *regs) |
859 | { | 873 | { |
860 | int cpu = smp_processor_id(); | ||
861 | |||
862 | profile_tick(CPU_PROFILING, regs); | 874 | profile_tick(CPU_PROFILING, regs); |
863 | if (--per_cpu(prof_counter, cpu) <= 0) { | ||
864 | /* | ||
865 | * The multiplier may have changed since the last time we got | ||
866 | * to this point as a result of the user writing to | ||
867 | * /proc/profile. In this case we need to adjust the APIC | ||
868 | * timer accordingly. | ||
869 | * | ||
870 | * Interrupts are already masked off at this point. | ||
871 | */ | ||
872 | per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu); | ||
873 | if (per_cpu(prof_counter, cpu) != | ||
874 | per_cpu(prof_old_multiplier, cpu)) { | ||
875 | __setup_APIC_LVTT(calibration_result/ | ||
876 | per_cpu(prof_counter, cpu)); | ||
877 | per_cpu(prof_old_multiplier, cpu) = | ||
878 | per_cpu(prof_counter, cpu); | ||
879 | } | ||
880 | |||
881 | #ifdef CONFIG_SMP | 875 | #ifdef CONFIG_SMP |
882 | update_process_times(user_mode(regs)); | 876 | update_process_times(user_mode(regs)); |
883 | #endif | 877 | #endif |
884 | } | ||
885 | |||
886 | /* | 878 | /* |
887 | * We take the 'long' return path, and there every subsystem | 879 | * We take the 'long' return path, and there every subsystem |
888 | * grabs the appropriate locks (kernel lock/ irq lock). | 880 | * grabs the appropriate locks (kernel lock/ irq lock). |
@@ -920,6 +912,7 @@ void smp_apic_timer_interrupt(struct pt_regs *regs) | |||
920 | * Besides, if we don't timer interrupts ignore the global | 912 | * Besides, if we don't timer interrupts ignore the global |
921 | * interrupt lock, which is the WrongThing (tm) to do. | 913 | * interrupt lock, which is the WrongThing (tm) to do. |
922 | */ | 914 | */ |
915 | exit_idle(); | ||
923 | irq_enter(); | 916 | irq_enter(); |
924 | smp_local_timer_interrupt(regs); | 917 | smp_local_timer_interrupt(regs); |
925 | irq_exit(); | 918 | irq_exit(); |
@@ -979,6 +972,7 @@ __init int oem_force_hpet_timer(void) | |||
979 | asmlinkage void smp_spurious_interrupt(void) | 972 | asmlinkage void smp_spurious_interrupt(void) |
980 | { | 973 | { |
981 | unsigned int v; | 974 | unsigned int v; |
975 | exit_idle(); | ||
982 | irq_enter(); | 976 | irq_enter(); |
983 | /* | 977 | /* |
984 | * Check if this really is a spurious interrupt and ACK it | 978 | * Check if this really is a spurious interrupt and ACK it |
@@ -1014,6 +1008,7 @@ asmlinkage void smp_error_interrupt(void) | |||
1014 | { | 1008 | { |
1015 | unsigned int v, v1; | 1009 | unsigned int v, v1; |
1016 | 1010 | ||
1011 | exit_idle(); | ||
1017 | irq_enter(); | 1012 | irq_enter(); |
1018 | /* First tickle the hardware, only then report what went on. -- REW */ | 1013 | /* First tickle the hardware, only then report what went on. -- REW */ |
1019 | v = apic_read(APIC_ESR); | 1014 | v = apic_read(APIC_ESR); |
@@ -1060,7 +1055,7 @@ int __init APIC_init_uniprocessor (void) | |||
1060 | connect_bsp_APIC(); | 1055 | connect_bsp_APIC(); |
1061 | 1056 | ||
1062 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); | 1057 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); |
1063 | apic_write_around(APIC_ID, boot_cpu_id); | 1058 | apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id)); |
1064 | 1059 | ||
1065 | setup_local_APIC(); | 1060 | setup_local_APIC(); |
1066 | 1061 | ||
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c index aaa6d3833517..cfb4f9cebea4 100644 --- a/arch/x86_64/kernel/asm-offsets.c +++ b/arch/x86_64/kernel/asm-offsets.c | |||
@@ -33,6 +33,7 @@ int main(void) | |||
33 | ENTRY(flags); | 33 | ENTRY(flags); |
34 | ENTRY(addr_limit); | 34 | ENTRY(addr_limit); |
35 | ENTRY(preempt_count); | 35 | ENTRY(preempt_count); |
36 | ENTRY(status); | ||
36 | BLANK(); | 37 | BLANK(); |
37 | #undef ENTRY | 38 | #undef ENTRY |
38 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) | 39 | #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) |
@@ -64,5 +65,9 @@ int main(void) | |||
64 | DEFINE(pbe_address, offsetof(struct pbe, address)); | 65 | DEFINE(pbe_address, offsetof(struct pbe, address)); |
65 | DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); | 66 | DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); |
66 | DEFINE(pbe_next, offsetof(struct pbe, next)); | 67 | DEFINE(pbe_next, offsetof(struct pbe, next)); |
68 | BLANK(); | ||
69 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
70 | DEFINE(DEBUG_IST, DEBUG_STACK); | ||
71 | #endif | ||
67 | return 0; | 72 | return 0; |
68 | } | 73 | } |
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c index 9cd968dd0f5a..6dffb498ccd7 100644 --- a/arch/x86_64/kernel/early_printk.c +++ b/arch/x86_64/kernel/early_printk.c | |||
@@ -216,7 +216,7 @@ void early_printk(const char *fmt, ...) | |||
216 | va_end(ap); | 216 | va_end(ap); |
217 | } | 217 | } |
218 | 218 | ||
219 | static int keep_early; | 219 | static int __initdata keep_early; |
220 | 220 | ||
221 | int __init setup_early_printk(char *opt) | 221 | int __init setup_early_printk(char *opt) |
222 | { | 222 | { |
@@ -226,8 +226,6 @@ int __init setup_early_printk(char *opt) | |||
226 | if (early_console_initialized) | 226 | if (early_console_initialized) |
227 | return -1; | 227 | return -1; |
228 | 228 | ||
229 | opt = strchr(opt, '=') + 1; | ||
230 | |||
231 | strlcpy(buf,opt,sizeof(buf)); | 229 | strlcpy(buf,opt,sizeof(buf)); |
232 | space = strchr(buf, ' '); | 230 | space = strchr(buf, ' '); |
233 | if (space) | 231 | if (space) |
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 9ff42041bb6b..632fc0f59fcc 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -313,6 +313,7 @@ int_with_check: | |||
313 | movl threadinfo_flags(%rcx),%edx | 313 | movl threadinfo_flags(%rcx),%edx |
314 | andl %edi,%edx | 314 | andl %edi,%edx |
315 | jnz int_careful | 315 | jnz int_careful |
316 | andl $~TS_COMPAT,threadinfo_status(%rcx) | ||
316 | jmp retint_swapgs | 317 | jmp retint_swapgs |
317 | 318 | ||
318 | /* Either reschedule or signal or syscall exit tracking needed. */ | 319 | /* Either reschedule or signal or syscall exit tracking needed. */ |
@@ -673,7 +674,10 @@ ENTRY(spurious_interrupt) | |||
673 | 674 | ||
674 | /* error code is on the stack already */ | 675 | /* error code is on the stack already */ |
675 | /* handle NMI like exceptions that can happen everywhere */ | 676 | /* handle NMI like exceptions that can happen everywhere */ |
676 | .macro paranoidentry sym | 677 | #ifndef DEBUG_IST |
678 | # define DEBUG_IST 0 | ||
679 | #endif | ||
680 | .macro paranoidentry sym, ist=0 | ||
677 | SAVE_ALL | 681 | SAVE_ALL |
678 | cld | 682 | cld |
679 | movl $1,%ebx | 683 | movl $1,%ebx |
@@ -683,10 +687,20 @@ ENTRY(spurious_interrupt) | |||
683 | js 1f | 687 | js 1f |
684 | swapgs | 688 | swapgs |
685 | xorl %ebx,%ebx | 689 | xorl %ebx,%ebx |
686 | 1: movq %rsp,%rdi | 690 | 1: |
691 | .if \ist | ||
692 | movq %gs:pda_data_offset, %rbp | ||
693 | .endif | ||
694 | movq %rsp,%rdi | ||
687 | movq ORIG_RAX(%rsp),%rsi | 695 | movq ORIG_RAX(%rsp),%rsi |
688 | movq $-1,ORIG_RAX(%rsp) | 696 | movq $-1,ORIG_RAX(%rsp) |
697 | .if \ist | ||
698 | subq $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) | ||
699 | .endif | ||
689 | call \sym | 700 | call \sym |
701 | .if \ist | ||
702 | addq $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp) | ||
703 | .endif | ||
690 | cli | 704 | cli |
691 | .endm | 705 | .endm |
692 | 706 | ||
@@ -754,7 +768,7 @@ error_exit: | |||
754 | jnz retint_careful | 768 | jnz retint_careful |
755 | swapgs | 769 | swapgs |
756 | RESTORE_ARGS 0,8,0 | 770 | RESTORE_ARGS 0,8,0 |
757 | iretq | 771 | jmp iret_label |
758 | CFI_ENDPROC | 772 | CFI_ENDPROC |
759 | 773 | ||
760 | error_kernelspace: | 774 | error_kernelspace: |
@@ -904,7 +918,7 @@ KPROBE_ENTRY(debug) | |||
904 | INTR_FRAME | 918 | INTR_FRAME |
905 | pushq $0 | 919 | pushq $0 |
906 | CFI_ADJUST_CFA_OFFSET 8 | 920 | CFI_ADJUST_CFA_OFFSET 8 |
907 | paranoidentry do_debug | 921 | paranoidentry do_debug, DEBUG_IST |
908 | jmp paranoid_exit | 922 | jmp paranoid_exit |
909 | CFI_ENDPROC | 923 | CFI_ENDPROC |
910 | .previous .text | 924 | .previous .text |
@@ -959,7 +973,12 @@ paranoid_schedule: | |||
959 | CFI_ENDPROC | 973 | CFI_ENDPROC |
960 | 974 | ||
961 | KPROBE_ENTRY(int3) | 975 | KPROBE_ENTRY(int3) |
962 | zeroentry do_int3 | 976 | INTR_FRAME |
977 | pushq $0 | ||
978 | CFI_ADJUST_CFA_OFFSET 8 | ||
979 | paranoidentry do_int3, DEBUG_IST | ||
980 | jmp paranoid_exit | ||
981 | CFI_ENDPROC | ||
963 | .previous .text | 982 | .previous .text |
964 | 983 | ||
965 | ENTRY(overflow) | 984 | ENTRY(overflow) |
@@ -1021,23 +1040,18 @@ ENTRY(machine_check) | |||
1021 | CFI_ENDPROC | 1040 | CFI_ENDPROC |
1022 | #endif | 1041 | #endif |
1023 | 1042 | ||
1024 | ENTRY(call_debug) | ||
1025 | zeroentry do_call_debug | ||
1026 | |||
1027 | ENTRY(call_softirq) | 1043 | ENTRY(call_softirq) |
1028 | CFI_STARTPROC | 1044 | CFI_STARTPROC |
1029 | movq %gs:pda_irqstackptr,%rax | 1045 | movq %gs:pda_irqstackptr,%rax |
1030 | pushq %r15 | 1046 | movq %rsp,%rdx |
1031 | CFI_ADJUST_CFA_OFFSET 8 | 1047 | CFI_DEF_CFA_REGISTER rdx |
1032 | movq %rsp,%r15 | ||
1033 | CFI_DEF_CFA_REGISTER r15 | ||
1034 | incl %gs:pda_irqcount | 1048 | incl %gs:pda_irqcount |
1035 | cmove %rax,%rsp | 1049 | cmove %rax,%rsp |
1050 | pushq %rdx | ||
1051 | /*todo CFI_DEF_CFA_EXPRESSION ...*/ | ||
1036 | call __do_softirq | 1052 | call __do_softirq |
1037 | movq %r15,%rsp | 1053 | popq %rsp |
1038 | CFI_DEF_CFA_REGISTER rsp | 1054 | CFI_DEF_CFA_REGISTER rsp |
1039 | decl %gs:pda_irqcount | 1055 | decl %gs:pda_irqcount |
1040 | popq %r15 | ||
1041 | CFI_ADJUST_CFA_OFFSET -8 | ||
1042 | ret | 1056 | ret |
1043 | CFI_ENDPROC | 1057 | CFI_ENDPROC |
diff --git a/arch/x86_64/kernel/genapic_cluster.c b/arch/x86_64/kernel/genapic_cluster.c index a472d62f899a..43fcf62fef0f 100644 --- a/arch/x86_64/kernel/genapic_cluster.c +++ b/arch/x86_64/kernel/genapic_cluster.c | |||
@@ -72,14 +72,11 @@ static void cluster_send_IPI_mask(cpumask_t mask, int vector) | |||
72 | static void cluster_send_IPI_allbutself(int vector) | 72 | static void cluster_send_IPI_allbutself(int vector) |
73 | { | 73 | { |
74 | cpumask_t mask = cpu_online_map; | 74 | cpumask_t mask = cpu_online_map; |
75 | int me = get_cpu(); /* Ensure we are not preempted when we clear */ | ||
76 | 75 | ||
77 | cpu_clear(me, mask); | 76 | cpu_clear(smp_processor_id(), mask); |
78 | 77 | ||
79 | if (!cpus_empty(mask)) | 78 | if (!cpus_empty(mask)) |
80 | cluster_send_IPI_mask(mask, vector); | 79 | cluster_send_IPI_mask(mask, vector); |
81 | |||
82 | put_cpu(); | ||
83 | } | 80 | } |
84 | 81 | ||
85 | static void cluster_send_IPI_all(int vector) | 82 | static void cluster_send_IPI_all(int vector) |
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c index 9da3edb799ea..1a2ab825be98 100644 --- a/arch/x86_64/kernel/genapic_flat.c +++ b/arch/x86_64/kernel/genapic_flat.c | |||
@@ -83,12 +83,11 @@ static void flat_send_IPI_allbutself(int vector) | |||
83 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); | 83 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); |
84 | #else | 84 | #else |
85 | cpumask_t allbutme = cpu_online_map; | 85 | cpumask_t allbutme = cpu_online_map; |
86 | int me = get_cpu(); /* Ensure we are not preempted when we clear */ | 86 | |
87 | cpu_clear(me, allbutme); | 87 | cpu_clear(smp_processor_id(), allbutme); |
88 | 88 | ||
89 | if (!cpus_empty(allbutme)) | 89 | if (!cpus_empty(allbutme)) |
90 | flat_send_IPI_mask(allbutme, vector); | 90 | flat_send_IPI_mask(allbutme, vector); |
91 | put_cpu(); | ||
92 | #endif | 91 | #endif |
93 | } | 92 | } |
94 | 93 | ||
@@ -149,10 +148,9 @@ static void physflat_send_IPI_mask(cpumask_t cpumask, int vector) | |||
149 | static void physflat_send_IPI_allbutself(int vector) | 148 | static void physflat_send_IPI_allbutself(int vector) |
150 | { | 149 | { |
151 | cpumask_t allbutme = cpu_online_map; | 150 | cpumask_t allbutme = cpu_online_map; |
152 | int me = get_cpu(); | 151 | |
153 | cpu_clear(me, allbutme); | 152 | cpu_clear(smp_processor_id(), allbutme); |
154 | physflat_send_IPI_mask(allbutme, vector); | 153 | physflat_send_IPI_mask(allbutme, vector); |
155 | put_cpu(); | ||
156 | } | 154 | } |
157 | 155 | ||
158 | static void physflat_send_IPI_all(int vector) | 156 | static void physflat_send_IPI_all(int vector) |
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S index 15290968e49d..38fc3d5112e7 100644 --- a/arch/x86_64/kernel/head.S +++ b/arch/x86_64/kernel/head.S | |||
@@ -379,14 +379,14 @@ gdt: | |||
379 | * Also sysret mandates a special GDT layout | 379 | * Also sysret mandates a special GDT layout |
380 | */ | 380 | */ |
381 | 381 | ||
382 | .align L1_CACHE_BYTES | 382 | .align PAGE_SIZE |
383 | 383 | ||
384 | /* The TLS descriptors are currently at a different place compared to i386. | 384 | /* The TLS descriptors are currently at a different place compared to i386. |
385 | Hopefully nobody expects them at a fixed place (Wine?) */ | 385 | Hopefully nobody expects them at a fixed place (Wine?) */ |
386 | 386 | ||
387 | ENTRY(cpu_gdt_table) | 387 | ENTRY(cpu_gdt_table) |
388 | .quad 0x0000000000000000 /* NULL descriptor */ | 388 | .quad 0x0000000000000000 /* NULL descriptor */ |
389 | .quad 0x008f9a000000ffff /* __KERNEL_COMPAT32_CS */ | 389 | .quad 0x0 /* unused */ |
390 | .quad 0x00af9a000000ffff /* __KERNEL_CS */ | 390 | .quad 0x00af9a000000ffff /* __KERNEL_CS */ |
391 | .quad 0x00cf92000000ffff /* __KERNEL_DS */ | 391 | .quad 0x00cf92000000ffff /* __KERNEL_DS */ |
392 | .quad 0x00cffa000000ffff /* __USER32_CS */ | 392 | .quad 0x00cffa000000ffff /* __USER32_CS */ |
@@ -396,15 +396,15 @@ ENTRY(cpu_gdt_table) | |||
396 | .quad 0,0 /* TSS */ | 396 | .quad 0,0 /* TSS */ |
397 | .quad 0,0 /* LDT */ | 397 | .quad 0,0 /* LDT */ |
398 | .quad 0,0,0 /* three TLS descriptors */ | 398 | .quad 0,0,0 /* three TLS descriptors */ |
399 | .quad 0x00009a000000ffff /* __KERNEL16_CS - 16bit PM for S3 wakeup. */ | 399 | .quad 0 /* unused */ |
400 | /* base must be patched for real base address. */ | ||
401 | gdt_end: | 400 | gdt_end: |
402 | /* asm/segment.h:GDT_ENTRIES must match this */ | 401 | /* asm/segment.h:GDT_ENTRIES must match this */ |
403 | /* This should be a multiple of the cache line size */ | 402 | /* This should be a multiple of the cache line size */ |
404 | /* GDTs of other CPUs: */ | 403 | /* GDTs of other CPUs are now dynamically allocated */ |
405 | .fill (GDT_SIZE * NR_CPUS) - (gdt_end - cpu_gdt_table) | 404 | |
405 | /* zero the remaining page */ | ||
406 | .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0 | ||
406 | 407 | ||
407 | .align L1_CACHE_BYTES | ||
408 | ENTRY(idt_table) | 408 | ENTRY(idt_table) |
409 | .rept 256 | 409 | .rept 256 |
410 | .quad 0 | 410 | .quad 0 |
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c index b675c5add01e..cea20a66c150 100644 --- a/arch/x86_64/kernel/head64.c +++ b/arch/x86_64/kernel/head64.c | |||
@@ -92,6 +92,9 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
92 | memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t)); | 92 | memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t)); |
93 | asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt))); | 93 | asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt))); |
94 | 94 | ||
95 | for (i = 0; i < NR_CPUS; i++) | ||
96 | cpu_pda(i) = &boot_cpu_pda[i]; | ||
97 | |||
95 | pda_init(0); | 98 | pda_init(0); |
96 | copy_bootdata(real_mode_data); | 99 | copy_bootdata(real_mode_data); |
97 | #ifdef CONFIG_SMP | 100 | #ifdef CONFIG_SMP |
@@ -99,7 +102,7 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
99 | #endif | 102 | #endif |
100 | s = strstr(saved_command_line, "earlyprintk="); | 103 | s = strstr(saved_command_line, "earlyprintk="); |
101 | if (s != NULL) | 104 | if (s != NULL) |
102 | setup_early_printk(s); | 105 | setup_early_printk(strchr(s, '=') + 1); |
103 | #ifdef CONFIG_NUMA | 106 | #ifdef CONFIG_NUMA |
104 | s = strstr(saved_command_line, "numa="); | 107 | s = strstr(saved_command_line, "numa="); |
105 | if (s != NULL) | 108 | if (s != NULL) |
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c index 6e5101ad3d1a..b61965f0fb34 100644 --- a/arch/x86_64/kernel/i8259.c +++ b/arch/x86_64/kernel/i8259.c | |||
@@ -549,10 +549,9 @@ void __init init_IRQ(void) | |||
549 | int vector = FIRST_EXTERNAL_VECTOR + i; | 549 | int vector = FIRST_EXTERNAL_VECTOR + i; |
550 | if (i >= NR_IRQS) | 550 | if (i >= NR_IRQS) |
551 | break; | 551 | break; |
552 | if (vector != IA32_SYSCALL_VECTOR && vector != KDB_VECTOR) { | 552 | if (vector != IA32_SYSCALL_VECTOR) |
553 | set_intr_gate(vector, interrupt[i]); | 553 | set_intr_gate(vector, interrupt[i]); |
554 | } | 554 | } |
555 | } | ||
556 | 555 | ||
557 | #ifdef CONFIG_SMP | 556 | #ifdef CONFIG_SMP |
558 | /* | 557 | /* |
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c index 97154ab058b4..e8cf44ef8778 100644 --- a/arch/x86_64/kernel/io_apic.c +++ b/arch/x86_64/kernel/io_apic.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/proto.h> | 37 | #include <asm/proto.h> |
38 | #include <asm/mach_apic.h> | 38 | #include <asm/mach_apic.h> |
39 | #include <asm/acpi.h> | 39 | #include <asm/acpi.h> |
40 | #include <asm/dma.h> | ||
40 | 41 | ||
41 | #define __apicdebuginit __init | 42 | #define __apicdebuginit __init |
42 | 43 | ||
@@ -46,6 +47,9 @@ static int no_timer_check; | |||
46 | 47 | ||
47 | int disable_timer_pin_1 __initdata; | 48 | int disable_timer_pin_1 __initdata; |
48 | 49 | ||
50 | /* Where if anywhere is the i8259 connect in external int mode */ | ||
51 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; | ||
52 | |||
49 | static DEFINE_SPINLOCK(ioapic_lock); | 53 | static DEFINE_SPINLOCK(ioapic_lock); |
50 | 54 | ||
51 | /* | 55 | /* |
@@ -260,9 +264,6 @@ __setup("apic", enable_ioapic_setup); | |||
260 | void __init check_ioapic(void) | 264 | void __init check_ioapic(void) |
261 | { | 265 | { |
262 | int num,slot,func; | 266 | int num,slot,func; |
263 | if (ioapic_force) | ||
264 | return; | ||
265 | |||
266 | /* Poor man's PCI discovery */ | 267 | /* Poor man's PCI discovery */ |
267 | for (num = 0; num < 32; num++) { | 268 | for (num = 0; num < 32; num++) { |
268 | for (slot = 0; slot < 32; slot++) { | 269 | for (slot = 0; slot < 32; slot++) { |
@@ -284,7 +285,7 @@ void __init check_ioapic(void) | |||
284 | switch (vendor) { | 285 | switch (vendor) { |
285 | case PCI_VENDOR_ID_VIA: | 286 | case PCI_VENDOR_ID_VIA: |
286 | #ifdef CONFIG_GART_IOMMU | 287 | #ifdef CONFIG_GART_IOMMU |
287 | if ((end_pfn >= (0xffffffff>>PAGE_SHIFT) || | 288 | if ((end_pfn > MAX_DMA32_PFN || |
288 | force_iommu) && | 289 | force_iommu) && |
289 | !iommu_aperture_allowed) { | 290 | !iommu_aperture_allowed) { |
290 | printk(KERN_INFO | 291 | printk(KERN_INFO |
@@ -363,7 +364,7 @@ static int find_irq_entry(int apic, int pin, int type) | |||
363 | /* | 364 | /* |
364 | * Find the pin to which IRQ[irq] (ISA) is connected | 365 | * Find the pin to which IRQ[irq] (ISA) is connected |
365 | */ | 366 | */ |
366 | static int find_isa_irq_pin(int irq, int type) | 367 | static int __init find_isa_irq_pin(int irq, int type) |
367 | { | 368 | { |
368 | int i; | 369 | int i; |
369 | 370 | ||
@@ -381,6 +382,31 @@ static int find_isa_irq_pin(int irq, int type) | |||
381 | return -1; | 382 | return -1; |
382 | } | 383 | } |
383 | 384 | ||
385 | static int __init find_isa_irq_apic(int irq, int type) | ||
386 | { | ||
387 | int i; | ||
388 | |||
389 | for (i = 0; i < mp_irq_entries; i++) { | ||
390 | int lbus = mp_irqs[i].mpc_srcbus; | ||
391 | |||
392 | if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA || | ||
393 | mp_bus_id_to_type[lbus] == MP_BUS_EISA || | ||
394 | mp_bus_id_to_type[lbus] == MP_BUS_MCA) && | ||
395 | (mp_irqs[i].mpc_irqtype == type) && | ||
396 | (mp_irqs[i].mpc_srcbusirq == irq)) | ||
397 | break; | ||
398 | } | ||
399 | if (i < mp_irq_entries) { | ||
400 | int apic; | ||
401 | for(apic = 0; apic < nr_ioapics; apic++) { | ||
402 | if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic) | ||
403 | return apic; | ||
404 | } | ||
405 | } | ||
406 | |||
407 | return -1; | ||
408 | } | ||
409 | |||
384 | /* | 410 | /* |
385 | * Find a specific PCI IRQ entry. | 411 | * Find a specific PCI IRQ entry. |
386 | * Not an __init, possibly needed by modules | 412 | * Not an __init, possibly needed by modules |
@@ -874,7 +900,7 @@ static void __init setup_IO_APIC_irqs(void) | |||
874 | * Set up the 8259A-master output pin as broadcast to all | 900 | * Set up the 8259A-master output pin as broadcast to all |
875 | * CPUs. | 901 | * CPUs. |
876 | */ | 902 | */ |
877 | static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector) | 903 | static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector) |
878 | { | 904 | { |
879 | struct IO_APIC_route_entry entry; | 905 | struct IO_APIC_route_entry entry; |
880 | unsigned long flags; | 906 | unsigned long flags; |
@@ -884,7 +910,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector) | |||
884 | disable_8259A_irq(0); | 910 | disable_8259A_irq(0); |
885 | 911 | ||
886 | /* mask LVT0 */ | 912 | /* mask LVT0 */ |
887 | apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); | 913 | apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); |
888 | 914 | ||
889 | /* | 915 | /* |
890 | * We use logical delivery to get the timer IRQ | 916 | * We use logical delivery to get the timer IRQ |
@@ -908,8 +934,8 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector) | |||
908 | * Add it to the IO-APIC irq-routing table: | 934 | * Add it to the IO-APIC irq-routing table: |
909 | */ | 935 | */ |
910 | spin_lock_irqsave(&ioapic_lock, flags); | 936 | spin_lock_irqsave(&ioapic_lock, flags); |
911 | io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1)); | 937 | io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1)); |
912 | io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0)); | 938 | io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0)); |
913 | spin_unlock_irqrestore(&ioapic_lock, flags); | 939 | spin_unlock_irqrestore(&ioapic_lock, flags); |
914 | 940 | ||
915 | enable_8259A_irq(0); | 941 | enable_8259A_irq(0); |
@@ -1188,7 +1214,8 @@ void __apicdebuginit print_PIC(void) | |||
1188 | static void __init enable_IO_APIC(void) | 1214 | static void __init enable_IO_APIC(void) |
1189 | { | 1215 | { |
1190 | union IO_APIC_reg_01 reg_01; | 1216 | union IO_APIC_reg_01 reg_01; |
1191 | int i; | 1217 | int i8259_apic, i8259_pin; |
1218 | int i, apic; | ||
1192 | unsigned long flags; | 1219 | unsigned long flags; |
1193 | 1220 | ||
1194 | for (i = 0; i < PIN_MAP_SIZE; i++) { | 1221 | for (i = 0; i < PIN_MAP_SIZE; i++) { |
@@ -1202,11 +1229,48 @@ static void __init enable_IO_APIC(void) | |||
1202 | /* | 1229 | /* |
1203 | * The number of IO-APIC IRQ registers (== #pins): | 1230 | * The number of IO-APIC IRQ registers (== #pins): |
1204 | */ | 1231 | */ |
1205 | for (i = 0; i < nr_ioapics; i++) { | 1232 | for (apic = 0; apic < nr_ioapics; apic++) { |
1206 | spin_lock_irqsave(&ioapic_lock, flags); | 1233 | spin_lock_irqsave(&ioapic_lock, flags); |
1207 | reg_01.raw = io_apic_read(i, 1); | 1234 | reg_01.raw = io_apic_read(apic, 1); |
1208 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1235 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1209 | nr_ioapic_registers[i] = reg_01.bits.entries+1; | 1236 | nr_ioapic_registers[apic] = reg_01.bits.entries+1; |
1237 | } | ||
1238 | for(apic = 0; apic < nr_ioapics; apic++) { | ||
1239 | int pin; | ||
1240 | /* See if any of the pins is in ExtINT mode */ | ||
1241 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { | ||
1242 | struct IO_APIC_route_entry entry; | ||
1243 | spin_lock_irqsave(&ioapic_lock, flags); | ||
1244 | *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); | ||
1245 | *(((int *)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin); | ||
1246 | spin_unlock_irqrestore(&ioapic_lock, flags); | ||
1247 | |||
1248 | |||
1249 | /* If the interrupt line is enabled and in ExtInt mode | ||
1250 | * I have found the pin where the i8259 is connected. | ||
1251 | */ | ||
1252 | if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) { | ||
1253 | ioapic_i8259.apic = apic; | ||
1254 | ioapic_i8259.pin = pin; | ||
1255 | goto found_i8259; | ||
1256 | } | ||
1257 | } | ||
1258 | } | ||
1259 | found_i8259: | ||
1260 | /* Look to see what if the MP table has reported the ExtINT */ | ||
1261 | i8259_pin = find_isa_irq_pin(0, mp_ExtINT); | ||
1262 | i8259_apic = find_isa_irq_apic(0, mp_ExtINT); | ||
1263 | /* Trust the MP table if nothing is setup in the hardware */ | ||
1264 | if ((ioapic_i8259.pin == -1) && (i8259_pin >= 0)) { | ||
1265 | printk(KERN_WARNING "ExtINT not setup in hardware but reported by MP table\n"); | ||
1266 | ioapic_i8259.pin = i8259_pin; | ||
1267 | ioapic_i8259.apic = i8259_apic; | ||
1268 | } | ||
1269 | /* Complain if the MP table and the hardware disagree */ | ||
1270 | if (((ioapic_i8259.apic != i8259_apic) || (ioapic_i8259.pin != i8259_pin)) && | ||
1271 | (i8259_pin >= 0) && (ioapic_i8259.pin >= 0)) | ||
1272 | { | ||
1273 | printk(KERN_WARNING "ExtINT in hardware and MP table differ\n"); | ||
1210 | } | 1274 | } |
1211 | 1275 | ||
1212 | /* | 1276 | /* |
@@ -1220,7 +1284,6 @@ static void __init enable_IO_APIC(void) | |||
1220 | */ | 1284 | */ |
1221 | void disable_IO_APIC(void) | 1285 | void disable_IO_APIC(void) |
1222 | { | 1286 | { |
1223 | int pin; | ||
1224 | /* | 1287 | /* |
1225 | * Clear the IO-APIC before rebooting: | 1288 | * Clear the IO-APIC before rebooting: |
1226 | */ | 1289 | */ |
@@ -1231,8 +1294,7 @@ void disable_IO_APIC(void) | |||
1231 | * Put that IOAPIC in virtual wire mode | 1294 | * Put that IOAPIC in virtual wire mode |
1232 | * so legacy interrupts can be delivered. | 1295 | * so legacy interrupts can be delivered. |
1233 | */ | 1296 | */ |
1234 | pin = find_isa_irq_pin(0, mp_ExtINT); | 1297 | if (ioapic_i8259.pin != -1) { |
1235 | if (pin != -1) { | ||
1236 | struct IO_APIC_route_entry entry; | 1298 | struct IO_APIC_route_entry entry; |
1237 | unsigned long flags; | 1299 | unsigned long flags; |
1238 | 1300 | ||
@@ -1243,21 +1305,23 @@ void disable_IO_APIC(void) | |||
1243 | entry.polarity = 0; /* High */ | 1305 | entry.polarity = 0; /* High */ |
1244 | entry.delivery_status = 0; | 1306 | entry.delivery_status = 0; |
1245 | entry.dest_mode = 0; /* Physical */ | 1307 | entry.dest_mode = 0; /* Physical */ |
1246 | entry.delivery_mode = 7; /* ExtInt */ | 1308 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1247 | entry.vector = 0; | 1309 | entry.vector = 0; |
1248 | entry.dest.physical.physical_dest = 0; | 1310 | entry.dest.physical.physical_dest = |
1249 | 1311 | GET_APIC_ID(apic_read(APIC_ID)); | |
1250 | 1312 | ||
1251 | /* | 1313 | /* |
1252 | * Add it to the IO-APIC irq-routing table: | 1314 | * Add it to the IO-APIC irq-routing table: |
1253 | */ | 1315 | */ |
1254 | spin_lock_irqsave(&ioapic_lock, flags); | 1316 | spin_lock_irqsave(&ioapic_lock, flags); |
1255 | io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1)); | 1317 | io_apic_write(ioapic_i8259.apic, 0x11+2*ioapic_i8259.pin, |
1256 | io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0)); | 1318 | *(((int *)&entry)+1)); |
1319 | io_apic_write(ioapic_i8259.apic, 0x10+2*ioapic_i8259.pin, | ||
1320 | *(((int *)&entry)+0)); | ||
1257 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1321 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1258 | } | 1322 | } |
1259 | 1323 | ||
1260 | disconnect_bsp_APIC(pin != -1); | 1324 | disconnect_bsp_APIC(ioapic_i8259.pin != -1); |
1261 | } | 1325 | } |
1262 | 1326 | ||
1263 | /* | 1327 | /* |
@@ -1571,7 +1635,7 @@ static void enable_lapic_irq (unsigned int irq) | |||
1571 | unsigned long v; | 1635 | unsigned long v; |
1572 | 1636 | ||
1573 | v = apic_read(APIC_LVT0); | 1637 | v = apic_read(APIC_LVT0); |
1574 | apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED); | 1638 | apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED); |
1575 | } | 1639 | } |
1576 | 1640 | ||
1577 | static void disable_lapic_irq (unsigned int irq) | 1641 | static void disable_lapic_irq (unsigned int irq) |
@@ -1579,7 +1643,7 @@ static void disable_lapic_irq (unsigned int irq) | |||
1579 | unsigned long v; | 1643 | unsigned long v; |
1580 | 1644 | ||
1581 | v = apic_read(APIC_LVT0); | 1645 | v = apic_read(APIC_LVT0); |
1582 | apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); | 1646 | apic_write(APIC_LVT0, v | APIC_LVT_MASKED); |
1583 | } | 1647 | } |
1584 | 1648 | ||
1585 | static void ack_lapic_irq (unsigned int irq) | 1649 | static void ack_lapic_irq (unsigned int irq) |
@@ -1626,20 +1690,21 @@ static void setup_nmi (void) | |||
1626 | */ | 1690 | */ |
1627 | static inline void unlock_ExtINT_logic(void) | 1691 | static inline void unlock_ExtINT_logic(void) |
1628 | { | 1692 | { |
1629 | int pin, i; | 1693 | int apic, pin, i; |
1630 | struct IO_APIC_route_entry entry0, entry1; | 1694 | struct IO_APIC_route_entry entry0, entry1; |
1631 | unsigned char save_control, save_freq_select; | 1695 | unsigned char save_control, save_freq_select; |
1632 | unsigned long flags; | 1696 | unsigned long flags; |
1633 | 1697 | ||
1634 | pin = find_isa_irq_pin(8, mp_INT); | 1698 | pin = find_isa_irq_pin(8, mp_INT); |
1699 | apic = find_isa_irq_apic(8, mp_INT); | ||
1635 | if (pin == -1) | 1700 | if (pin == -1) |
1636 | return; | 1701 | return; |
1637 | 1702 | ||
1638 | spin_lock_irqsave(&ioapic_lock, flags); | 1703 | spin_lock_irqsave(&ioapic_lock, flags); |
1639 | *(((int *)&entry0) + 1) = io_apic_read(0, 0x11 + 2 * pin); | 1704 | *(((int *)&entry0) + 1) = io_apic_read(apic, 0x11 + 2 * pin); |
1640 | *(((int *)&entry0) + 0) = io_apic_read(0, 0x10 + 2 * pin); | 1705 | *(((int *)&entry0) + 0) = io_apic_read(apic, 0x10 + 2 * pin); |
1641 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1706 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1642 | clear_IO_APIC_pin(0, pin); | 1707 | clear_IO_APIC_pin(apic, pin); |
1643 | 1708 | ||
1644 | memset(&entry1, 0, sizeof(entry1)); | 1709 | memset(&entry1, 0, sizeof(entry1)); |
1645 | 1710 | ||
@@ -1652,8 +1717,8 @@ static inline void unlock_ExtINT_logic(void) | |||
1652 | entry1.vector = 0; | 1717 | entry1.vector = 0; |
1653 | 1718 | ||
1654 | spin_lock_irqsave(&ioapic_lock, flags); | 1719 | spin_lock_irqsave(&ioapic_lock, flags); |
1655 | io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry1) + 1)); | 1720 | io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry1) + 1)); |
1656 | io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry1) + 0)); | 1721 | io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry1) + 0)); |
1657 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1722 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1658 | 1723 | ||
1659 | save_control = CMOS_READ(RTC_CONTROL); | 1724 | save_control = CMOS_READ(RTC_CONTROL); |
@@ -1671,11 +1736,11 @@ static inline void unlock_ExtINT_logic(void) | |||
1671 | 1736 | ||
1672 | CMOS_WRITE(save_control, RTC_CONTROL); | 1737 | CMOS_WRITE(save_control, RTC_CONTROL); |
1673 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); | 1738 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); |
1674 | clear_IO_APIC_pin(0, pin); | 1739 | clear_IO_APIC_pin(apic, pin); |
1675 | 1740 | ||
1676 | spin_lock_irqsave(&ioapic_lock, flags); | 1741 | spin_lock_irqsave(&ioapic_lock, flags); |
1677 | io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry0) + 1)); | 1742 | io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry0) + 1)); |
1678 | io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0)); | 1743 | io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry0) + 0)); |
1679 | spin_unlock_irqrestore(&ioapic_lock, flags); | 1744 | spin_unlock_irqrestore(&ioapic_lock, flags); |
1680 | } | 1745 | } |
1681 | 1746 | ||
@@ -1687,7 +1752,7 @@ static inline void unlock_ExtINT_logic(void) | |||
1687 | */ | 1752 | */ |
1688 | static inline void check_timer(void) | 1753 | static inline void check_timer(void) |
1689 | { | 1754 | { |
1690 | int pin1, pin2; | 1755 | int apic1, pin1, apic2, pin2; |
1691 | int vector; | 1756 | int vector; |
1692 | 1757 | ||
1693 | /* | 1758 | /* |
@@ -1704,14 +1769,17 @@ static inline void check_timer(void) | |||
1704 | * the 8259A which implies the virtual wire has to be | 1769 | * the 8259A which implies the virtual wire has to be |
1705 | * disabled in the local APIC. | 1770 | * disabled in the local APIC. |
1706 | */ | 1771 | */ |
1707 | apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); | 1772 | apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); |
1708 | init_8259A(1); | 1773 | init_8259A(1); |
1709 | enable_8259A_irq(0); | 1774 | enable_8259A_irq(0); |
1710 | 1775 | ||
1711 | pin1 = find_isa_irq_pin(0, mp_INT); | 1776 | pin1 = find_isa_irq_pin(0, mp_INT); |
1712 | pin2 = find_isa_irq_pin(0, mp_ExtINT); | 1777 | apic1 = find_isa_irq_apic(0, mp_INT); |
1778 | pin2 = ioapic_i8259.pin; | ||
1779 | apic2 = ioapic_i8259.apic; | ||
1713 | 1780 | ||
1714 | apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2); | 1781 | apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", |
1782 | vector, apic1, pin1, apic2, pin2); | ||
1715 | 1783 | ||
1716 | if (pin1 != -1) { | 1784 | if (pin1 != -1) { |
1717 | /* | 1785 | /* |
@@ -1729,17 +1797,20 @@ static inline void check_timer(void) | |||
1729 | clear_IO_APIC_pin(0, pin1); | 1797 | clear_IO_APIC_pin(0, pin1); |
1730 | return; | 1798 | return; |
1731 | } | 1799 | } |
1732 | clear_IO_APIC_pin(0, pin1); | 1800 | clear_IO_APIC_pin(apic1, pin1); |
1733 | apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"); | 1801 | apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " |
1802 | "connected to IO-APIC\n"); | ||
1734 | } | 1803 | } |
1735 | 1804 | ||
1736 | apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); | 1805 | apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) " |
1806 | "through the 8259A ... "); | ||
1737 | if (pin2 != -1) { | 1807 | if (pin2 != -1) { |
1738 | apic_printk(APIC_VERBOSE,"\n..... (found pin %d) ...", pin2); | 1808 | apic_printk(APIC_VERBOSE,"\n..... (found apic %d pin %d) ...", |
1809 | apic2, pin2); | ||
1739 | /* | 1810 | /* |
1740 | * legacy devices should be connected to IO APIC #0 | 1811 | * legacy devices should be connected to IO APIC #0 |
1741 | */ | 1812 | */ |
1742 | setup_ExtINT_IRQ0_pin(pin2, vector); | 1813 | setup_ExtINT_IRQ0_pin(apic2, pin2, vector); |
1743 | if (timer_irq_works()) { | 1814 | if (timer_irq_works()) { |
1744 | printk("works.\n"); | 1815 | printk("works.\n"); |
1745 | nmi_watchdog_default(); | 1816 | nmi_watchdog_default(); |
@@ -1751,7 +1822,7 @@ static inline void check_timer(void) | |||
1751 | /* | 1822 | /* |
1752 | * Cleanup, just in case ... | 1823 | * Cleanup, just in case ... |
1753 | */ | 1824 | */ |
1754 | clear_IO_APIC_pin(0, pin2); | 1825 | clear_IO_APIC_pin(apic2, pin2); |
1755 | } | 1826 | } |
1756 | printk(" failed.\n"); | 1827 | printk(" failed.\n"); |
1757 | 1828 | ||
@@ -1764,21 +1835,21 @@ static inline void check_timer(void) | |||
1764 | 1835 | ||
1765 | disable_8259A_irq(0); | 1836 | disable_8259A_irq(0); |
1766 | irq_desc[0].handler = &lapic_irq_type; | 1837 | irq_desc[0].handler = &lapic_irq_type; |
1767 | apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ | 1838 | apic_write(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ |
1768 | enable_8259A_irq(0); | 1839 | enable_8259A_irq(0); |
1769 | 1840 | ||
1770 | if (timer_irq_works()) { | 1841 | if (timer_irq_works()) { |
1771 | apic_printk(APIC_QUIET, " works.\n"); | 1842 | apic_printk(APIC_QUIET, " works.\n"); |
1772 | return; | 1843 | return; |
1773 | } | 1844 | } |
1774 | apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); | 1845 | apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); |
1775 | apic_printk(APIC_VERBOSE," failed.\n"); | 1846 | apic_printk(APIC_VERBOSE," failed.\n"); |
1776 | 1847 | ||
1777 | apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ..."); | 1848 | apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ..."); |
1778 | 1849 | ||
1779 | init_8259A(0); | 1850 | init_8259A(0); |
1780 | make_8259A_irq(0); | 1851 | make_8259A_irq(0); |
1781 | apic_write_around(APIC_LVT0, APIC_DM_EXTINT); | 1852 | apic_write(APIC_LVT0, APIC_DM_EXTINT); |
1782 | 1853 | ||
1783 | unlock_ExtINT_logic(); | 1854 | unlock_ExtINT_logic(); |
1784 | 1855 | ||
diff --git a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c index cde0e868efe3..b81614970ecc 100644 --- a/arch/x86_64/kernel/ioport.c +++ b/arch/x86_64/kernel/ioport.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
12 | #include <linux/ioport.h> | 13 | #include <linux/ioport.h> |
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index d6a04a8320a3..30d2a1e545fe 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
19 | #include <asm/io_apic.h> | 19 | #include <asm/io_apic.h> |
20 | #include <asm/idle.h> | ||
20 | 21 | ||
21 | atomic_t irq_err_count; | 22 | atomic_t irq_err_count; |
22 | #ifdef CONFIG_X86_IO_APIC | 23 | #ifdef CONFIG_X86_IO_APIC |
@@ -69,13 +70,13 @@ skip: | |||
69 | seq_printf(p, "NMI: "); | 70 | seq_printf(p, "NMI: "); |
70 | for (j = 0; j < NR_CPUS; j++) | 71 | for (j = 0; j < NR_CPUS; j++) |
71 | if (cpu_online(j)) | 72 | if (cpu_online(j)) |
72 | seq_printf(p, "%10u ", cpu_pda[j].__nmi_count); | 73 | seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); |
73 | seq_putc(p, '\n'); | 74 | seq_putc(p, '\n'); |
74 | #ifdef CONFIG_X86_LOCAL_APIC | 75 | #ifdef CONFIG_X86_LOCAL_APIC |
75 | seq_printf(p, "LOC: "); | 76 | seq_printf(p, "LOC: "); |
76 | for (j = 0; j < NR_CPUS; j++) | 77 | for (j = 0; j < NR_CPUS; j++) |
77 | if (cpu_online(j)) | 78 | if (cpu_online(j)) |
78 | seq_printf(p, "%10u ", cpu_pda[j].apic_timer_irqs); | 79 | seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs); |
79 | seq_putc(p, '\n'); | 80 | seq_putc(p, '\n'); |
80 | #endif | 81 | #endif |
81 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | 82 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); |
@@ -98,6 +99,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs) | |||
98 | /* high bits used in ret_from_ code */ | 99 | /* high bits used in ret_from_ code */ |
99 | unsigned irq = regs->orig_rax & 0xff; | 100 | unsigned irq = regs->orig_rax & 0xff; |
100 | 101 | ||
102 | exit_idle(); | ||
101 | irq_enter(); | 103 | irq_enter(); |
102 | 104 | ||
103 | __do_IRQ(irq, regs); | 105 | __do_IRQ(irq, regs); |
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index b7dc1f816d13..8b866a8572cf 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -334,6 +334,15 @@ int __kprobes kprobe_handler(struct pt_regs *regs) | |||
334 | return 1; | 334 | return 1; |
335 | } | 335 | } |
336 | } else { | 336 | } else { |
337 | if (*addr != BREAKPOINT_INSTRUCTION) { | ||
338 | /* The breakpoint instruction was removed by | ||
339 | * another cpu right after we hit, no further | ||
340 | * handling of this interrupt is appropriate | ||
341 | */ | ||
342 | regs->rip = (unsigned long)addr; | ||
343 | ret = 1; | ||
344 | goto no_kprobe; | ||
345 | } | ||
337 | p = __get_cpu_var(current_kprobe); | 346 | p = __get_cpu_var(current_kprobe); |
338 | if (p->break_handler && p->break_handler(p, regs)) { | 347 | if (p->break_handler && p->break_handler(p, regs)) { |
339 | goto ss_probe; | 348 | goto ss_probe; |
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index 183dc6105429..13a2eada6c95 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/sysdev.h> | 15 | #include <linux/sysdev.h> |
16 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/capability.h> | ||
18 | #include <linux/cpu.h> | 19 | #include <linux/cpu.h> |
19 | #include <linux/percpu.h> | 20 | #include <linux/percpu.h> |
20 | #include <linux/ctype.h> | 21 | #include <linux/ctype.h> |
@@ -23,9 +24,10 @@ | |||
23 | #include <asm/mce.h> | 24 | #include <asm/mce.h> |
24 | #include <asm/kdebug.h> | 25 | #include <asm/kdebug.h> |
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <asm/smp.h> | ||
26 | 28 | ||
27 | #define MISC_MCELOG_MINOR 227 | 29 | #define MISC_MCELOG_MINOR 227 |
28 | #define NR_BANKS 5 | 30 | #define NR_BANKS 6 |
29 | 31 | ||
30 | static int mce_dont_init; | 32 | static int mce_dont_init; |
31 | 33 | ||
@@ -91,6 +93,7 @@ void mce_log(struct mce *mce) | |||
91 | static void print_mce(struct mce *m) | 93 | static void print_mce(struct mce *m) |
92 | { | 94 | { |
93 | printk(KERN_EMERG "\n" | 95 | printk(KERN_EMERG "\n" |
96 | KERN_EMERG "HARDWARE ERROR\n" | ||
94 | KERN_EMERG | 97 | KERN_EMERG |
95 | "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n", | 98 | "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n", |
96 | m->cpu, m->mcgstatus, m->bank, m->status); | 99 | m->cpu, m->mcgstatus, m->bank, m->status); |
@@ -109,6 +112,9 @@ static void print_mce(struct mce *m) | |||
109 | if (m->misc) | 112 | if (m->misc) |
110 | printk("MISC %Lx ", m->misc); | 113 | printk("MISC %Lx ", m->misc); |
111 | printk("\n"); | 114 | printk("\n"); |
115 | printk(KERN_EMERG "This is not a software problem!\n"); | ||
116 | printk(KERN_EMERG | ||
117 | "Run through mcelog --ascii to decode and contact your hardware vendor\n"); | ||
112 | } | 118 | } |
113 | 119 | ||
114 | static void mce_panic(char *msg, struct mce *backup, unsigned long start) | 120 | static void mce_panic(char *msg, struct mce *backup, unsigned long start) |
@@ -168,12 +174,12 @@ void do_machine_check(struct pt_regs * regs, long error_code) | |||
168 | int panicm_found = 0; | 174 | int panicm_found = 0; |
169 | 175 | ||
170 | if (regs) | 176 | if (regs) |
171 | notify_die(DIE_NMI, "machine check", regs, error_code, 255, SIGKILL); | 177 | notify_die(DIE_NMI, "machine check", regs, error_code, 18, SIGKILL); |
172 | if (!banks) | 178 | if (!banks) |
173 | return; | 179 | return; |
174 | 180 | ||
175 | memset(&m, 0, sizeof(struct mce)); | 181 | memset(&m, 0, sizeof(struct mce)); |
176 | m.cpu = hard_smp_processor_id(); | 182 | m.cpu = safe_smp_processor_id(); |
177 | rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); | 183 | rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); |
178 | if (!(m.mcgstatus & MCG_STATUS_RIPV)) | 184 | if (!(m.mcgstatus & MCG_STATUS_RIPV)) |
179 | kill_it = 1; | 185 | kill_it = 1; |
@@ -573,6 +579,10 @@ ACCESSOR(bank1ctl,bank[1],mce_restart()) | |||
573 | ACCESSOR(bank2ctl,bank[2],mce_restart()) | 579 | ACCESSOR(bank2ctl,bank[2],mce_restart()) |
574 | ACCESSOR(bank3ctl,bank[3],mce_restart()) | 580 | ACCESSOR(bank3ctl,bank[3],mce_restart()) |
575 | ACCESSOR(bank4ctl,bank[4],mce_restart()) | 581 | ACCESSOR(bank4ctl,bank[4],mce_restart()) |
582 | ACCESSOR(bank5ctl,bank[5],mce_restart()) | ||
583 | static struct sysdev_attribute * bank_attributes[NR_BANKS] = { | ||
584 | &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl, | ||
585 | &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl}; | ||
576 | ACCESSOR(tolerant,tolerant,) | 586 | ACCESSOR(tolerant,tolerant,) |
577 | ACCESSOR(check_interval,check_interval,mce_restart()) | 587 | ACCESSOR(check_interval,check_interval,mce_restart()) |
578 | 588 | ||
@@ -580,6 +590,7 @@ ACCESSOR(check_interval,check_interval,mce_restart()) | |||
580 | static __cpuinit int mce_create_device(unsigned int cpu) | 590 | static __cpuinit int mce_create_device(unsigned int cpu) |
581 | { | 591 | { |
582 | int err; | 592 | int err; |
593 | int i; | ||
583 | if (!mce_available(&cpu_data[cpu])) | 594 | if (!mce_available(&cpu_data[cpu])) |
584 | return -EIO; | 595 | return -EIO; |
585 | 596 | ||
@@ -589,11 +600,9 @@ static __cpuinit int mce_create_device(unsigned int cpu) | |||
589 | err = sysdev_register(&per_cpu(device_mce,cpu)); | 600 | err = sysdev_register(&per_cpu(device_mce,cpu)); |
590 | 601 | ||
591 | if (!err) { | 602 | if (!err) { |
592 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl); | 603 | for (i = 0; i < banks; i++) |
593 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl); | 604 | sysdev_create_file(&per_cpu(device_mce,cpu), |
594 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl); | 605 | bank_attributes[i]); |
595 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl); | ||
596 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl); | ||
597 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant); | 606 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant); |
598 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval); | 607 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval); |
599 | } | 608 | } |
@@ -603,11 +612,11 @@ static __cpuinit int mce_create_device(unsigned int cpu) | |||
603 | #ifdef CONFIG_HOTPLUG_CPU | 612 | #ifdef CONFIG_HOTPLUG_CPU |
604 | static __cpuinit void mce_remove_device(unsigned int cpu) | 613 | static __cpuinit void mce_remove_device(unsigned int cpu) |
605 | { | 614 | { |
606 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl); | 615 | int i; |
607 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl); | 616 | |
608 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl); | 617 | for (i = 0; i < banks; i++) |
609 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl); | 618 | sysdev_remove_file(&per_cpu(device_mce,cpu), |
610 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl); | 619 | bank_attributes[i]); |
611 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant); | 620 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant); |
612 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval); | 621 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval); |
613 | sysdev_unregister(&per_cpu(device_mce,cpu)); | 622 | sysdev_unregister(&per_cpu(device_mce,cpu)); |
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c index 1f76175ace02..d3ad7d81266d 100644 --- a/arch/x86_64/kernel/mce_amd.c +++ b/arch/x86_64/kernel/mce_amd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/mce.h> | 27 | #include <asm/mce.h> |
28 | #include <asm/msr.h> | 28 | #include <asm/msr.h> |
29 | #include <asm/percpu.h> | 29 | #include <asm/percpu.h> |
30 | #include <asm/idle.h> | ||
30 | 31 | ||
31 | #define PFX "mce_threshold: " | 32 | #define PFX "mce_threshold: " |
32 | #define VERSION "version 1.00.9" | 33 | #define VERSION "version 1.00.9" |
@@ -140,6 +141,7 @@ asmlinkage void mce_threshold_interrupt(void) | |||
140 | struct mce m; | 141 | struct mce m; |
141 | 142 | ||
142 | ack_APIC_irq(); | 143 | ack_APIC_irq(); |
144 | exit_idle(); | ||
143 | irq_enter(); | 145 | irq_enter(); |
144 | 146 | ||
145 | memset(&m, 0, sizeof(m)); | 147 | memset(&m, 0, sizeof(m)); |
@@ -318,7 +320,7 @@ static struct kobj_type threshold_ktype = { | |||
318 | static __cpuinit int threshold_create_bank(unsigned int cpu, int bank) | 320 | static __cpuinit int threshold_create_bank(unsigned int cpu, int bank) |
319 | { | 321 | { |
320 | int err = 0; | 322 | int err = 0; |
321 | struct threshold_bank *b = 0; | 323 | struct threshold_bank *b = NULL; |
322 | 324 | ||
323 | #ifdef CONFIG_SMP | 325 | #ifdef CONFIG_SMP |
324 | if (cpu_core_id[cpu] && shared_bank[bank]) { /* symlink */ | 326 | if (cpu_core_id[cpu] && shared_bank[bank]) { /* symlink */ |
@@ -407,7 +409,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) | |||
407 | if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) { | 409 | if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) { |
408 | sprintf(name, "bank%i", bank); | 410 | sprintf(name, "bank%i", bank); |
409 | sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name); | 411 | sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name); |
410 | per_cpu(threshold_banks, cpu)[bank] = 0; | 412 | per_cpu(threshold_banks, cpu)[bank] = NULL; |
411 | } else { | 413 | } else { |
412 | kobject_unregister(&b->kobj); | 414 | kobject_unregister(&b->kobj); |
413 | kfree(per_cpu(threshold_banks, cpu)[bank]); | 415 | kfree(per_cpu(threshold_banks, cpu)[bank]); |
diff --git a/arch/x86_64/kernel/mce_intel.c b/arch/x86_64/kernel/mce_intel.c index 0be0a7959814..8f533d2c40cb 100644 --- a/arch/x86_64/kernel/mce_intel.c +++ b/arch/x86_64/kernel/mce_intel.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm/msr.h> | 10 | #include <asm/msr.h> |
11 | #include <asm/mce.h> | 11 | #include <asm/mce.h> |
12 | #include <asm/hw_irq.h> | 12 | #include <asm/hw_irq.h> |
13 | #include <asm/idle.h> | ||
13 | 14 | ||
14 | static DEFINE_PER_CPU(unsigned long, next_check); | 15 | static DEFINE_PER_CPU(unsigned long, next_check); |
15 | 16 | ||
@@ -19,6 +20,7 @@ asmlinkage void smp_thermal_interrupt(void) | |||
19 | 20 | ||
20 | ack_APIC_irq(); | 21 | ack_APIC_irq(); |
21 | 22 | ||
23 | exit_idle(); | ||
22 | irq_enter(); | 24 | irq_enter(); |
23 | if (time_before(jiffies, __get_cpu_var(next_check))) | 25 | if (time_before(jiffies, __get_cpu_var(next_check))) |
24 | goto done; | 26 | goto done; |
@@ -78,7 +80,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) | |||
78 | 80 | ||
79 | h = THERMAL_APIC_VECTOR; | 81 | h = THERMAL_APIC_VECTOR; |
80 | h |= (APIC_DM_FIXED | APIC_LVT_MASKED); | 82 | h |= (APIC_DM_FIXED | APIC_LVT_MASKED); |
81 | apic_write_around(APIC_LVTTHMR, h); | 83 | apic_write(APIC_LVTTHMR, h); |
82 | 84 | ||
83 | rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); | 85 | rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); |
84 | wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); | 86 | wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); |
@@ -87,7 +89,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) | |||
87 | wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h); | 89 | wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h); |
88 | 90 | ||
89 | l = apic_read(APIC_LVTTHMR); | 91 | l = apic_read(APIC_LVTTHMR); |
90 | apic_write_around(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | 92 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); |
91 | printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", | 93 | printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", |
92 | cpu, tm2 ? "TM2" : "TM1"); | 94 | cpu, tm2 ? "TM2" : "TM1"); |
93 | return; | 95 | return; |
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c index 39d445e16f22..5fae6f0cd994 100644 --- a/arch/x86_64/kernel/nmi.c +++ b/arch/x86_64/kernel/nmi.c | |||
@@ -151,23 +151,25 @@ int __init check_nmi_watchdog (void) | |||
151 | 151 | ||
152 | printk(KERN_INFO "testing NMI watchdog ... "); | 152 | printk(KERN_INFO "testing NMI watchdog ... "); |
153 | 153 | ||
154 | #ifdef CONFIG_SMP | ||
154 | if (nmi_watchdog == NMI_LOCAL_APIC) | 155 | if (nmi_watchdog == NMI_LOCAL_APIC) |
155 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); | 156 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); |
157 | #endif | ||
156 | 158 | ||
157 | for (cpu = 0; cpu < NR_CPUS; cpu++) | 159 | for (cpu = 0; cpu < NR_CPUS; cpu++) |
158 | counts[cpu] = cpu_pda[cpu].__nmi_count; | 160 | counts[cpu] = cpu_pda(cpu)->__nmi_count; |
159 | local_irq_enable(); | 161 | local_irq_enable(); |
160 | mdelay((10*1000)/nmi_hz); // wait 10 ticks | 162 | mdelay((10*1000)/nmi_hz); // wait 10 ticks |
161 | 163 | ||
162 | for (cpu = 0; cpu < NR_CPUS; cpu++) { | 164 | for (cpu = 0; cpu < NR_CPUS; cpu++) { |
163 | if (!cpu_online(cpu)) | 165 | if (!cpu_online(cpu)) |
164 | continue; | 166 | continue; |
165 | if (cpu_pda[cpu].__nmi_count - counts[cpu] <= 5) { | 167 | if (cpu_pda(cpu)->__nmi_count - counts[cpu] <= 5) { |
166 | endflag = 1; | 168 | endflag = 1; |
167 | printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n", | 169 | printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n", |
168 | cpu, | 170 | cpu, |
169 | counts[cpu], | 171 | counts[cpu], |
170 | cpu_pda[cpu].__nmi_count); | 172 | cpu_pda(cpu)->__nmi_count); |
171 | nmi_active = 0; | 173 | nmi_active = 0; |
172 | lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; | 174 | lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; |
173 | nmi_perfctr_msr = 0; | 175 | nmi_perfctr_msr = 0; |
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c index cab471cf3edb..2f5d8328e2b9 100644 --- a/arch/x86_64/kernel/pci-dma.c +++ b/arch/x86_64/kernel/pci-dma.c | |||
@@ -8,53 +8,259 @@ | |||
8 | #include <linux/pci.h> | 8 | #include <linux/pci.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <asm/io.h> | 10 | #include <asm/io.h> |
11 | #include <asm/proto.h> | ||
11 | 12 | ||
12 | /* Map a set of buffers described by scatterlist in streaming | 13 | int iommu_merge __read_mostly = 0; |
13 | * mode for DMA. This is the scatter-gather version of the | 14 | EXPORT_SYMBOL(iommu_merge); |
14 | * above pci_map_single interface. Here the scatter gather list | 15 | |
15 | * elements are each tagged with the appropriate dma address | 16 | dma_addr_t bad_dma_address __read_mostly; |
16 | * and length. They are obtained via sg_dma_{address,length}(SG). | 17 | EXPORT_SYMBOL(bad_dma_address); |
17 | * | 18 | |
18 | * NOTE: An implementation may be able to use a smaller number of | 19 | /* This tells the BIO block layer to assume merging. Default to off |
19 | * DMA address/length pairs than there are SG table elements. | 20 | because we cannot guarantee merging later. */ |
20 | * (for example via virtual mapping capabilities) | 21 | int iommu_bio_merge __read_mostly = 0; |
21 | * The routine returns the number of addr/length pairs actually | 22 | EXPORT_SYMBOL(iommu_bio_merge); |
22 | * used, at most nents. | 23 | |
23 | * | 24 | int iommu_sac_force __read_mostly = 0; |
24 | * Device ownership issues as mentioned above for pci_map_single are | 25 | EXPORT_SYMBOL(iommu_sac_force); |
25 | * the same here. | 26 | |
27 | int no_iommu __read_mostly; | ||
28 | #ifdef CONFIG_IOMMU_DEBUG | ||
29 | int panic_on_overflow __read_mostly = 1; | ||
30 | int force_iommu __read_mostly = 1; | ||
31 | #else | ||
32 | int panic_on_overflow __read_mostly = 0; | ||
33 | int force_iommu __read_mostly= 0; | ||
34 | #endif | ||
35 | |||
36 | /* Dummy device used for NULL arguments (normally ISA). Better would | ||
37 | be probably a smaller DMA mask, but this is bug-to-bug compatible | ||
38 | to i386. */ | ||
39 | struct device fallback_dev = { | ||
40 | .bus_id = "fallback device", | ||
41 | .coherent_dma_mask = 0xffffffff, | ||
42 | .dma_mask = &fallback_dev.coherent_dma_mask, | ||
43 | }; | ||
44 | |||
45 | /* Allocate DMA memory on node near device */ | ||
46 | noinline static void * | ||
47 | dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) | ||
48 | { | ||
49 | struct page *page; | ||
50 | int node; | ||
51 | if (dev->bus == &pci_bus_type) | ||
52 | node = pcibus_to_node(to_pci_dev(dev)->bus); | ||
53 | else | ||
54 | node = numa_node_id(); | ||
55 | page = alloc_pages_node(node, gfp, order); | ||
56 | return page ? page_address(page) : NULL; | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * Allocate memory for a coherent mapping. | ||
26 | */ | 61 | */ |
27 | int dma_map_sg(struct device *hwdev, struct scatterlist *sg, | 62 | void * |
28 | int nents, int direction) | 63 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, |
64 | gfp_t gfp) | ||
29 | { | 65 | { |
30 | int i; | 66 | void *memory; |
31 | 67 | unsigned long dma_mask = 0; | |
32 | BUG_ON(direction == DMA_NONE); | 68 | u64 bus; |
33 | for (i = 0; i < nents; i++ ) { | 69 | |
34 | struct scatterlist *s = &sg[i]; | 70 | if (!dev) |
35 | BUG_ON(!s->page); | 71 | dev = &fallback_dev; |
36 | s->dma_address = virt_to_bus(page_address(s->page) +s->offset); | 72 | dma_mask = dev->coherent_dma_mask; |
37 | s->dma_length = s->length; | 73 | if (dma_mask == 0) |
74 | dma_mask = 0xffffffff; | ||
75 | |||
76 | /* Kludge to make it bug-to-bug compatible with i386. i386 | ||
77 | uses the normal dma_mask for alloc_coherent. */ | ||
78 | dma_mask &= *dev->dma_mask; | ||
79 | |||
80 | /* Why <=? Even when the mask is smaller than 4GB it is often | ||
81 | larger than 16MB and in this case we have a chance of | ||
82 | finding fitting memory in the next higher zone first. If | ||
83 | not retry with true GFP_DMA. -AK */ | ||
84 | if (dma_mask <= 0xffffffff) | ||
85 | gfp |= GFP_DMA32; | ||
86 | |||
87 | again: | ||
88 | memory = dma_alloc_pages(dev, gfp, get_order(size)); | ||
89 | if (memory == NULL) | ||
90 | return NULL; | ||
91 | |||
92 | { | ||
93 | int high, mmu; | ||
94 | bus = virt_to_bus(memory); | ||
95 | high = (bus + size) >= dma_mask; | ||
96 | mmu = high; | ||
97 | if (force_iommu && !(gfp & GFP_DMA)) | ||
98 | mmu = 1; | ||
99 | else if (high) { | ||
100 | free_pages((unsigned long)memory, | ||
101 | get_order(size)); | ||
102 | |||
103 | /* Don't use the 16MB ZONE_DMA unless absolutely | ||
104 | needed. It's better to use remapping first. */ | ||
105 | if (dma_mask < 0xffffffff && !(gfp & GFP_DMA)) { | ||
106 | gfp = (gfp & ~GFP_DMA32) | GFP_DMA; | ||
107 | goto again; | ||
108 | } | ||
109 | |||
110 | if (dma_ops->alloc_coherent) | ||
111 | return dma_ops->alloc_coherent(dev, size, | ||
112 | dma_handle, gfp); | ||
113 | return NULL; | ||
114 | } | ||
115 | |||
116 | memset(memory, 0, size); | ||
117 | if (!mmu) { | ||
118 | *dma_handle = virt_to_bus(memory); | ||
119 | return memory; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | if (dma_ops->alloc_coherent) { | ||
124 | free_pages((unsigned long)memory, get_order(size)); | ||
125 | gfp &= ~(GFP_DMA|GFP_DMA32); | ||
126 | return dma_ops->alloc_coherent(dev, size, dma_handle, gfp); | ||
127 | } | ||
128 | |||
129 | if (dma_ops->map_simple) { | ||
130 | *dma_handle = dma_ops->map_simple(dev, memory, | ||
131 | size, | ||
132 | PCI_DMA_BIDIRECTIONAL); | ||
133 | if (*dma_handle != bad_dma_address) | ||
134 | return memory; | ||
38 | } | 135 | } |
39 | return nents; | ||
40 | } | ||
41 | 136 | ||
42 | EXPORT_SYMBOL(dma_map_sg); | 137 | if (panic_on_overflow) |
138 | panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n",size); | ||
139 | free_pages((unsigned long)memory, get_order(size)); | ||
140 | return NULL; | ||
141 | } | ||
142 | EXPORT_SYMBOL(dma_alloc_coherent); | ||
43 | 143 | ||
44 | /* Unmap a set of streaming mode DMA translations. | 144 | /* |
45 | * Again, cpu read rules concerning calls here are the same as for | 145 | * Unmap coherent memory. |
46 | * pci_unmap_single() above. | 146 | * The caller must ensure that the device has finished accessing the mapping. |
47 | */ | 147 | */ |
48 | void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | 148 | void dma_free_coherent(struct device *dev, size_t size, |
49 | int nents, int dir) | 149 | void *vaddr, dma_addr_t bus) |
150 | { | ||
151 | if (dma_ops->unmap_single) | ||
152 | dma_ops->unmap_single(dev, bus, size, 0); | ||
153 | free_pages((unsigned long)vaddr, get_order(size)); | ||
154 | } | ||
155 | EXPORT_SYMBOL(dma_free_coherent); | ||
156 | |||
157 | int dma_supported(struct device *dev, u64 mask) | ||
158 | { | ||
159 | if (dma_ops->dma_supported) | ||
160 | return dma_ops->dma_supported(dev, mask); | ||
161 | |||
162 | /* Copied from i386. Doesn't make much sense, because it will | ||
163 | only work for pci_alloc_coherent. | ||
164 | The caller just has to use GFP_DMA in this case. */ | ||
165 | if (mask < 0x00ffffff) | ||
166 | return 0; | ||
167 | |||
168 | /* Tell the device to use SAC when IOMMU force is on. This | ||
169 | allows the driver to use cheaper accesses in some cases. | ||
170 | |||
171 | Problem with this is that if we overflow the IOMMU area and | ||
172 | return DAC as fallback address the device may not handle it | ||
173 | correctly. | ||
174 | |||
175 | As a special case some controllers have a 39bit address | ||
176 | mode that is as efficient as 32bit (aic79xx). Don't force | ||
177 | SAC for these. Assume all masks <= 40 bits are of this | ||
178 | type. Normally this doesn't make any difference, but gives | ||
179 | more gentle handling of IOMMU overflow. */ | ||
180 | if (iommu_sac_force && (mask >= 0xffffffffffULL)) { | ||
181 | printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->bus_id,mask); | ||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | return 1; | ||
186 | } | ||
187 | EXPORT_SYMBOL(dma_supported); | ||
188 | |||
189 | int dma_set_mask(struct device *dev, u64 mask) | ||
50 | { | 190 | { |
51 | int i; | 191 | if (!dev->dma_mask || !dma_supported(dev, mask)) |
52 | for (i = 0; i < nents; i++) { | 192 | return -EIO; |
53 | struct scatterlist *s = &sg[i]; | 193 | *dev->dma_mask = mask; |
54 | BUG_ON(s->page == NULL); | 194 | return 0; |
55 | BUG_ON(s->dma_address == 0); | ||
56 | dma_unmap_single(dev, s->dma_address, s->dma_length, dir); | ||
57 | } | ||
58 | } | 195 | } |
196 | EXPORT_SYMBOL(dma_set_mask); | ||
197 | |||
198 | /* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] | ||
199 | [,forcesac][,fullflush][,nomerge][,biomerge] | ||
200 | size set size of iommu (in bytes) | ||
201 | noagp don't initialize the AGP driver and use full aperture. | ||
202 | off don't use the IOMMU | ||
203 | leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on) | ||
204 | memaper[=order] allocate an own aperture over RAM with size 32MB^order. | ||
205 | noforce don't force IOMMU usage. Default. | ||
206 | force Force IOMMU. | ||
207 | merge Do lazy merging. This may improve performance on some block devices. | ||
208 | Implies force (experimental) | ||
209 | biomerge Do merging at the BIO layer. This is more efficient than merge, | ||
210 | but should be only done with very big IOMMUs. Implies merge,force. | ||
211 | nomerge Don't do SG merging. | ||
212 | forcesac For SAC mode for masks <40bits (experimental) | ||
213 | fullflush Flush IOMMU on each allocation (default) | ||
214 | nofullflush Don't use IOMMU fullflush | ||
215 | allowed overwrite iommu off workarounds for specific chipsets. | ||
216 | soft Use software bounce buffering (default for Intel machines) | ||
217 | noaperture Don't touch the aperture for AGP. | ||
218 | */ | ||
219 | __init int iommu_setup(char *p) | ||
220 | { | ||
221 | iommu_merge = 1; | ||
59 | 222 | ||
60 | EXPORT_SYMBOL(dma_unmap_sg); | 223 | while (*p) { |
224 | if (!strncmp(p,"off",3)) | ||
225 | no_iommu = 1; | ||
226 | /* gart_parse_options has more force support */ | ||
227 | if (!strncmp(p,"force",5)) | ||
228 | force_iommu = 1; | ||
229 | if (!strncmp(p,"noforce",7)) { | ||
230 | iommu_merge = 0; | ||
231 | force_iommu = 0; | ||
232 | } | ||
233 | |||
234 | if (!strncmp(p, "biomerge",8)) { | ||
235 | iommu_bio_merge = 4096; | ||
236 | iommu_merge = 1; | ||
237 | force_iommu = 1; | ||
238 | } | ||
239 | if (!strncmp(p, "panic",5)) | ||
240 | panic_on_overflow = 1; | ||
241 | if (!strncmp(p, "nopanic",7)) | ||
242 | panic_on_overflow = 0; | ||
243 | if (!strncmp(p, "merge",5)) { | ||
244 | iommu_merge = 1; | ||
245 | force_iommu = 1; | ||
246 | } | ||
247 | if (!strncmp(p, "nomerge",7)) | ||
248 | iommu_merge = 0; | ||
249 | if (!strncmp(p, "forcesac",8)) | ||
250 | iommu_sac_force = 1; | ||
251 | |||
252 | #ifdef CONFIG_SWIOTLB | ||
253 | if (!strncmp(p, "soft",4)) | ||
254 | swiotlb = 1; | ||
255 | #endif | ||
256 | |||
257 | #ifdef CONFIG_GART_IOMMU | ||
258 | gart_parse_options(p); | ||
259 | #endif | ||
260 | |||
261 | p += strcspn(p, ","); | ||
262 | if (*p == ',') | ||
263 | ++p; | ||
264 | } | ||
265 | return 1; | ||
266 | } | ||
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 2e28e855ec3c..c37fc7726ba6 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -30,8 +30,8 @@ | |||
30 | #include <asm/proto.h> | 30 | #include <asm/proto.h> |
31 | #include <asm/cacheflush.h> | 31 | #include <asm/cacheflush.h> |
32 | #include <asm/kdebug.h> | 32 | #include <asm/kdebug.h> |
33 | 33 | #include <asm/swiotlb.h> | |
34 | dma_addr_t bad_dma_address; | 34 | #include <asm/dma.h> |
35 | 35 | ||
36 | unsigned long iommu_bus_base; /* GART remapping area (physical) */ | 36 | unsigned long iommu_bus_base; /* GART remapping area (physical) */ |
37 | static unsigned long iommu_size; /* size of remapping area bytes */ | 37 | static unsigned long iommu_size; /* size of remapping area bytes */ |
@@ -39,18 +39,6 @@ static unsigned long iommu_pages; /* .. and in pages */ | |||
39 | 39 | ||
40 | u32 *iommu_gatt_base; /* Remapping table */ | 40 | u32 *iommu_gatt_base; /* Remapping table */ |
41 | 41 | ||
42 | int no_iommu; | ||
43 | static int no_agp; | ||
44 | #ifdef CONFIG_IOMMU_DEBUG | ||
45 | int panic_on_overflow = 1; | ||
46 | int force_iommu = 1; | ||
47 | #else | ||
48 | int panic_on_overflow = 0; | ||
49 | int force_iommu = 0; | ||
50 | #endif | ||
51 | int iommu_merge = 1; | ||
52 | int iommu_sac_force = 0; | ||
53 | |||
54 | /* If this is disabled the IOMMU will use an optimized flushing strategy | 42 | /* If this is disabled the IOMMU will use an optimized flushing strategy |
55 | of only flushing when an mapping is reused. With it true the GART is flushed | 43 | of only flushing when an mapping is reused. With it true the GART is flushed |
56 | for every mapping. Problem is that doing the lazy flush seems to trigger | 44 | for every mapping. Problem is that doing the lazy flush seems to trigger |
@@ -58,10 +46,6 @@ int iommu_sac_force = 0; | |||
58 | also seen with Qlogic at least). */ | 46 | also seen with Qlogic at least). */ |
59 | int iommu_fullflush = 1; | 47 | int iommu_fullflush = 1; |
60 | 48 | ||
61 | /* This tells the BIO block layer to assume merging. Default to off | ||
62 | because we cannot guarantee merging later. */ | ||
63 | int iommu_bio_merge = 0; | ||
64 | |||
65 | #define MAX_NB 8 | 49 | #define MAX_NB 8 |
66 | 50 | ||
67 | /* Allocation bitmap for the remapping area */ | 51 | /* Allocation bitmap for the remapping area */ |
@@ -102,16 +86,6 @@ AGPEXTERN __u32 *agp_gatt_table; | |||
102 | 86 | ||
103 | static unsigned long next_bit; /* protected by iommu_bitmap_lock */ | 87 | static unsigned long next_bit; /* protected by iommu_bitmap_lock */ |
104 | static int need_flush; /* global flush state. set for each gart wrap */ | 88 | static int need_flush; /* global flush state. set for each gart wrap */ |
105 | static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem, | ||
106 | size_t size, int dir, int do_panic); | ||
107 | |||
108 | /* Dummy device used for NULL arguments (normally ISA). Better would | ||
109 | be probably a smaller DMA mask, but this is bug-to-bug compatible to i386. */ | ||
110 | static struct device fallback_dev = { | ||
111 | .bus_id = "fallback device", | ||
112 | .coherent_dma_mask = 0xffffffff, | ||
113 | .dma_mask = &fallback_dev.coherent_dma_mask, | ||
114 | }; | ||
115 | 89 | ||
116 | static unsigned long alloc_iommu(int size) | 90 | static unsigned long alloc_iommu(int size) |
117 | { | 91 | { |
@@ -185,114 +159,7 @@ static void flush_gart(struct device *dev) | |||
185 | spin_unlock_irqrestore(&iommu_bitmap_lock, flags); | 159 | spin_unlock_irqrestore(&iommu_bitmap_lock, flags); |
186 | } | 160 | } |
187 | 161 | ||
188 | /* Allocate DMA memory on node near device */ | ||
189 | noinline | ||
190 | static void *dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) | ||
191 | { | ||
192 | struct page *page; | ||
193 | int node; | ||
194 | if (dev->bus == &pci_bus_type) | ||
195 | node = pcibus_to_node(to_pci_dev(dev)->bus); | ||
196 | else | ||
197 | node = numa_node_id(); | ||
198 | page = alloc_pages_node(node, gfp, order); | ||
199 | return page ? page_address(page) : NULL; | ||
200 | } | ||
201 | |||
202 | /* | ||
203 | * Allocate memory for a coherent mapping. | ||
204 | */ | ||
205 | void * | ||
206 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
207 | gfp_t gfp) | ||
208 | { | ||
209 | void *memory; | ||
210 | unsigned long dma_mask = 0; | ||
211 | u64 bus; | ||
212 | 162 | ||
213 | if (!dev) | ||
214 | dev = &fallback_dev; | ||
215 | dma_mask = dev->coherent_dma_mask; | ||
216 | if (dma_mask == 0) | ||
217 | dma_mask = 0xffffffff; | ||
218 | |||
219 | /* Kludge to make it bug-to-bug compatible with i386. i386 | ||
220 | uses the normal dma_mask for alloc_coherent. */ | ||
221 | dma_mask &= *dev->dma_mask; | ||
222 | |||
223 | /* Why <=? Even when the mask is smaller than 4GB it is often larger | ||
224 | than 16MB and in this case we have a chance of finding fitting memory | ||
225 | in the next higher zone first. If not retry with true GFP_DMA. -AK */ | ||
226 | if (dma_mask <= 0xffffffff) | ||
227 | gfp |= GFP_DMA32; | ||
228 | |||
229 | again: | ||
230 | memory = dma_alloc_pages(dev, gfp, get_order(size)); | ||
231 | if (memory == NULL) | ||
232 | return NULL; | ||
233 | |||
234 | { | ||
235 | int high, mmu; | ||
236 | bus = virt_to_bus(memory); | ||
237 | high = (bus + size) >= dma_mask; | ||
238 | mmu = high; | ||
239 | if (force_iommu && !(gfp & GFP_DMA)) | ||
240 | mmu = 1; | ||
241 | if (no_iommu || dma_mask < 0xffffffffUL) { | ||
242 | if (high) { | ||
243 | free_pages((unsigned long)memory, | ||
244 | get_order(size)); | ||
245 | |||
246 | if (swiotlb) { | ||
247 | return | ||
248 | swiotlb_alloc_coherent(dev, size, | ||
249 | dma_handle, | ||
250 | gfp); | ||
251 | } | ||
252 | |||
253 | if (!(gfp & GFP_DMA)) { | ||
254 | gfp = (gfp & ~GFP_DMA32) | GFP_DMA; | ||
255 | goto again; | ||
256 | } | ||
257 | return NULL; | ||
258 | } | ||
259 | mmu = 0; | ||
260 | } | ||
261 | memset(memory, 0, size); | ||
262 | if (!mmu) { | ||
263 | *dma_handle = virt_to_bus(memory); | ||
264 | return memory; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | *dma_handle = dma_map_area(dev, bus, size, PCI_DMA_BIDIRECTIONAL, 0); | ||
269 | if (*dma_handle == bad_dma_address) | ||
270 | goto error; | ||
271 | flush_gart(dev); | ||
272 | return memory; | ||
273 | |||
274 | error: | ||
275 | if (panic_on_overflow) | ||
276 | panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n", size); | ||
277 | free_pages((unsigned long)memory, get_order(size)); | ||
278 | return NULL; | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * Unmap coherent memory. | ||
283 | * The caller must ensure that the device has finished accessing the mapping. | ||
284 | */ | ||
285 | void dma_free_coherent(struct device *dev, size_t size, | ||
286 | void *vaddr, dma_addr_t bus) | ||
287 | { | ||
288 | if (swiotlb) { | ||
289 | swiotlb_free_coherent(dev, size, vaddr, bus); | ||
290 | return; | ||
291 | } | ||
292 | |||
293 | dma_unmap_single(dev, bus, size, 0); | ||
294 | free_pages((unsigned long)vaddr, get_order(size)); | ||
295 | } | ||
296 | 163 | ||
297 | #ifdef CONFIG_IOMMU_LEAK | 164 | #ifdef CONFIG_IOMMU_LEAK |
298 | 165 | ||
@@ -326,7 +193,7 @@ void dump_leak(void) | |||
326 | #define CLEAR_LEAK(x) | 193 | #define CLEAR_LEAK(x) |
327 | #endif | 194 | #endif |
328 | 195 | ||
329 | static void iommu_full(struct device *dev, size_t size, int dir, int do_panic) | 196 | static void iommu_full(struct device *dev, size_t size, int dir) |
330 | { | 197 | { |
331 | /* | 198 | /* |
332 | * Ran out of IOMMU space for this operation. This is very bad. | 199 | * Ran out of IOMMU space for this operation. This is very bad. |
@@ -342,11 +209,11 @@ static void iommu_full(struct device *dev, size_t size, int dir, int do_panic) | |||
342 | "PCI-DMA: Out of IOMMU space for %lu bytes at device %s\n", | 209 | "PCI-DMA: Out of IOMMU space for %lu bytes at device %s\n", |
343 | size, dev->bus_id); | 210 | size, dev->bus_id); |
344 | 211 | ||
345 | if (size > PAGE_SIZE*EMERGENCY_PAGES && do_panic) { | 212 | if (size > PAGE_SIZE*EMERGENCY_PAGES) { |
346 | if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) | 213 | if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) |
347 | panic("PCI-DMA: Memory would be corrupted\n"); | 214 | panic("PCI-DMA: Memory would be corrupted\n"); |
348 | if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL) | 215 | if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL) |
349 | panic("PCI-DMA: Random memory would be DMAed\n"); | 216 | panic(KERN_ERR "PCI-DMA: Random memory would be DMAed\n"); |
350 | } | 217 | } |
351 | 218 | ||
352 | #ifdef CONFIG_IOMMU_LEAK | 219 | #ifdef CONFIG_IOMMU_LEAK |
@@ -385,8 +252,8 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t | |||
385 | /* Map a single continuous physical area into the IOMMU. | 252 | /* Map a single continuous physical area into the IOMMU. |
386 | * Caller needs to check if the iommu is needed and flush. | 253 | * Caller needs to check if the iommu is needed and flush. |
387 | */ | 254 | */ |
388 | static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem, | 255 | static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, |
389 | size_t size, int dir, int do_panic) | 256 | size_t size, int dir) |
390 | { | 257 | { |
391 | unsigned long npages = to_pages(phys_mem, size); | 258 | unsigned long npages = to_pages(phys_mem, size); |
392 | unsigned long iommu_page = alloc_iommu(npages); | 259 | unsigned long iommu_page = alloc_iommu(npages); |
@@ -396,7 +263,7 @@ static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem, | |||
396 | return phys_mem; | 263 | return phys_mem; |
397 | if (panic_on_overflow) | 264 | if (panic_on_overflow) |
398 | panic("dma_map_area overflow %lu bytes\n", size); | 265 | panic("dma_map_area overflow %lu bytes\n", size); |
399 | iommu_full(dev, size, dir, do_panic); | 266 | iommu_full(dev, size, dir); |
400 | return bad_dma_address; | 267 | return bad_dma_address; |
401 | } | 268 | } |
402 | 269 | ||
@@ -408,15 +275,21 @@ static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem, | |||
408 | return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); | 275 | return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); |
409 | } | 276 | } |
410 | 277 | ||
278 | static dma_addr_t gart_map_simple(struct device *dev, char *buf, | ||
279 | size_t size, int dir) | ||
280 | { | ||
281 | dma_addr_t map = dma_map_area(dev, virt_to_bus(buf), size, dir); | ||
282 | flush_gart(dev); | ||
283 | return map; | ||
284 | } | ||
285 | |||
411 | /* Map a single area into the IOMMU */ | 286 | /* Map a single area into the IOMMU */ |
412 | dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, int dir) | 287 | dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir) |
413 | { | 288 | { |
414 | unsigned long phys_mem, bus; | 289 | unsigned long phys_mem, bus; |
415 | 290 | ||
416 | BUG_ON(dir == DMA_NONE); | 291 | BUG_ON(dir == DMA_NONE); |
417 | 292 | ||
418 | if (swiotlb) | ||
419 | return swiotlb_map_single(dev,addr,size,dir); | ||
420 | if (!dev) | 293 | if (!dev) |
421 | dev = &fallback_dev; | 294 | dev = &fallback_dev; |
422 | 295 | ||
@@ -424,10 +297,24 @@ dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, int dir) | |||
424 | if (!need_iommu(dev, phys_mem, size)) | 297 | if (!need_iommu(dev, phys_mem, size)) |
425 | return phys_mem; | 298 | return phys_mem; |
426 | 299 | ||
427 | bus = dma_map_area(dev, phys_mem, size, dir, 1); | 300 | bus = gart_map_simple(dev, addr, size, dir); |
428 | flush_gart(dev); | ||
429 | return bus; | 301 | return bus; |
430 | } | 302 | } |
303 | |||
304 | /* | ||
305 | * Wrapper for pci_unmap_single working with scatterlists. | ||
306 | */ | ||
307 | void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | ||
308 | { | ||
309 | int i; | ||
310 | |||
311 | for (i = 0; i < nents; i++) { | ||
312 | struct scatterlist *s = &sg[i]; | ||
313 | if (!s->dma_length || !s->length) | ||
314 | break; | ||
315 | dma_unmap_single(dev, s->dma_address, s->dma_length, dir); | ||
316 | } | ||
317 | } | ||
431 | 318 | ||
432 | /* Fallback for dma_map_sg in case of overflow */ | 319 | /* Fallback for dma_map_sg in case of overflow */ |
433 | static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, | 320 | static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, |
@@ -443,10 +330,10 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, | |||
443 | struct scatterlist *s = &sg[i]; | 330 | struct scatterlist *s = &sg[i]; |
444 | unsigned long addr = page_to_phys(s->page) + s->offset; | 331 | unsigned long addr = page_to_phys(s->page) + s->offset; |
445 | if (nonforced_iommu(dev, addr, s->length)) { | 332 | if (nonforced_iommu(dev, addr, s->length)) { |
446 | addr = dma_map_area(dev, addr, s->length, dir, 0); | 333 | addr = dma_map_area(dev, addr, s->length, dir); |
447 | if (addr == bad_dma_address) { | 334 | if (addr == bad_dma_address) { |
448 | if (i > 0) | 335 | if (i > 0) |
449 | dma_unmap_sg(dev, sg, i, dir); | 336 | gart_unmap_sg(dev, sg, i, dir); |
450 | nents = 0; | 337 | nents = 0; |
451 | sg[0].dma_length = 0; | 338 | sg[0].dma_length = 0; |
452 | break; | 339 | break; |
@@ -515,7 +402,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat, | |||
515 | * DMA map all entries in a scatterlist. | 402 | * DMA map all entries in a scatterlist. |
516 | * Merge chunks that have page aligned sizes into a continuous mapping. | 403 | * Merge chunks that have page aligned sizes into a continuous mapping. |
517 | */ | 404 | */ |
518 | int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | 405 | int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) |
519 | { | 406 | { |
520 | int i; | 407 | int i; |
521 | int out; | 408 | int out; |
@@ -527,8 +414,6 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | |||
527 | if (nents == 0) | 414 | if (nents == 0) |
528 | return 0; | 415 | return 0; |
529 | 416 | ||
530 | if (swiotlb) | ||
531 | return swiotlb_map_sg(dev,sg,nents,dir); | ||
532 | if (!dev) | 417 | if (!dev) |
533 | dev = &fallback_dev; | 418 | dev = &fallback_dev; |
534 | 419 | ||
@@ -571,13 +456,13 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | |||
571 | 456 | ||
572 | error: | 457 | error: |
573 | flush_gart(NULL); | 458 | flush_gart(NULL); |
574 | dma_unmap_sg(dev, sg, nents, dir); | 459 | gart_unmap_sg(dev, sg, nents, dir); |
575 | /* When it was forced try again unforced */ | 460 | /* When it was forced try again unforced */ |
576 | if (force_iommu) | 461 | if (force_iommu) |
577 | return dma_map_sg_nonforce(dev, sg, nents, dir); | 462 | return dma_map_sg_nonforce(dev, sg, nents, dir); |
578 | if (panic_on_overflow) | 463 | if (panic_on_overflow) |
579 | panic("dma_map_sg: overflow on %lu pages\n", pages); | 464 | panic("dma_map_sg: overflow on %lu pages\n", pages); |
580 | iommu_full(dev, pages << PAGE_SHIFT, dir, 0); | 465 | iommu_full(dev, pages << PAGE_SHIFT, dir); |
581 | for (i = 0; i < nents; i++) | 466 | for (i = 0; i < nents; i++) |
582 | sg[i].dma_address = bad_dma_address; | 467 | sg[i].dma_address = bad_dma_address; |
583 | return 0; | 468 | return 0; |
@@ -586,18 +471,13 @@ error: | |||
586 | /* | 471 | /* |
587 | * Free a DMA mapping. | 472 | * Free a DMA mapping. |
588 | */ | 473 | */ |
589 | void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, | 474 | void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, |
590 | size_t size, int direction) | 475 | size_t size, int direction) |
591 | { | 476 | { |
592 | unsigned long iommu_page; | 477 | unsigned long iommu_page; |
593 | int npages; | 478 | int npages; |
594 | int i; | 479 | int i; |
595 | 480 | ||
596 | if (swiotlb) { | ||
597 | swiotlb_unmap_single(dev,dma_addr,size,direction); | ||
598 | return; | ||
599 | } | ||
600 | |||
601 | if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || | 481 | if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || |
602 | dma_addr >= iommu_bus_base + iommu_size) | 482 | dma_addr >= iommu_bus_base + iommu_size) |
603 | return; | 483 | return; |
@@ -610,68 +490,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, | |||
610 | free_iommu(iommu_page, npages); | 490 | free_iommu(iommu_page, npages); |
611 | } | 491 | } |
612 | 492 | ||
613 | /* | 493 | static int no_agp; |
614 | * Wrapper for pci_unmap_single working with scatterlists. | ||
615 | */ | ||
616 | void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | ||
617 | { | ||
618 | int i; | ||
619 | if (swiotlb) { | ||
620 | swiotlb_unmap_sg(dev,sg,nents,dir); | ||
621 | return; | ||
622 | } | ||
623 | for (i = 0; i < nents; i++) { | ||
624 | struct scatterlist *s = &sg[i]; | ||
625 | if (!s->dma_length || !s->length) | ||
626 | break; | ||
627 | dma_unmap_single(dev, s->dma_address, s->dma_length, dir); | ||
628 | } | ||
629 | } | ||
630 | |||
631 | int dma_supported(struct device *dev, u64 mask) | ||
632 | { | ||
633 | /* Copied from i386. Doesn't make much sense, because it will | ||
634 | only work for pci_alloc_coherent. | ||
635 | The caller just has to use GFP_DMA in this case. */ | ||
636 | if (mask < 0x00ffffff) | ||
637 | return 0; | ||
638 | |||
639 | /* Tell the device to use SAC when IOMMU force is on. | ||
640 | This allows the driver to use cheaper accesses in some cases. | ||
641 | |||
642 | Problem with this is that if we overflow the IOMMU area | ||
643 | and return DAC as fallback address the device may not handle it correctly. | ||
644 | |||
645 | As a special case some controllers have a 39bit address mode | ||
646 | that is as efficient as 32bit (aic79xx). Don't force SAC for these. | ||
647 | Assume all masks <= 40 bits are of this type. Normally this doesn't | ||
648 | make any difference, but gives more gentle handling of IOMMU overflow. */ | ||
649 | if (iommu_sac_force && (mask >= 0xffffffffffULL)) { | ||
650 | printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->bus_id,mask); | ||
651 | return 0; | ||
652 | } | ||
653 | |||
654 | return 1; | ||
655 | } | ||
656 | |||
657 | int dma_get_cache_alignment(void) | ||
658 | { | ||
659 | return boot_cpu_data.x86_clflush_size; | ||
660 | } | ||
661 | |||
662 | EXPORT_SYMBOL(dma_unmap_sg); | ||
663 | EXPORT_SYMBOL(dma_map_sg); | ||
664 | EXPORT_SYMBOL(dma_map_single); | ||
665 | EXPORT_SYMBOL(dma_unmap_single); | ||
666 | EXPORT_SYMBOL(dma_supported); | ||
667 | EXPORT_SYMBOL(no_iommu); | ||
668 | EXPORT_SYMBOL(force_iommu); | ||
669 | EXPORT_SYMBOL(bad_dma_address); | ||
670 | EXPORT_SYMBOL(iommu_bio_merge); | ||
671 | EXPORT_SYMBOL(iommu_sac_force); | ||
672 | EXPORT_SYMBOL(dma_get_cache_alignment); | ||
673 | EXPORT_SYMBOL(dma_alloc_coherent); | ||
674 | EXPORT_SYMBOL(dma_free_coherent); | ||
675 | 494 | ||
676 | static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) | 495 | static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) |
677 | { | 496 | { |
@@ -772,12 +591,27 @@ static __init int init_k8_gatt(struct agp_kern_info *info) | |||
772 | nommu: | 591 | nommu: |
773 | /* Should not happen anymore */ | 592 | /* Should not happen anymore */ |
774 | printk(KERN_ERR "PCI-DMA: More than 4GB of RAM and no IOMMU\n" | 593 | printk(KERN_ERR "PCI-DMA: More than 4GB of RAM and no IOMMU\n" |
775 | KERN_ERR "PCI-DMA: 32bit PCI IO may malfunction."); | 594 | KERN_ERR "PCI-DMA: 32bit PCI IO may malfunction.\n"); |
776 | return -1; | 595 | return -1; |
777 | } | 596 | } |
778 | 597 | ||
779 | extern int agp_amd64_init(void); | 598 | extern int agp_amd64_init(void); |
780 | 599 | ||
600 | static struct dma_mapping_ops gart_dma_ops = { | ||
601 | .mapping_error = NULL, | ||
602 | .map_single = gart_map_single, | ||
603 | .map_simple = gart_map_simple, | ||
604 | .unmap_single = gart_unmap_single, | ||
605 | .sync_single_for_cpu = NULL, | ||
606 | .sync_single_for_device = NULL, | ||
607 | .sync_single_range_for_cpu = NULL, | ||
608 | .sync_single_range_for_device = NULL, | ||
609 | .sync_sg_for_cpu = NULL, | ||
610 | .sync_sg_for_device = NULL, | ||
611 | .map_sg = gart_map_sg, | ||
612 | .unmap_sg = gart_unmap_sg, | ||
613 | }; | ||
614 | |||
781 | static int __init pci_iommu_init(void) | 615 | static int __init pci_iommu_init(void) |
782 | { | 616 | { |
783 | struct agp_kern_info info; | 617 | struct agp_kern_info info; |
@@ -799,16 +633,15 @@ static int __init pci_iommu_init(void) | |||
799 | 633 | ||
800 | if (swiotlb) { | 634 | if (swiotlb) { |
801 | no_iommu = 1; | 635 | no_iommu = 1; |
802 | printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n"); | ||
803 | return -1; | 636 | return -1; |
804 | } | 637 | } |
805 | 638 | ||
806 | if (no_iommu || | 639 | if (no_iommu || |
807 | (!force_iommu && end_pfn < 0xffffffff>>PAGE_SHIFT) || | 640 | (!force_iommu && end_pfn <= MAX_DMA32_PFN) || |
808 | !iommu_aperture || | 641 | !iommu_aperture || |
809 | (no_agp && init_k8_gatt(&info) < 0)) { | 642 | (no_agp && init_k8_gatt(&info) < 0)) { |
810 | printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); | ||
811 | no_iommu = 1; | 643 | no_iommu = 1; |
644 | no_iommu_init(); | ||
812 | return -1; | 645 | return -1; |
813 | } | 646 | } |
814 | 647 | ||
@@ -885,100 +718,50 @@ static int __init pci_iommu_init(void) | |||
885 | 718 | ||
886 | flush_gart(NULL); | 719 | flush_gart(NULL); |
887 | 720 | ||
721 | printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n"); | ||
722 | dma_ops = &gart_dma_ops; | ||
723 | |||
888 | return 0; | 724 | return 0; |
889 | } | 725 | } |
890 | 726 | ||
891 | /* Must execute after PCI subsystem */ | 727 | /* Must execute after PCI subsystem */ |
892 | fs_initcall(pci_iommu_init); | 728 | fs_initcall(pci_iommu_init); |
893 | 729 | ||
894 | /* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] | 730 | void gart_parse_options(char *p) |
895 | [,forcesac][,fullflush][,nomerge][,biomerge] | 731 | { |
896 | size set size of iommu (in bytes) | 732 | int arg; |
897 | noagp don't initialize the AGP driver and use full aperture. | 733 | |
898 | off don't use the IOMMU | ||
899 | leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on) | ||
900 | memaper[=order] allocate an own aperture over RAM with size 32MB^order. | ||
901 | noforce don't force IOMMU usage. Default. | ||
902 | force Force IOMMU. | ||
903 | merge Do lazy merging. This may improve performance on some block devices. | ||
904 | Implies force (experimental) | ||
905 | biomerge Do merging at the BIO layer. This is more efficient than merge, | ||
906 | but should be only done with very big IOMMUs. Implies merge,force. | ||
907 | nomerge Don't do SG merging. | ||
908 | forcesac For SAC mode for masks <40bits (experimental) | ||
909 | fullflush Flush IOMMU on each allocation (default) | ||
910 | nofullflush Don't use IOMMU fullflush | ||
911 | allowed overwrite iommu off workarounds for specific chipsets. | ||
912 | soft Use software bounce buffering (default for Intel machines) | ||
913 | noaperture Don't touch the aperture for AGP. | ||
914 | */ | ||
915 | __init int iommu_setup(char *p) | ||
916 | { | ||
917 | int arg; | ||
918 | |||
919 | while (*p) { | ||
920 | if (!strncmp(p,"noagp",5)) | ||
921 | no_agp = 1; | ||
922 | if (!strncmp(p,"off",3)) | ||
923 | no_iommu = 1; | ||
924 | if (!strncmp(p,"force",5)) { | ||
925 | force_iommu = 1; | ||
926 | iommu_aperture_allowed = 1; | ||
927 | } | ||
928 | if (!strncmp(p,"allowed",7)) | ||
929 | iommu_aperture_allowed = 1; | ||
930 | if (!strncmp(p,"noforce",7)) { | ||
931 | iommu_merge = 0; | ||
932 | force_iommu = 0; | ||
933 | } | ||
934 | if (!strncmp(p, "memaper", 7)) { | ||
935 | fallback_aper_force = 1; | ||
936 | p += 7; | ||
937 | if (*p == '=') { | ||
938 | ++p; | ||
939 | if (get_option(&p, &arg)) | ||
940 | fallback_aper_order = arg; | ||
941 | } | ||
942 | } | ||
943 | if (!strncmp(p, "biomerge",8)) { | ||
944 | iommu_bio_merge = 4096; | ||
945 | iommu_merge = 1; | ||
946 | force_iommu = 1; | ||
947 | } | ||
948 | if (!strncmp(p, "panic",5)) | ||
949 | panic_on_overflow = 1; | ||
950 | if (!strncmp(p, "nopanic",7)) | ||
951 | panic_on_overflow = 0; | ||
952 | if (!strncmp(p, "merge",5)) { | ||
953 | iommu_merge = 1; | ||
954 | force_iommu = 1; | ||
955 | } | ||
956 | if (!strncmp(p, "nomerge",7)) | ||
957 | iommu_merge = 0; | ||
958 | if (!strncmp(p, "forcesac",8)) | ||
959 | iommu_sac_force = 1; | ||
960 | if (!strncmp(p, "fullflush",8)) | ||
961 | iommu_fullflush = 1; | ||
962 | if (!strncmp(p, "nofullflush",11)) | ||
963 | iommu_fullflush = 0; | ||
964 | if (!strncmp(p, "soft",4)) | ||
965 | swiotlb = 1; | ||
966 | if (!strncmp(p, "noaperture",10)) | ||
967 | fix_aperture = 0; | ||
968 | #ifdef CONFIG_IOMMU_LEAK | 734 | #ifdef CONFIG_IOMMU_LEAK |
969 | if (!strncmp(p,"leak",4)) { | 735 | if (!strncmp(p,"leak",4)) { |
970 | leak_trace = 1; | 736 | leak_trace = 1; |
971 | p += 4; | 737 | p += 4; |
972 | if (*p == '=') ++p; | 738 | if (*p == '=') ++p; |
973 | if (isdigit(*p) && get_option(&p, &arg)) | 739 | if (isdigit(*p) && get_option(&p, &arg)) |
974 | iommu_leak_pages = arg; | 740 | iommu_leak_pages = arg; |
975 | } else | 741 | } |
976 | #endif | 742 | #endif |
977 | if (isdigit(*p) && get_option(&p, &arg)) | 743 | if (isdigit(*p) && get_option(&p, &arg)) |
978 | iommu_size = arg; | 744 | iommu_size = arg; |
979 | p += strcspn(p, ","); | 745 | if (!strncmp(p, "fullflush",8)) |
980 | if (*p == ',') | 746 | iommu_fullflush = 1; |
981 | ++p; | 747 | if (!strncmp(p, "nofullflush",11)) |
982 | } | 748 | iommu_fullflush = 0; |
983 | return 1; | 749 | if (!strncmp(p,"noagp",5)) |
984 | } | 750 | no_agp = 1; |
751 | if (!strncmp(p, "noaperture",10)) | ||
752 | fix_aperture = 0; | ||
753 | /* duplicated from pci-dma.c */ | ||
754 | if (!strncmp(p,"force",5)) | ||
755 | iommu_aperture_allowed = 1; | ||
756 | if (!strncmp(p,"allowed",7)) | ||
757 | iommu_aperture_allowed = 1; | ||
758 | if (!strncmp(p, "memaper", 7)) { | ||
759 | fallback_aper_force = 1; | ||
760 | p += 7; | ||
761 | if (*p == '=') { | ||
762 | ++p; | ||
763 | if (get_option(&p, &arg)) | ||
764 | fallback_aper_order = arg; | ||
765 | } | ||
766 | } | ||
767 | } | ||
diff --git a/arch/x86_64/kernel/pci-nommu.c b/arch/x86_64/kernel/pci-nommu.c index 5a981dca87ff..e41564975195 100644 --- a/arch/x86_64/kernel/pci-nommu.c +++ b/arch/x86_64/kernel/pci-nommu.c | |||
@@ -6,89 +6,94 @@ | |||
6 | #include <linux/string.h> | 6 | #include <linux/string.h> |
7 | #include <asm/proto.h> | 7 | #include <asm/proto.h> |
8 | #include <asm/processor.h> | 8 | #include <asm/processor.h> |
9 | #include <asm/dma.h> | ||
9 | 10 | ||
10 | int iommu_merge = 0; | 11 | static int |
11 | EXPORT_SYMBOL(iommu_merge); | 12 | check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) |
12 | |||
13 | dma_addr_t bad_dma_address; | ||
14 | EXPORT_SYMBOL(bad_dma_address); | ||
15 | |||
16 | int iommu_bio_merge = 0; | ||
17 | EXPORT_SYMBOL(iommu_bio_merge); | ||
18 | |||
19 | int iommu_sac_force = 0; | ||
20 | EXPORT_SYMBOL(iommu_sac_force); | ||
21 | |||
22 | /* | ||
23 | * Dummy IO MMU functions | ||
24 | */ | ||
25 | |||
26 | void *dma_alloc_coherent(struct device *hwdev, size_t size, | ||
27 | dma_addr_t *dma_handle, gfp_t gfp) | ||
28 | { | 13 | { |
29 | void *ret; | 14 | if (hwdev && bus + size > *hwdev->dma_mask) { |
30 | u64 mask; | 15 | printk(KERN_ERR |
31 | int order = get_order(size); | 16 | "nommu_%s: overflow %Lx+%lu of device mask %Lx\n", |
32 | 17 | name, (long long)bus, size, (long long)*hwdev->dma_mask); | |
33 | if (hwdev) | 18 | return 0; |
34 | mask = hwdev->coherent_dma_mask & *hwdev->dma_mask; | ||
35 | else | ||
36 | mask = 0xffffffff; | ||
37 | for (;;) { | ||
38 | ret = (void *)__get_free_pages(gfp, order); | ||
39 | if (ret == NULL) | ||
40 | return NULL; | ||
41 | *dma_handle = virt_to_bus(ret); | ||
42 | if ((*dma_handle & ~mask) == 0) | ||
43 | break; | ||
44 | free_pages((unsigned long)ret, order); | ||
45 | if (gfp & GFP_DMA) | ||
46 | return NULL; | ||
47 | gfp |= GFP_DMA; | ||
48 | } | 19 | } |
20 | return 1; | ||
21 | } | ||
49 | 22 | ||
50 | memset(ret, 0, size); | 23 | static dma_addr_t |
51 | return ret; | 24 | nommu_map_single(struct device *hwdev, void *ptr, size_t size, |
25 | int direction) | ||
26 | { | ||
27 | dma_addr_t bus = virt_to_bus(ptr); | ||
28 | if (!check_addr("map_single", hwdev, bus, size)) | ||
29 | return bad_dma_address; | ||
30 | return bus; | ||
52 | } | 31 | } |
53 | EXPORT_SYMBOL(dma_alloc_coherent); | ||
54 | 32 | ||
55 | void dma_free_coherent(struct device *hwdev, size_t size, | 33 | void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size, |
56 | void *vaddr, dma_addr_t dma_handle) | 34 | int direction) |
57 | { | 35 | { |
58 | free_pages((unsigned long)vaddr, get_order(size)); | ||
59 | } | 36 | } |
60 | EXPORT_SYMBOL(dma_free_coherent); | ||
61 | 37 | ||
62 | int dma_supported(struct device *hwdev, u64 mask) | 38 | /* Map a set of buffers described by scatterlist in streaming |
39 | * mode for DMA. This is the scatter-gather version of the | ||
40 | * above pci_map_single interface. Here the scatter gather list | ||
41 | * elements are each tagged with the appropriate dma address | ||
42 | * and length. They are obtained via sg_dma_{address,length}(SG). | ||
43 | * | ||
44 | * NOTE: An implementation may be able to use a smaller number of | ||
45 | * DMA address/length pairs than there are SG table elements. | ||
46 | * (for example via virtual mapping capabilities) | ||
47 | * The routine returns the number of addr/length pairs actually | ||
48 | * used, at most nents. | ||
49 | * | ||
50 | * Device ownership issues as mentioned above for pci_map_single are | ||
51 | * the same here. | ||
52 | */ | ||
53 | int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, | ||
54 | int nents, int direction) | ||
63 | { | 55 | { |
64 | /* | 56 | int i; |
65 | * we fall back to GFP_DMA when the mask isn't all 1s, | ||
66 | * so we can't guarantee allocations that must be | ||
67 | * within a tighter range than GFP_DMA.. | ||
68 | * RED-PEN this won't work for pci_map_single. Caller has to | ||
69 | * use GFP_DMA in the first place. | ||
70 | */ | ||
71 | if (mask < 0x00ffffff) | ||
72 | return 0; | ||
73 | 57 | ||
74 | return 1; | 58 | BUG_ON(direction == DMA_NONE); |
75 | } | 59 | for (i = 0; i < nents; i++ ) { |
76 | EXPORT_SYMBOL(dma_supported); | 60 | struct scatterlist *s = &sg[i]; |
61 | BUG_ON(!s->page); | ||
62 | s->dma_address = virt_to_bus(page_address(s->page) +s->offset); | ||
63 | if (!check_addr("map_sg", hwdev, s->dma_address, s->length)) | ||
64 | return 0; | ||
65 | s->dma_length = s->length; | ||
66 | } | ||
67 | return nents; | ||
68 | } | ||
77 | 69 | ||
78 | int dma_get_cache_alignment(void) | 70 | /* Unmap a set of streaming mode DMA translations. |
71 | * Again, cpu read rules concerning calls here are the same as for | ||
72 | * pci_unmap_single() above. | ||
73 | */ | ||
74 | void nommu_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
75 | int nents, int dir) | ||
79 | { | 76 | { |
80 | return boot_cpu_data.x86_clflush_size; | ||
81 | } | 77 | } |
82 | EXPORT_SYMBOL(dma_get_cache_alignment); | ||
83 | 78 | ||
84 | static int __init check_ram(void) | 79 | struct dma_mapping_ops nommu_dma_ops = { |
85 | { | 80 | .map_single = nommu_map_single, |
86 | if (end_pfn >= 0xffffffff>>PAGE_SHIFT) { | 81 | .unmap_single = nommu_unmap_single, |
87 | printk( | 82 | .map_sg = nommu_map_sg, |
88 | KERN_ERR "WARNING more than 4GB of memory but IOMMU not compiled in.\n" | 83 | .unmap_sg = nommu_unmap_sg, |
89 | KERN_ERR "WARNING 32bit PCI may malfunction.\n"); | 84 | .is_phys = 1, |
90 | } | 85 | }; |
91 | return 0; | ||
92 | } | ||
93 | __initcall(check_ram); | ||
94 | 86 | ||
87 | void __init no_iommu_init(void) | ||
88 | { | ||
89 | if (dma_ops) | ||
90 | return; | ||
91 | printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); | ||
92 | dma_ops = &nommu_dma_ops; | ||
93 | if (end_pfn > MAX_DMA32_PFN) { | ||
94 | printk(KERN_ERR | ||
95 | "WARNING more than 4GB of memory but IOMMU not compiled in.\n" | ||
96 | KERN_ERR "WARNING 32bit PCI may malfunction.\n" | ||
97 | KERN_ERR "You might want to enable CONFIG_GART_IOMMU\n"); | ||
98 | } | ||
99 | } | ||
diff --git a/arch/x86_64/kernel/pci-swiotlb.c b/arch/x86_64/kernel/pci-swiotlb.c new file mode 100644 index 000000000000..3569a25ad7fb --- /dev/null +++ b/arch/x86_64/kernel/pci-swiotlb.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* Glue code to lib/swiotlb.c */ | ||
2 | |||
3 | #include <linux/pci.h> | ||
4 | #include <linux/cache.h> | ||
5 | #include <linux/module.h> | ||
6 | #include <asm/dma-mapping.h> | ||
7 | #include <asm/proto.h> | ||
8 | #include <asm/swiotlb.h> | ||
9 | #include <asm/dma.h> | ||
10 | |||
11 | int swiotlb __read_mostly; | ||
12 | EXPORT_SYMBOL(swiotlb); | ||
13 | |||
14 | struct dma_mapping_ops swiotlb_dma_ops = { | ||
15 | .mapping_error = swiotlb_dma_mapping_error, | ||
16 | .alloc_coherent = swiotlb_alloc_coherent, | ||
17 | .free_coherent = swiotlb_free_coherent, | ||
18 | .map_single = swiotlb_map_single, | ||
19 | .unmap_single = swiotlb_unmap_single, | ||
20 | .sync_single_for_cpu = swiotlb_sync_single_for_cpu, | ||
21 | .sync_single_for_device = swiotlb_sync_single_for_device, | ||
22 | .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu, | ||
23 | .sync_single_range_for_device = swiotlb_sync_single_range_for_device, | ||
24 | .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, | ||
25 | .sync_sg_for_device = swiotlb_sync_sg_for_device, | ||
26 | .map_sg = swiotlb_map_sg, | ||
27 | .unmap_sg = swiotlb_unmap_sg, | ||
28 | .dma_supported = NULL, | ||
29 | }; | ||
30 | |||
31 | void pci_swiotlb_init(void) | ||
32 | { | ||
33 | /* don't initialize swiotlb if iommu=off (no_iommu=1) */ | ||
34 | if (!iommu_aperture && !no_iommu && | ||
35 | (end_pfn > MAX_DMA32_PFN || force_iommu)) | ||
36 | swiotlb = 1; | ||
37 | if (swiotlb) { | ||
38 | swiotlb_init(); | ||
39 | printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n"); | ||
40 | dma_ops = &swiotlb_dma_ops; | ||
41 | } | ||
42 | } | ||
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 3060ed97b755..669cf0ed3266 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/utsname.h> | 36 | #include <linux/utsname.h> |
37 | #include <linux/random.h> | 37 | #include <linux/random.h> |
38 | #include <linux/kprobes.h> | 38 | #include <linux/kprobes.h> |
39 | #include <linux/notifier.h> | ||
39 | 40 | ||
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
41 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
@@ -50,13 +51,12 @@ | |||
50 | #include <asm/desc.h> | 51 | #include <asm/desc.h> |
51 | #include <asm/proto.h> | 52 | #include <asm/proto.h> |
52 | #include <asm/ia32.h> | 53 | #include <asm/ia32.h> |
54 | #include <asm/idle.h> | ||
53 | 55 | ||
54 | asmlinkage extern void ret_from_fork(void); | 56 | asmlinkage extern void ret_from_fork(void); |
55 | 57 | ||
56 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; | 58 | unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; |
57 | 59 | ||
58 | static atomic_t hlt_counter = ATOMIC_INIT(0); | ||
59 | |||
60 | unsigned long boot_option_idle_override = 0; | 60 | unsigned long boot_option_idle_override = 0; |
61 | EXPORT_SYMBOL(boot_option_idle_override); | 61 | EXPORT_SYMBOL(boot_option_idle_override); |
62 | 62 | ||
@@ -66,19 +66,49 @@ EXPORT_SYMBOL(boot_option_idle_override); | |||
66 | void (*pm_idle)(void); | 66 | void (*pm_idle)(void); |
67 | static DEFINE_PER_CPU(unsigned int, cpu_idle_state); | 67 | static DEFINE_PER_CPU(unsigned int, cpu_idle_state); |
68 | 68 | ||
69 | void disable_hlt(void) | 69 | static struct notifier_block *idle_notifier; |
70 | static DEFINE_SPINLOCK(idle_notifier_lock); | ||
71 | |||
72 | void idle_notifier_register(struct notifier_block *n) | ||
73 | { | ||
74 | unsigned long flags; | ||
75 | spin_lock_irqsave(&idle_notifier_lock, flags); | ||
76 | notifier_chain_register(&idle_notifier, n); | ||
77 | spin_unlock_irqrestore(&idle_notifier_lock, flags); | ||
78 | } | ||
79 | EXPORT_SYMBOL_GPL(idle_notifier_register); | ||
80 | |||
81 | void idle_notifier_unregister(struct notifier_block *n) | ||
70 | { | 82 | { |
71 | atomic_inc(&hlt_counter); | 83 | unsigned long flags; |
84 | spin_lock_irqsave(&idle_notifier_lock, flags); | ||
85 | notifier_chain_unregister(&idle_notifier, n); | ||
86 | spin_unlock_irqrestore(&idle_notifier_lock, flags); | ||
72 | } | 87 | } |
88 | EXPORT_SYMBOL(idle_notifier_unregister); | ||
73 | 89 | ||
74 | EXPORT_SYMBOL(disable_hlt); | 90 | enum idle_state { CPU_IDLE, CPU_NOT_IDLE }; |
91 | static DEFINE_PER_CPU(enum idle_state, idle_state) = CPU_NOT_IDLE; | ||
75 | 92 | ||
76 | void enable_hlt(void) | 93 | void enter_idle(void) |
77 | { | 94 | { |
78 | atomic_dec(&hlt_counter); | 95 | __get_cpu_var(idle_state) = CPU_IDLE; |
96 | notifier_call_chain(&idle_notifier, IDLE_START, NULL); | ||
79 | } | 97 | } |
80 | 98 | ||
81 | EXPORT_SYMBOL(enable_hlt); | 99 | static void __exit_idle(void) |
100 | { | ||
101 | __get_cpu_var(idle_state) = CPU_NOT_IDLE; | ||
102 | notifier_call_chain(&idle_notifier, IDLE_END, NULL); | ||
103 | } | ||
104 | |||
105 | /* Called from interrupts to signify idle end */ | ||
106 | void exit_idle(void) | ||
107 | { | ||
108 | if (current->pid | read_pda(irqcount)) | ||
109 | return; | ||
110 | __exit_idle(); | ||
111 | } | ||
82 | 112 | ||
83 | /* | 113 | /* |
84 | * We use this if we don't have any better | 114 | * We use this if we don't have any better |
@@ -88,21 +118,16 @@ void default_idle(void) | |||
88 | { | 118 | { |
89 | local_irq_enable(); | 119 | local_irq_enable(); |
90 | 120 | ||
91 | if (!atomic_read(&hlt_counter)) { | 121 | clear_thread_flag(TIF_POLLING_NRFLAG); |
92 | clear_thread_flag(TIF_POLLING_NRFLAG); | 122 | smp_mb__after_clear_bit(); |
93 | smp_mb__after_clear_bit(); | 123 | while (!need_resched()) { |
94 | while (!need_resched()) { | 124 | local_irq_disable(); |
95 | local_irq_disable(); | 125 | if (!need_resched()) |
96 | if (!need_resched()) | 126 | safe_halt(); |
97 | safe_halt(); | 127 | else |
98 | else | 128 | local_irq_enable(); |
99 | local_irq_enable(); | ||
100 | } | ||
101 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
102 | } else { | ||
103 | while (!need_resched()) | ||
104 | cpu_relax(); | ||
105 | } | 129 | } |
130 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
106 | } | 131 | } |
107 | 132 | ||
108 | /* | 133 | /* |
@@ -201,7 +226,9 @@ void cpu_idle (void) | |||
201 | idle = default_idle; | 226 | idle = default_idle; |
202 | if (cpu_is_offline(smp_processor_id())) | 227 | if (cpu_is_offline(smp_processor_id())) |
203 | play_dead(); | 228 | play_dead(); |
229 | enter_idle(); | ||
204 | idle(); | 230 | idle(); |
231 | __exit_idle(); | ||
205 | } | 232 | } |
206 | 233 | ||
207 | preempt_enable_no_resched(); | 234 | preempt_enable_no_resched(); |
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c index a87b6cebe80f..86248bc9303e 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c | |||
@@ -36,9 +36,12 @@ | |||
36 | * in exit.c or in signal.c. | 36 | * in exit.c or in signal.c. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | /* determines which flags the user has access to. */ | 39 | /* |
40 | /* 1 = access 0 = no access */ | 40 | * Determines which flags the user has access to [1 = access, 0 = no access]. |
41 | #define FLAG_MASK 0x44dd5UL | 41 | * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9). |
42 | * Also masks reserved bits (63-22, 15, 5, 3, 1). | ||
43 | */ | ||
44 | #define FLAG_MASK 0x54dd5UL | ||
42 | 45 | ||
43 | /* set's the trap flag. */ | 46 | /* set's the trap flag. */ |
44 | #define TRAP_FLAG 0x100UL | 47 | #define TRAP_FLAG 0x100UL |
diff --git a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c index 75235ed2b31b..57117b8beb2b 100644 --- a/arch/x86_64/kernel/reboot.c +++ b/arch/x86_64/kernel/reboot.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/ctype.h> | 7 | #include <linux/ctype.h> |
8 | #include <linux/string.h> | 8 | #include <linux/string.h> |
9 | #include <linux/pm.h> | ||
9 | #include <asm/io.h> | 10 | #include <asm/io.h> |
10 | #include <asm/kdebug.h> | 11 | #include <asm/kdebug.h> |
11 | #include <asm/delay.h> | 12 | #include <asm/delay.h> |
@@ -154,10 +155,11 @@ void machine_halt(void) | |||
154 | 155 | ||
155 | void machine_power_off(void) | 156 | void machine_power_off(void) |
156 | { | 157 | { |
157 | if (!reboot_force) { | 158 | if (pm_power_off) { |
158 | machine_shutdown(); | 159 | if (!reboot_force) { |
159 | } | 160 | machine_shutdown(); |
160 | if (pm_power_off) | 161 | } |
161 | pm_power_off(); | 162 | pm_power_off(); |
163 | } | ||
162 | } | 164 | } |
163 | 165 | ||
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index a0e0c9ca8f10..28895c03cb11 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -44,6 +44,8 @@ | |||
44 | #include <linux/mmzone.h> | 44 | #include <linux/mmzone.h> |
45 | #include <linux/kexec.h> | 45 | #include <linux/kexec.h> |
46 | #include <linux/cpufreq.h> | 46 | #include <linux/cpufreq.h> |
47 | #include <linux/dmi.h> | ||
48 | #include <linux/dma-mapping.h> | ||
47 | 49 | ||
48 | #include <asm/mtrr.h> | 50 | #include <asm/mtrr.h> |
49 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
@@ -62,7 +64,9 @@ | |||
62 | #include <asm/setup.h> | 64 | #include <asm/setup.h> |
63 | #include <asm/mach_apic.h> | 65 | #include <asm/mach_apic.h> |
64 | #include <asm/numa.h> | 66 | #include <asm/numa.h> |
67 | #include <asm/swiotlb.h> | ||
65 | #include <asm/sections.h> | 68 | #include <asm/sections.h> |
69 | #include <asm/gart-mapping.h> | ||
66 | 70 | ||
67 | /* | 71 | /* |
68 | * Machine setup.. | 72 | * Machine setup.. |
@@ -87,11 +91,6 @@ int bootloader_type; | |||
87 | 91 | ||
88 | unsigned long saved_video_mode; | 92 | unsigned long saved_video_mode; |
89 | 93 | ||
90 | #ifdef CONFIG_SWIOTLB | ||
91 | int swiotlb; | ||
92 | EXPORT_SYMBOL(swiotlb); | ||
93 | #endif | ||
94 | |||
95 | /* | 94 | /* |
96 | * Setup options | 95 | * Setup options |
97 | */ | 96 | */ |
@@ -278,10 +277,6 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
278 | int len = 0; | 277 | int len = 0; |
279 | int userdef = 0; | 278 | int userdef = 0; |
280 | 279 | ||
281 | /* Save unparsed command line copy for /proc/cmdline */ | ||
282 | memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); | ||
283 | saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; | ||
284 | |||
285 | for (;;) { | 280 | for (;;) { |
286 | if (c != ' ') | 281 | if (c != ' ') |
287 | goto next_char; | 282 | goto next_char; |
@@ -348,10 +343,14 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
348 | !memcmp(from, "disableapic", 11)) | 343 | !memcmp(from, "disableapic", 11)) |
349 | disable_apic = 1; | 344 | disable_apic = 1; |
350 | 345 | ||
351 | if (!memcmp(from, "noapic", 6)) | 346 | /* Don't confuse with noapictimer */ |
347 | if (!memcmp(from, "noapic", 6) && | ||
348 | (from[6] == ' ' || from[6] == 0)) | ||
352 | skip_ioapic_setup = 1; | 349 | skip_ioapic_setup = 1; |
353 | 350 | ||
354 | if (!memcmp(from, "apic", 4)) { | 351 | /* Make sure to not confuse with apic= */ |
352 | if (!memcmp(from, "apic", 4) && | ||
353 | (from[4] == ' ' || from[4] == 0)) { | ||
355 | skip_ioapic_setup = 0; | 354 | skip_ioapic_setup = 0; |
356 | ioapic_force = 1; | 355 | ioapic_force = 1; |
357 | } | 356 | } |
@@ -386,11 +385,9 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
386 | numa_setup(from+5); | 385 | numa_setup(from+5); |
387 | #endif | 386 | #endif |
388 | 387 | ||
389 | #ifdef CONFIG_GART_IOMMU | ||
390 | if (!memcmp(from,"iommu=",6)) { | 388 | if (!memcmp(from,"iommu=",6)) { |
391 | iommu_setup(from+6); | 389 | iommu_setup(from+6); |
392 | } | 390 | } |
393 | #endif | ||
394 | 391 | ||
395 | if (!memcmp(from,"oops=panic", 10)) | 392 | if (!memcmp(from,"oops=panic", 10)) |
396 | panic_on_oops = 1; | 393 | panic_on_oops = 1; |
@@ -479,6 +476,8 @@ static unsigned char *k8_nops[ASM_NOP_MAX+1] = { | |||
479 | k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7, | 476 | k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7, |
480 | }; | 477 | }; |
481 | 478 | ||
479 | extern char __vsyscall_0; | ||
480 | |||
482 | /* Replace instructions with better alternatives for this CPU type. | 481 | /* Replace instructions with better alternatives for this CPU type. |
483 | 482 | ||
484 | This runs before SMP is initialized to avoid SMP problems with | 483 | This runs before SMP is initialized to avoid SMP problems with |
@@ -490,11 +489,17 @@ void apply_alternatives(void *start, void *end) | |||
490 | struct alt_instr *a; | 489 | struct alt_instr *a; |
491 | int diff, i, k; | 490 | int diff, i, k; |
492 | for (a = start; (void *)a < end; a++) { | 491 | for (a = start; (void *)a < end; a++) { |
492 | u8 *instr; | ||
493 | |||
493 | if (!boot_cpu_has(a->cpuid)) | 494 | if (!boot_cpu_has(a->cpuid)) |
494 | continue; | 495 | continue; |
495 | 496 | ||
496 | BUG_ON(a->replacementlen > a->instrlen); | 497 | BUG_ON(a->replacementlen > a->instrlen); |
497 | __inline_memcpy(a->instr, a->replacement, a->replacementlen); | 498 | instr = a->instr; |
499 | /* vsyscall code is not mapped yet. resolve it manually. */ | ||
500 | if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) | ||
501 | instr = __va(instr - (u8*)VSYSCALL_START + (u8*)__pa_symbol(&__vsyscall_0)); | ||
502 | __inline_memcpy(instr, a->replacement, a->replacementlen); | ||
498 | diff = a->instrlen - a->replacementlen; | 503 | diff = a->instrlen - a->replacementlen; |
499 | 504 | ||
500 | /* Pad the rest with nops */ | 505 | /* Pad the rest with nops */ |
@@ -502,7 +507,7 @@ void apply_alternatives(void *start, void *end) | |||
502 | k = diff; | 507 | k = diff; |
503 | if (k > ASM_NOP_MAX) | 508 | if (k > ASM_NOP_MAX) |
504 | k = ASM_NOP_MAX; | 509 | k = ASM_NOP_MAX; |
505 | __inline_memcpy(a->instr + i, k8_nops[k], k); | 510 | __inline_memcpy(instr + i, k8_nops[k], k); |
506 | } | 511 | } |
507 | } | 512 | } |
508 | } | 513 | } |
@@ -706,6 +711,8 @@ void __init setup_arch(char **cmdline_p) | |||
706 | acpi_boot_init(); | 711 | acpi_boot_init(); |
707 | #endif | 712 | #endif |
708 | 713 | ||
714 | init_cpu_to_node(); | ||
715 | |||
709 | #ifdef CONFIG_X86_LOCAL_APIC | 716 | #ifdef CONFIG_X86_LOCAL_APIC |
710 | /* | 717 | /* |
711 | * get boot-time SMP configuration: | 718 | * get boot-time SMP configuration: |
@@ -870,7 +877,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
870 | static int __init init_amd(struct cpuinfo_x86 *c) | 877 | static int __init init_amd(struct cpuinfo_x86 *c) |
871 | { | 878 | { |
872 | int r; | 879 | int r; |
873 | int level; | ||
874 | 880 | ||
875 | #ifdef CONFIG_SMP | 881 | #ifdef CONFIG_SMP |
876 | unsigned long value; | 882 | unsigned long value; |
@@ -893,11 +899,6 @@ static int __init init_amd(struct cpuinfo_x86 *c) | |||
893 | 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */ | 899 | 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */ |
894 | clear_bit(0*32+31, &c->x86_capability); | 900 | clear_bit(0*32+31, &c->x86_capability); |
895 | 901 | ||
896 | /* C-stepping K8? */ | ||
897 | level = cpuid_eax(1); | ||
898 | if ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) | ||
899 | set_bit(X86_FEATURE_K8_C, &c->x86_capability); | ||
900 | |||
901 | r = get_model_name(c); | 902 | r = get_model_name(c); |
902 | if (!r) { | 903 | if (!r) { |
903 | switch (c->x86) { | 904 | switch (c->x86) { |
@@ -910,6 +911,10 @@ static int __init init_amd(struct cpuinfo_x86 *c) | |||
910 | } | 911 | } |
911 | display_cacheinfo(c); | 912 | display_cacheinfo(c); |
912 | 913 | ||
914 | /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */ | ||
915 | if (c->x86_power & (1<<8)) | ||
916 | set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); | ||
917 | |||
913 | if (c->extended_cpuid_level >= 0x80000008) { | 918 | if (c->extended_cpuid_level >= 0x80000008) { |
914 | c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; | 919 | c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; |
915 | if (c->x86_max_cores & (c->x86_max_cores - 1)) | 920 | if (c->x86_max_cores & (c->x86_max_cores - 1)) |
@@ -1028,8 +1033,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
1028 | 1033 | ||
1029 | if (c->x86 == 15) | 1034 | if (c->x86 == 15) |
1030 | c->x86_cache_alignment = c->x86_clflush_size * 2; | 1035 | c->x86_cache_alignment = c->x86_clflush_size * 2; |
1031 | if (c->x86 >= 15) | 1036 | if ((c->x86 == 0xf && c->x86_model >= 0x03) || |
1037 | (c->x86 == 0x6 && c->x86_model >= 0x0e)) | ||
1032 | set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); | 1038 | set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); |
1039 | set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); | ||
1033 | c->x86_max_cores = intel_num_cpu_cores(c); | 1040 | c->x86_max_cores = intel_num_cpu_cores(c); |
1034 | 1041 | ||
1035 | srat_detect_node(); | 1042 | srat_detect_node(); |
@@ -1228,7 +1235,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1228 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 1235 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
1229 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | 1236 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, |
1230 | NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, | 1237 | NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, |
1231 | NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", | 1238 | NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow", |
1232 | 1239 | ||
1233 | /* Transmeta-defined */ | 1240 | /* Transmeta-defined */ |
1234 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | 1241 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, |
@@ -1256,7 +1263,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1256 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 1263 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
1257 | 1264 | ||
1258 | /* AMD-defined (#2) */ | 1265 | /* AMD-defined (#2) */ |
1259 | "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, | 1266 | "lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL, |
1260 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 1267 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
1261 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 1268 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
1262 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 1269 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
@@ -1267,7 +1274,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1267 | "vid", /* voltage id control */ | 1274 | "vid", /* voltage id control */ |
1268 | "ttp", /* thermal trip */ | 1275 | "ttp", /* thermal trip */ |
1269 | "tm", | 1276 | "tm", |
1270 | "stc" | 1277 | "stc", |
1278 | NULL, | ||
1279 | /* nothing */ /* constant_tsc - moved to flags */ | ||
1271 | }; | 1280 | }; |
1272 | 1281 | ||
1273 | 1282 | ||
@@ -1347,8 +1356,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1347 | unsigned i; | 1356 | unsigned i; |
1348 | for (i = 0; i < 32; i++) | 1357 | for (i = 0; i < 32; i++) |
1349 | if (c->x86_power & (1 << i)) { | 1358 | if (c->x86_power & (1 << i)) { |
1350 | if (i < ARRAY_SIZE(x86_power_flags)) | 1359 | if (i < ARRAY_SIZE(x86_power_flags) && |
1351 | seq_printf(m, " %s", x86_power_flags[i]); | 1360 | x86_power_flags[i]) |
1361 | seq_printf(m, "%s%s", | ||
1362 | x86_power_flags[i][0]?" ":"", | ||
1363 | x86_power_flags[i]); | ||
1352 | else | 1364 | else |
1353 | seq_printf(m, " [%d]", i); | 1365 | seq_printf(m, " [%d]", i); |
1354 | } | 1366 | } |
@@ -1380,3 +1392,11 @@ struct seq_operations cpuinfo_op = { | |||
1380 | .stop = c_stop, | 1392 | .stop = c_stop, |
1381 | .show = show_cpuinfo, | 1393 | .show = show_cpuinfo, |
1382 | }; | 1394 | }; |
1395 | |||
1396 | static int __init run_dmi_scan(void) | ||
1397 | { | ||
1398 | dmi_scan_machine(); | ||
1399 | return 0; | ||
1400 | } | ||
1401 | core_initcall(run_dmi_scan); | ||
1402 | |||
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 06dc354375c3..6eff51e9400c 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -30,7 +30,8 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; | |||
30 | 30 | ||
31 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | 31 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; |
32 | 32 | ||
33 | struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; | 33 | struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly; |
34 | struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned; | ||
34 | 35 | ||
35 | struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; | 36 | struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; |
36 | 37 | ||
@@ -110,18 +111,18 @@ void __init setup_per_cpu_areas(void) | |||
110 | } | 111 | } |
111 | if (!ptr) | 112 | if (!ptr) |
112 | panic("Cannot allocate cpu data for CPU %d\n", i); | 113 | panic("Cannot allocate cpu data for CPU %d\n", i); |
113 | cpu_pda[i].data_offset = ptr - __per_cpu_start; | 114 | cpu_pda(i)->data_offset = ptr - __per_cpu_start; |
114 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 115 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); |
115 | } | 116 | } |
116 | } | 117 | } |
117 | 118 | ||
118 | void pda_init(int cpu) | 119 | void pda_init(int cpu) |
119 | { | 120 | { |
120 | struct x8664_pda *pda = &cpu_pda[cpu]; | 121 | struct x8664_pda *pda = cpu_pda(cpu); |
121 | 122 | ||
122 | /* Setup up data that may be needed in __get_free_pages early */ | 123 | /* Setup up data that may be needed in __get_free_pages early */ |
123 | asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); | 124 | asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); |
124 | wrmsrl(MSR_GS_BASE, cpu_pda + cpu); | 125 | wrmsrl(MSR_GS_BASE, pda); |
125 | 126 | ||
126 | pda->cpunumber = cpu; | 127 | pda->cpunumber = cpu; |
127 | pda->irqcount = -1; | 128 | pda->irqcount = -1; |
@@ -145,7 +146,7 @@ void pda_init(int cpu) | |||
145 | pda->irqstackptr += IRQSTACKSIZE-64; | 146 | pda->irqstackptr += IRQSTACKSIZE-64; |
146 | } | 147 | } |
147 | 148 | ||
148 | char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] | 149 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 2) * EXCEPTION_STKSZ + DEBUG_STKSZ] |
149 | __attribute__((section(".bss.page_aligned"))); | 150 | __attribute__((section(".bss.page_aligned"))); |
150 | 151 | ||
151 | /* May not be marked __init: used by software suspend */ | 152 | /* May not be marked __init: used by software suspend */ |
@@ -213,23 +214,14 @@ void __cpuinit cpu_init (void) | |||
213 | * Initialize the per-CPU GDT with the boot GDT, | 214 | * Initialize the per-CPU GDT with the boot GDT, |
214 | * and set up the GDT descriptor: | 215 | * and set up the GDT descriptor: |
215 | */ | 216 | */ |
216 | if (cpu) { | 217 | if (cpu) |
217 | memcpy(cpu_gdt_table[cpu], cpu_gdt_table[0], GDT_SIZE); | 218 | memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE); |
218 | } | ||
219 | 219 | ||
220 | cpu_gdt_descr[cpu].size = GDT_SIZE; | 220 | cpu_gdt_descr[cpu].size = GDT_SIZE; |
221 | cpu_gdt_descr[cpu].address = (unsigned long)cpu_gdt_table[cpu]; | ||
222 | asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu])); | 221 | asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu])); |
223 | asm volatile("lidt %0" :: "m" (idt_descr)); | 222 | asm volatile("lidt %0" :: "m" (idt_descr)); |
224 | 223 | ||
225 | memcpy(me->thread.tls_array, cpu_gdt_table[cpu], GDT_ENTRY_TLS_ENTRIES * 8); | 224 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); |
226 | |||
227 | /* | ||
228 | * Delete NT | ||
229 | */ | ||
230 | |||
231 | asm volatile("pushfq ; popq %%rax ; btr $14,%%rax ; pushq %%rax ; popfq" ::: "eax"); | ||
232 | |||
233 | syscall_init(); | 225 | syscall_init(); |
234 | 226 | ||
235 | wrmsrl(MSR_FS_BASE, 0); | 227 | wrmsrl(MSR_FS_BASE, 0); |
@@ -243,13 +235,27 @@ void __cpuinit cpu_init (void) | |||
243 | */ | 235 | */ |
244 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { | 236 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { |
245 | if (cpu) { | 237 | if (cpu) { |
246 | estacks = (char *)__get_free_pages(GFP_ATOMIC, | 238 | static const unsigned int order[N_EXCEPTION_STACKS] = { |
247 | EXCEPTION_STACK_ORDER); | 239 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, |
240 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER | ||
241 | }; | ||
242 | |||
243 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); | ||
248 | if (!estacks) | 244 | if (!estacks) |
249 | panic("Cannot allocate exception stack %ld %d\n", | 245 | panic("Cannot allocate exception stack %ld %d\n", |
250 | v, cpu); | 246 | v, cpu); |
251 | } | 247 | } |
252 | estacks += EXCEPTION_STKSZ; | 248 | switch (v + 1) { |
249 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
250 | case DEBUG_STACK: | ||
251 | cpu_pda[cpu].debugstack = (unsigned long)estacks; | ||
252 | estacks += DEBUG_STKSZ; | ||
253 | break; | ||
254 | #endif | ||
255 | default: | ||
256 | estacks += EXCEPTION_STKSZ; | ||
257 | break; | ||
258 | } | ||
253 | t->ist[v] = (unsigned long)estacks; | 259 | t->ist[v] = (unsigned long)estacks; |
254 | } | 260 | } |
255 | 261 | ||
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c index cfc3d9dccbd9..19ef012b1f17 100644 --- a/arch/x86_64/kernel/smp.c +++ b/arch/x86_64/kernel/smp.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/mmu_context.h> | 27 | #include <asm/mmu_context.h> |
28 | #include <asm/proto.h> | 28 | #include <asm/proto.h> |
29 | #include <asm/apicdef.h> | 29 | #include <asm/apicdef.h> |
30 | #include <asm/idle.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * Smarter SMP flushing macros. | 33 | * Smarter SMP flushing macros. |
@@ -280,11 +281,6 @@ void flush_tlb_all(void) | |||
280 | on_each_cpu(do_flush_tlb_all, NULL, 1, 1); | 281 | on_each_cpu(do_flush_tlb_all, NULL, 1, 1); |
281 | } | 282 | } |
282 | 283 | ||
283 | void smp_kdb_stop(void) | ||
284 | { | ||
285 | send_IPI_allbutself(KDB_VECTOR); | ||
286 | } | ||
287 | |||
288 | /* | 284 | /* |
289 | * this function sends a 'reschedule' IPI to another CPU. | 285 | * this function sends a 'reschedule' IPI to another CPU. |
290 | * it goes straight through and wastes no time serializing | 286 | * it goes straight through and wastes no time serializing |
@@ -512,6 +508,7 @@ asmlinkage void smp_call_function_interrupt(void) | |||
512 | /* | 508 | /* |
513 | * At this point the info structure may be out of scope unless wait==1 | 509 | * At this point the info structure may be out of scope unless wait==1 |
514 | */ | 510 | */ |
511 | exit_idle(); | ||
515 | irq_enter(); | 512 | irq_enter(); |
516 | (*func)(info); | 513 | (*func)(info); |
517 | irq_exit(); | 514 | irq_exit(); |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index ecbd7b83acc1..c9e941ae5019 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -335,7 +335,13 @@ static __cpuinit void sync_tsc(unsigned int master) | |||
335 | 335 | ||
336 | static void __cpuinit tsc_sync_wait(void) | 336 | static void __cpuinit tsc_sync_wait(void) |
337 | { | 337 | { |
338 | if (notscsync || !cpu_has_tsc) | 338 | /* |
339 | * When the CPU has synchronized TSCs assume the BIOS | ||
340 | * or the hardware already synced. Otherwise we could | ||
341 | * mess up a possible perfect synchronization with a | ||
342 | * not-quite-perfect algorithm. | ||
343 | */ | ||
344 | if (notscsync || !cpu_has_tsc || !unsynchronized_tsc()) | ||
339 | return; | 345 | return; |
340 | sync_tsc(0); | 346 | sync_tsc(0); |
341 | } | 347 | } |
@@ -646,6 +652,7 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
646 | send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; | 652 | send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; |
647 | } while (send_status && (timeout++ < 1000)); | 653 | } while (send_status && (timeout++ < 1000)); |
648 | 654 | ||
655 | mb(); | ||
649 | atomic_set(&init_deasserted, 1); | 656 | atomic_set(&init_deasserted, 1); |
650 | 657 | ||
651 | num_starts = 2; | 658 | num_starts = 2; |
@@ -659,7 +666,6 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
659 | 666 | ||
660 | for (j = 1; j <= num_starts; j++) { | 667 | for (j = 1; j <= num_starts; j++) { |
661 | Dprintk("Sending STARTUP #%d.\n",j); | 668 | Dprintk("Sending STARTUP #%d.\n",j); |
662 | apic_read_around(APIC_SPIV); | ||
663 | apic_write(APIC_ESR, 0); | 669 | apic_write(APIC_ESR, 0); |
664 | apic_read(APIC_ESR); | 670 | apic_read(APIC_ESR); |
665 | Dprintk("After apic_write.\n"); | 671 | Dprintk("After apic_write.\n"); |
@@ -698,7 +704,6 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta | |||
698 | * Due to the Pentium erratum 3AP. | 704 | * Due to the Pentium erratum 3AP. |
699 | */ | 705 | */ |
700 | if (maxlvt > 3) { | 706 | if (maxlvt > 3) { |
701 | apic_read_around(APIC_SPIV); | ||
702 | apic_write(APIC_ESR, 0); | 707 | apic_write(APIC_ESR, 0); |
703 | } | 708 | } |
704 | accept_status = (apic_read(APIC_ESR) & 0xEF); | 709 | accept_status = (apic_read(APIC_ESR) & 0xEF); |
@@ -743,6 +748,30 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) | |||
743 | }; | 748 | }; |
744 | DECLARE_WORK(work, do_fork_idle, &c_idle); | 749 | DECLARE_WORK(work, do_fork_idle, &c_idle); |
745 | 750 | ||
751 | /* allocate memory for gdts of secondary cpus. Hotplug is considered */ | ||
752 | if (!cpu_gdt_descr[cpu].address && | ||
753 | !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) { | ||
754 | printk(KERN_ERR "Failed to allocate GDT for CPU %d\n", cpu); | ||
755 | return -1; | ||
756 | } | ||
757 | |||
758 | /* Allocate node local memory for AP pdas */ | ||
759 | if (cpu_pda(cpu) == &boot_cpu_pda[cpu]) { | ||
760 | struct x8664_pda *newpda, *pda; | ||
761 | int node = cpu_to_node(cpu); | ||
762 | pda = cpu_pda(cpu); | ||
763 | newpda = kmalloc_node(sizeof (struct x8664_pda), GFP_ATOMIC, | ||
764 | node); | ||
765 | if (newpda) { | ||
766 | memcpy(newpda, pda, sizeof (struct x8664_pda)); | ||
767 | cpu_pda(cpu) = newpda; | ||
768 | } else | ||
769 | printk(KERN_ERR | ||
770 | "Could not allocate node local PDA for CPU %d on node %d\n", | ||
771 | cpu, node); | ||
772 | } | ||
773 | |||
774 | |||
746 | c_idle.idle = get_idle_for_cpu(cpu); | 775 | c_idle.idle = get_idle_for_cpu(cpu); |
747 | 776 | ||
748 | if (c_idle.idle) { | 777 | if (c_idle.idle) { |
@@ -778,7 +807,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) | |||
778 | 807 | ||
779 | do_rest: | 808 | do_rest: |
780 | 809 | ||
781 | cpu_pda[cpu].pcurrent = c_idle.idle; | 810 | cpu_pda(cpu)->pcurrent = c_idle.idle; |
782 | 811 | ||
783 | start_rip = setup_trampoline(); | 812 | start_rip = setup_trampoline(); |
784 | 813 | ||
@@ -811,11 +840,8 @@ do_rest: | |||
811 | /* | 840 | /* |
812 | * Be paranoid about clearing APIC errors. | 841 | * Be paranoid about clearing APIC errors. |
813 | */ | 842 | */ |
814 | if (APIC_INTEGRATED(apic_version[apicid])) { | 843 | apic_write(APIC_ESR, 0); |
815 | apic_read_around(APIC_SPIV); | 844 | apic_read(APIC_ESR); |
816 | apic_write(APIC_ESR, 0); | ||
817 | apic_read(APIC_ESR); | ||
818 | } | ||
819 | 845 | ||
820 | /* | 846 | /* |
821 | * Status is now clean | 847 | * Status is now clean |
@@ -927,8 +953,8 @@ int additional_cpus __initdata = -1; | |||
927 | * | 953 | * |
928 | * Three ways to find out the number of additional hotplug CPUs: | 954 | * Three ways to find out the number of additional hotplug CPUs: |
929 | * - If the BIOS specified disabled CPUs in ACPI/mptables use that. | 955 | * - If the BIOS specified disabled CPUs in ACPI/mptables use that. |
930 | * - otherwise use half of the available CPUs or 2, whatever is more. | ||
931 | * - The user can overwrite it with additional_cpus=NUM | 956 | * - The user can overwrite it with additional_cpus=NUM |
957 | * - Otherwise don't reserve additional CPUs. | ||
932 | * We do this because additional CPUs waste a lot of memory. | 958 | * We do this because additional CPUs waste a lot of memory. |
933 | * -AK | 959 | * -AK |
934 | */ | 960 | */ |
@@ -938,13 +964,10 @@ __init void prefill_possible_map(void) | |||
938 | int possible; | 964 | int possible; |
939 | 965 | ||
940 | if (additional_cpus == -1) { | 966 | if (additional_cpus == -1) { |
941 | if (disabled_cpus > 0) { | 967 | if (disabled_cpus > 0) |
942 | additional_cpus = disabled_cpus; | 968 | additional_cpus = disabled_cpus; |
943 | } else { | 969 | else |
944 | additional_cpus = num_processors / 2; | 970 | additional_cpus = 0; |
945 | if (additional_cpus == 0) | ||
946 | additional_cpus = 2; | ||
947 | } | ||
948 | } | 971 | } |
949 | possible = num_processors + additional_cpus; | 972 | possible = num_processors + additional_cpus; |
950 | if (possible > NR_CPUS) | 973 | if (possible > NR_CPUS) |
@@ -996,7 +1019,7 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
996 | /* | 1019 | /* |
997 | * If we couldn't find a local APIC, then get out of here now! | 1020 | * If we couldn't find a local APIC, then get out of here now! |
998 | */ | 1021 | */ |
999 | if (APIC_INTEGRATED(apic_version[boot_cpu_id]) && !cpu_has_apic) { | 1022 | if (!cpu_has_apic) { |
1000 | printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", | 1023 | printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", |
1001 | boot_cpu_id); | 1024 | boot_cpu_id); |
1002 | printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); | 1025 | printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); |
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c index fd2bef780882..ecbd34c1093d 100644 --- a/arch/x86_64/kernel/suspend.c +++ b/arch/x86_64/kernel/suspend.c | |||
@@ -120,7 +120,7 @@ void fix_processor_context(void) | |||
120 | 120 | ||
121 | set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ | 121 | set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ |
122 | 122 | ||
123 | cpu_gdt_table[cpu][GDT_ENTRY_TSS].type = 9; | 123 | cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9; |
124 | 124 | ||
125 | syscall_init(); /* This sets MSR_*STAR and related */ | 125 | syscall_init(); /* This sets MSR_*STAR and related */ |
126 | load_TR_desc(); /* This does ltr */ | 126 | load_TR_desc(); /* This does ltr */ |
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 43c9fa0f8d5f..f8c47c688443 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -71,14 +71,6 @@ unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES; | |||
71 | struct timespec __xtime __section_xtime; | 71 | struct timespec __xtime __section_xtime; |
72 | struct timezone __sys_tz __section_sys_tz; | 72 | struct timezone __sys_tz __section_sys_tz; |
73 | 73 | ||
74 | static inline void rdtscll_sync(unsigned long *tsc) | ||
75 | { | ||
76 | #ifdef CONFIG_SMP | ||
77 | sync_core(); | ||
78 | #endif | ||
79 | rdtscll(*tsc); | ||
80 | } | ||
81 | |||
82 | /* | 74 | /* |
83 | * do_gettimeoffset() returns microseconds since last timer interrupt was | 75 | * do_gettimeoffset() returns microseconds since last timer interrupt was |
84 | * triggered by hardware. A memory read of HPET is slower than a register read | 76 | * triggered by hardware. A memory read of HPET is slower than a register read |
@@ -93,7 +85,7 @@ static inline unsigned int do_gettimeoffset_tsc(void) | |||
93 | { | 85 | { |
94 | unsigned long t; | 86 | unsigned long t; |
95 | unsigned long x; | 87 | unsigned long x; |
96 | rdtscll_sync(&t); | 88 | t = get_cycles_sync(); |
97 | if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */ | 89 | if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */ |
98 | x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32; | 90 | x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32; |
99 | return x; | 91 | return x; |
@@ -259,8 +251,8 @@ static void set_rtc_mmss(unsigned long nowtime) | |||
259 | #endif | 251 | #endif |
260 | 252 | ||
261 | { | 253 | { |
262 | BIN_TO_BCD(real_seconds); | 254 | BIN_TO_BCD(real_seconds); |
263 | BIN_TO_BCD(real_minutes); | 255 | BIN_TO_BCD(real_minutes); |
264 | CMOS_WRITE(real_seconds, RTC_SECONDS); | 256 | CMOS_WRITE(real_seconds, RTC_SECONDS); |
265 | CMOS_WRITE(real_minutes, RTC_MINUTES); | 257 | CMOS_WRITE(real_minutes, RTC_MINUTES); |
266 | } | 258 | } |
@@ -297,25 +289,21 @@ unsigned long long monotonic_clock(void) | |||
297 | last_offset = vxtime.last; | 289 | last_offset = vxtime.last; |
298 | base = monotonic_base; | 290 | base = monotonic_base; |
299 | this_offset = hpet_readl(HPET_COUNTER); | 291 | this_offset = hpet_readl(HPET_COUNTER); |
300 | |||
301 | } while (read_seqretry(&xtime_lock, seq)); | 292 | } while (read_seqretry(&xtime_lock, seq)); |
302 | offset = (this_offset - last_offset); | 293 | offset = (this_offset - last_offset); |
303 | offset *=(NSEC_PER_SEC/HZ)/hpet_tick; | 294 | offset *=(NSEC_PER_SEC/HZ)/hpet_tick; |
304 | return base + offset; | 295 | return base + offset; |
305 | }else{ | 296 | } else { |
306 | do { | 297 | do { |
307 | seq = read_seqbegin(&xtime_lock); | 298 | seq = read_seqbegin(&xtime_lock); |
308 | 299 | ||
309 | last_offset = vxtime.last_tsc; | 300 | last_offset = vxtime.last_tsc; |
310 | base = monotonic_base; | 301 | base = monotonic_base; |
311 | } while (read_seqretry(&xtime_lock, seq)); | 302 | } while (read_seqretry(&xtime_lock, seq)); |
312 | sync_core(); | 303 | this_offset = get_cycles_sync(); |
313 | rdtscll(this_offset); | ||
314 | offset = (this_offset - last_offset)*1000/cpu_khz; | 304 | offset = (this_offset - last_offset)*1000/cpu_khz; |
315 | return base + offset; | 305 | return base + offset; |
316 | } | 306 | } |
317 | |||
318 | |||
319 | } | 307 | } |
320 | EXPORT_SYMBOL(monotonic_clock); | 308 | EXPORT_SYMBOL(monotonic_clock); |
321 | 309 | ||
@@ -391,7 +379,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
391 | delay = LATCH - 1 - delay; | 379 | delay = LATCH - 1 - delay; |
392 | } | 380 | } |
393 | 381 | ||
394 | rdtscll_sync(&tsc); | 382 | tsc = get_cycles_sync(); |
395 | 383 | ||
396 | if (vxtime.mode == VXTIME_HPET) { | 384 | if (vxtime.mode == VXTIME_HPET) { |
397 | if (offset - vxtime.last > hpet_tick) { | 385 | if (offset - vxtime.last > hpet_tick) { |
@@ -471,6 +459,11 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
471 | 459 | ||
472 | write_sequnlock(&xtime_lock); | 460 | write_sequnlock(&xtime_lock); |
473 | 461 | ||
462 | #ifdef CONFIG_X86_LOCAL_APIC | ||
463 | if (using_apic_timer) | ||
464 | smp_send_timer_broadcast_ipi(); | ||
465 | #endif | ||
466 | |||
474 | return IRQ_HANDLED; | 467 | return IRQ_HANDLED; |
475 | } | 468 | } |
476 | 469 | ||
@@ -509,10 +502,10 @@ unsigned long long sched_clock(void) | |||
509 | return cycles_2_ns(a); | 502 | return cycles_2_ns(a); |
510 | } | 503 | } |
511 | 504 | ||
512 | unsigned long get_cmos_time(void) | 505 | static unsigned long get_cmos_time(void) |
513 | { | 506 | { |
514 | unsigned int timeout, year, mon, day, hour, min, sec; | 507 | unsigned int timeout = 1000000, year, mon, day, hour, min, sec; |
515 | unsigned char last, this; | 508 | unsigned char uip = 0, this = 0; |
516 | unsigned long flags; | 509 | unsigned long flags; |
517 | 510 | ||
518 | /* | 511 | /* |
@@ -525,45 +518,41 @@ unsigned long get_cmos_time(void) | |||
525 | 518 | ||
526 | spin_lock_irqsave(&rtc_lock, flags); | 519 | spin_lock_irqsave(&rtc_lock, flags); |
527 | 520 | ||
528 | timeout = 1000000; | 521 | while (timeout && (!uip || this)) { |
529 | last = this = 0; | 522 | uip |= this; |
530 | |||
531 | while (timeout && last && !this) { | ||
532 | last = this; | ||
533 | this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; | 523 | this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; |
534 | timeout--; | 524 | timeout--; |
535 | } | 525 | } |
536 | 526 | ||
537 | /* | 527 | /* |
538 | * Here we are safe to assume the registers won't change for a whole second, so | 528 | * Here we are safe to assume the registers won't change for a whole |
539 | * we just go ahead and read them. | 529 | * second, so we just go ahead and read them. |
540 | */ | 530 | */ |
541 | 531 | sec = CMOS_READ(RTC_SECONDS); | |
542 | sec = CMOS_READ(RTC_SECONDS); | 532 | min = CMOS_READ(RTC_MINUTES); |
543 | min = CMOS_READ(RTC_MINUTES); | 533 | hour = CMOS_READ(RTC_HOURS); |
544 | hour = CMOS_READ(RTC_HOURS); | 534 | day = CMOS_READ(RTC_DAY_OF_MONTH); |
545 | day = CMOS_READ(RTC_DAY_OF_MONTH); | 535 | mon = CMOS_READ(RTC_MONTH); |
546 | mon = CMOS_READ(RTC_MONTH); | 536 | year = CMOS_READ(RTC_YEAR); |
547 | year = CMOS_READ(RTC_YEAR); | ||
548 | 537 | ||
549 | spin_unlock_irqrestore(&rtc_lock, flags); | 538 | spin_unlock_irqrestore(&rtc_lock, flags); |
550 | 539 | ||
551 | /* | 540 | /* |
552 | * We know that x86-64 always uses BCD format, no need to check the config | 541 | * We know that x86-64 always uses BCD format, no need to check the |
553 | * register. | 542 | * config register. |
554 | */ | 543 | */ |
555 | 544 | ||
556 | BCD_TO_BIN(sec); | 545 | BCD_TO_BIN(sec); |
557 | BCD_TO_BIN(min); | 546 | BCD_TO_BIN(min); |
558 | BCD_TO_BIN(hour); | 547 | BCD_TO_BIN(hour); |
559 | BCD_TO_BIN(day); | 548 | BCD_TO_BIN(day); |
560 | BCD_TO_BIN(mon); | 549 | BCD_TO_BIN(mon); |
561 | BCD_TO_BIN(year); | 550 | BCD_TO_BIN(year); |
562 | 551 | ||
563 | /* | 552 | /* |
564 | * x86-64 systems only exists since 2002. | 553 | * x86-64 systems only exists since 2002. |
565 | * This will work up to Dec 31, 2100 | 554 | * This will work up to Dec 31, 2100 |
566 | */ | 555 | */ |
567 | year += 2000; | 556 | year += 2000; |
568 | 557 | ||
569 | return mktime(year, mon, day, hour, min, sec); | 558 | return mktime(year, mon, day, hour, min, sec); |
@@ -695,8 +684,7 @@ static unsigned int __init hpet_calibrate_tsc(void) | |||
695 | do { | 684 | do { |
696 | local_irq_disable(); | 685 | local_irq_disable(); |
697 | hpet_now = hpet_readl(HPET_COUNTER); | 686 | hpet_now = hpet_readl(HPET_COUNTER); |
698 | sync_core(); | 687 | tsc_now = get_cycles_sync(); |
699 | rdtscl(tsc_now); | ||
700 | local_irq_restore(flags); | 688 | local_irq_restore(flags); |
701 | } while ((tsc_now - tsc_start) < TICK_COUNT && | 689 | } while ((tsc_now - tsc_start) < TICK_COUNT && |
702 | (hpet_now - hpet_start) < TICK_COUNT); | 690 | (hpet_now - hpet_start) < TICK_COUNT); |
@@ -726,11 +714,9 @@ static unsigned int __init pit_calibrate_tsc(void) | |||
726 | outb(0xb0, 0x43); | 714 | outb(0xb0, 0x43); |
727 | outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42); | 715 | outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42); |
728 | outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42); | 716 | outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42); |
729 | rdtscll(start); | 717 | start = get_cycles_sync(); |
730 | sync_core(); | ||
731 | while ((inb(0x61) & 0x20) == 0); | 718 | while ((inb(0x61) & 0x20) == 0); |
732 | sync_core(); | 719 | end = get_cycles_sync(); |
733 | rdtscll(end); | ||
734 | 720 | ||
735 | spin_unlock_irqrestore(&i8253_lock, flags); | 721 | spin_unlock_irqrestore(&i8253_lock, flags); |
736 | 722 | ||
@@ -744,7 +730,7 @@ static __init int late_hpet_init(void) | |||
744 | unsigned int ntimer; | 730 | unsigned int ntimer; |
745 | 731 | ||
746 | if (!vxtime.hpet_address) | 732 | if (!vxtime.hpet_address) |
747 | return -1; | 733 | return -1; |
748 | 734 | ||
749 | memset(&hd, 0, sizeof (hd)); | 735 | memset(&hd, 0, sizeof (hd)); |
750 | 736 | ||
@@ -878,8 +864,6 @@ static struct irqaction irq0 = { | |||
878 | timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL | 864 | timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL |
879 | }; | 865 | }; |
880 | 866 | ||
881 | extern void __init config_acpi_tables(void); | ||
882 | |||
883 | void __init time_init(void) | 867 | void __init time_init(void) |
884 | { | 868 | { |
885 | char *timename; | 869 | char *timename; |
@@ -934,7 +918,7 @@ void __init time_init(void) | |||
934 | vxtime.mode = VXTIME_TSC; | 918 | vxtime.mode = VXTIME_TSC; |
935 | vxtime.quot = (1000000L << 32) / vxtime_hz; | 919 | vxtime.quot = (1000000L << 32) / vxtime_hz; |
936 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; | 920 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; |
937 | rdtscll_sync(&vxtime.last_tsc); | 921 | vxtime.last_tsc = get_cycles_sync(); |
938 | setup_irq(0, &irq0); | 922 | setup_irq(0, &irq0); |
939 | 923 | ||
940 | set_cyc2ns_scale(cpu_khz); | 924 | set_cyc2ns_scale(cpu_khz); |
@@ -948,7 +932,7 @@ void __init time_init(void) | |||
948 | * Make an educated guess if the TSC is trustworthy and synchronized | 932 | * Make an educated guess if the TSC is trustworthy and synchronized |
949 | * over all CPUs. | 933 | * over all CPUs. |
950 | */ | 934 | */ |
951 | static __init int unsynchronized_tsc(void) | 935 | __init int unsynchronized_tsc(void) |
952 | { | 936 | { |
953 | #ifdef CONFIG_SMP | 937 | #ifdef CONFIG_SMP |
954 | if (oem_force_hpet_timer()) | 938 | if (oem_force_hpet_timer()) |
@@ -959,7 +943,7 @@ static __init int unsynchronized_tsc(void) | |||
959 | return 0; | 943 | return 0; |
960 | #endif | 944 | #endif |
961 | /* Assume multi socket systems are not synchronized */ | 945 | /* Assume multi socket systems are not synchronized */ |
962 | return num_online_cpus() > 1; | 946 | return num_present_cpus() > 1; |
963 | } | 947 | } |
964 | 948 | ||
965 | /* | 949 | /* |
@@ -999,6 +983,10 @@ __setup("report_lost_ticks", time_setup); | |||
999 | static long clock_cmos_diff; | 983 | static long clock_cmos_diff; |
1000 | static unsigned long sleep_start; | 984 | static unsigned long sleep_start; |
1001 | 985 | ||
986 | /* | ||
987 | * sysfs support for the timer. | ||
988 | */ | ||
989 | |||
1002 | static int timer_suspend(struct sys_device *dev, pm_message_t state) | 990 | static int timer_suspend(struct sys_device *dev, pm_message_t state) |
1003 | { | 991 | { |
1004 | /* | 992 | /* |
@@ -1041,7 +1029,6 @@ static struct sysdev_class timer_sysclass = { | |||
1041 | set_kset_name("timer"), | 1029 | set_kset_name("timer"), |
1042 | }; | 1030 | }; |
1043 | 1031 | ||
1044 | |||
1045 | /* XXX this driverfs stuff should probably go elsewhere later -john */ | 1032 | /* XXX this driverfs stuff should probably go elsewhere later -john */ |
1046 | static struct sys_device device_timer = { | 1033 | static struct sys_device device_timer = { |
1047 | .id = 0, | 1034 | .id = 0, |
@@ -1283,8 +1270,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1283 | } | 1270 | } |
1284 | #endif | 1271 | #endif |
1285 | 1272 | ||
1286 | |||
1287 | |||
1288 | static int __init nohpet_setup(char *s) | 1273 | static int __init nohpet_setup(char *s) |
1289 | { | 1274 | { |
1290 | nohpet = 1; | 1275 | nohpet = 1; |
@@ -1301,5 +1286,3 @@ static int __init notsc_setup(char *s) | |||
1301 | } | 1286 | } |
1302 | 1287 | ||
1303 | __setup("notsc", notsc_setup); | 1288 | __setup("notsc", notsc_setup); |
1304 | |||
1305 | |||
diff --git a/arch/x86_64/kernel/trampoline.S b/arch/x86_64/kernel/trampoline.S index 6d9c9a8e7d0e..23a03eb91fc7 100644 --- a/arch/x86_64/kernel/trampoline.S +++ b/arch/x86_64/kernel/trampoline.S | |||
@@ -42,8 +42,15 @@ r_base = . | |||
42 | movl $0xA5A5A5A5, trampoline_data - r_base | 42 | movl $0xA5A5A5A5, trampoline_data - r_base |
43 | # write marker for master knows we're running | 43 | # write marker for master knows we're running |
44 | 44 | ||
45 | lidt idt_48 - r_base # load idt with 0, 0 | 45 | /* |
46 | lgdt gdt_48 - r_base # load gdt with whatever is appropriate | 46 | * GDT tables in non default location kernel can be beyond 16MB and |
47 | * lgdt will not be able to load the address as in real mode default | ||
48 | * operand size is 16bit. Use lgdtl instead to force operand size | ||
49 | * to 32 bit. | ||
50 | */ | ||
51 | |||
52 | lidtl idt_48 - r_base # load idt with 0, 0 | ||
53 | lgdtl gdt_48 - r_base # load gdt with whatever is appropriate | ||
47 | 54 | ||
48 | xor %ax, %ax | 55 | xor %ax, %ax |
49 | inc %ax # protected mode (PE) bit | 56 | inc %ax # protected mode (PE) bit |
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index bf337f493189..2671fd46ea85 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -70,7 +70,6 @@ asmlinkage void reserved(void); | |||
70 | asmlinkage void alignment_check(void); | 70 | asmlinkage void alignment_check(void); |
71 | asmlinkage void machine_check(void); | 71 | asmlinkage void machine_check(void); |
72 | asmlinkage void spurious_interrupt_bug(void); | 72 | asmlinkage void spurious_interrupt_bug(void); |
73 | asmlinkage void call_debug(void); | ||
74 | 73 | ||
75 | struct notifier_block *die_chain; | 74 | struct notifier_block *die_chain; |
76 | static DEFINE_SPINLOCK(die_notifier_lock); | 75 | static DEFINE_SPINLOCK(die_notifier_lock); |
@@ -121,19 +120,31 @@ int printk_address(unsigned long address) | |||
121 | static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | 120 | static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, |
122 | unsigned *usedp, const char **idp) | 121 | unsigned *usedp, const char **idp) |
123 | { | 122 | { |
124 | static const char ids[N_EXCEPTION_STACKS][8] = { | 123 | static char ids[][8] = { |
125 | [DEBUG_STACK - 1] = "#DB", | 124 | [DEBUG_STACK - 1] = "#DB", |
126 | [NMI_STACK - 1] = "NMI", | 125 | [NMI_STACK - 1] = "NMI", |
127 | [DOUBLEFAULT_STACK - 1] = "#DF", | 126 | [DOUBLEFAULT_STACK - 1] = "#DF", |
128 | [STACKFAULT_STACK - 1] = "#SS", | 127 | [STACKFAULT_STACK - 1] = "#SS", |
129 | [MCE_STACK - 1] = "#MC", | 128 | [MCE_STACK - 1] = "#MC", |
129 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
130 | [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" | ||
131 | #endif | ||
130 | }; | 132 | }; |
131 | unsigned k; | 133 | unsigned k; |
132 | 134 | ||
133 | for (k = 0; k < N_EXCEPTION_STACKS; k++) { | 135 | for (k = 0; k < N_EXCEPTION_STACKS; k++) { |
134 | unsigned long end; | 136 | unsigned long end; |
135 | 137 | ||
136 | end = per_cpu(init_tss, cpu).ist[k]; | 138 | switch (k + 1) { |
139 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
140 | case DEBUG_STACK: | ||
141 | end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ; | ||
142 | break; | ||
143 | #endif | ||
144 | default: | ||
145 | end = per_cpu(init_tss, cpu).ist[k]; | ||
146 | break; | ||
147 | } | ||
137 | if (stack >= end) | 148 | if (stack >= end) |
138 | continue; | 149 | continue; |
139 | if (stack >= end - EXCEPTION_STKSZ) { | 150 | if (stack >= end - EXCEPTION_STKSZ) { |
@@ -143,6 +154,22 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | |||
143 | *idp = ids[k]; | 154 | *idp = ids[k]; |
144 | return (unsigned long *)end; | 155 | return (unsigned long *)end; |
145 | } | 156 | } |
157 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
158 | if (k == DEBUG_STACK - 1 && stack >= end - DEBUG_STKSZ) { | ||
159 | unsigned j = N_EXCEPTION_STACKS - 1; | ||
160 | |||
161 | do { | ||
162 | ++j; | ||
163 | end -= EXCEPTION_STKSZ; | ||
164 | ids[j][4] = '1' + (j - N_EXCEPTION_STACKS); | ||
165 | } while (stack < end - EXCEPTION_STKSZ); | ||
166 | if (*usedp & (1U << j)) | ||
167 | break; | ||
168 | *usedp |= 1U << j; | ||
169 | *idp = ids[j]; | ||
170 | return (unsigned long *)end; | ||
171 | } | ||
172 | #endif | ||
146 | } | 173 | } |
147 | return NULL; | 174 | return NULL; |
148 | } | 175 | } |
@@ -156,9 +183,8 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | |||
156 | 183 | ||
157 | void show_trace(unsigned long *stack) | 184 | void show_trace(unsigned long *stack) |
158 | { | 185 | { |
159 | unsigned long addr; | ||
160 | const unsigned cpu = safe_smp_processor_id(); | 186 | const unsigned cpu = safe_smp_processor_id(); |
161 | unsigned long *irqstack_end = (unsigned long *)cpu_pda[cpu].irqstackptr; | 187 | unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; |
162 | int i; | 188 | int i; |
163 | unsigned used = 0; | 189 | unsigned used = 0; |
164 | 190 | ||
@@ -166,8 +192,14 @@ void show_trace(unsigned long *stack) | |||
166 | 192 | ||
167 | #define HANDLE_STACK(cond) \ | 193 | #define HANDLE_STACK(cond) \ |
168 | do while (cond) { \ | 194 | do while (cond) { \ |
169 | addr = *stack++; \ | 195 | unsigned long addr = *stack++; \ |
170 | if (kernel_text_address(addr)) { \ | 196 | if (kernel_text_address(addr)) { \ |
197 | if (i > 50) { \ | ||
198 | printk("\n "); \ | ||
199 | i = 0; \ | ||
200 | } \ | ||
201 | else \ | ||
202 | i += printk(" "); \ | ||
171 | /* \ | 203 | /* \ |
172 | * If the address is either in the text segment of the \ | 204 | * If the address is either in the text segment of the \ |
173 | * kernel, or in the region which contains vmalloc'ed \ | 205 | * kernel, or in the region which contains vmalloc'ed \ |
@@ -177,25 +209,19 @@ void show_trace(unsigned long *stack) | |||
177 | * out the call path that was taken. \ | 209 | * out the call path that was taken. \ |
178 | */ \ | 210 | */ \ |
179 | i += printk_address(addr); \ | 211 | i += printk_address(addr); \ |
180 | if (i > 50) { \ | ||
181 | printk("\n "); \ | ||
182 | i = 0; \ | ||
183 | } \ | ||
184 | else \ | ||
185 | i += printk(" "); \ | ||
186 | } \ | 212 | } \ |
187 | } while (0) | 213 | } while (0) |
188 | 214 | ||
189 | for(i = 0; ; ) { | 215 | for(i = 11; ; ) { |
190 | const char *id; | 216 | const char *id; |
191 | unsigned long *estack_end; | 217 | unsigned long *estack_end; |
192 | estack_end = in_exception_stack(cpu, (unsigned long)stack, | 218 | estack_end = in_exception_stack(cpu, (unsigned long)stack, |
193 | &used, &id); | 219 | &used, &id); |
194 | 220 | ||
195 | if (estack_end) { | 221 | if (estack_end) { |
196 | i += printk(" <%s> ", id); | 222 | i += printk(" <%s>", id); |
197 | HANDLE_STACK (stack < estack_end); | 223 | HANDLE_STACK (stack < estack_end); |
198 | i += printk(" <EOE> "); | 224 | i += printk(" <EOE>"); |
199 | stack = (unsigned long *) estack_end[-2]; | 225 | stack = (unsigned long *) estack_end[-2]; |
200 | continue; | 226 | continue; |
201 | } | 227 | } |
@@ -205,11 +231,11 @@ void show_trace(unsigned long *stack) | |||
205 | (IRQSTACKSIZE - 64) / sizeof(*irqstack); | 231 | (IRQSTACKSIZE - 64) / sizeof(*irqstack); |
206 | 232 | ||
207 | if (stack >= irqstack && stack < irqstack_end) { | 233 | if (stack >= irqstack && stack < irqstack_end) { |
208 | i += printk(" <IRQ> "); | 234 | i += printk(" <IRQ>"); |
209 | HANDLE_STACK (stack < irqstack_end); | 235 | HANDLE_STACK (stack < irqstack_end); |
210 | stack = (unsigned long *) (irqstack_end[-1]); | 236 | stack = (unsigned long *) (irqstack_end[-1]); |
211 | irqstack_end = NULL; | 237 | irqstack_end = NULL; |
212 | i += printk(" <EOI> "); | 238 | i += printk(" <EOI>"); |
213 | continue; | 239 | continue; |
214 | } | 240 | } |
215 | } | 241 | } |
@@ -226,8 +252,8 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp) | |||
226 | unsigned long *stack; | 252 | unsigned long *stack; |
227 | int i; | 253 | int i; |
228 | const int cpu = safe_smp_processor_id(); | 254 | const int cpu = safe_smp_processor_id(); |
229 | unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr); | 255 | unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); |
230 | unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE); | 256 | unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); |
231 | 257 | ||
232 | // debugging aid: "show_stack(NULL, NULL);" prints the | 258 | // debugging aid: "show_stack(NULL, NULL);" prints the |
233 | // back trace for this cpu. | 259 | // back trace for this cpu. |
@@ -275,7 +301,7 @@ void show_registers(struct pt_regs *regs) | |||
275 | int in_kernel = !user_mode(regs); | 301 | int in_kernel = !user_mode(regs); |
276 | unsigned long rsp; | 302 | unsigned long rsp; |
277 | const int cpu = safe_smp_processor_id(); | 303 | const int cpu = safe_smp_processor_id(); |
278 | struct task_struct *cur = cpu_pda[cpu].pcurrent; | 304 | struct task_struct *cur = cpu_pda(cpu)->pcurrent; |
279 | 305 | ||
280 | rsp = regs->rsp; | 306 | rsp = regs->rsp; |
281 | 307 | ||
@@ -314,20 +340,26 @@ bad: | |||
314 | void handle_BUG(struct pt_regs *regs) | 340 | void handle_BUG(struct pt_regs *regs) |
315 | { | 341 | { |
316 | struct bug_frame f; | 342 | struct bug_frame f; |
317 | char tmp; | 343 | long len; |
344 | const char *prefix = ""; | ||
318 | 345 | ||
319 | if (user_mode(regs)) | 346 | if (user_mode(regs)) |
320 | return; | 347 | return; |
321 | if (__copy_from_user(&f, (struct bug_frame *) regs->rip, | 348 | if (__copy_from_user(&f, (const void __user *) regs->rip, |
322 | sizeof(struct bug_frame))) | 349 | sizeof(struct bug_frame))) |
323 | return; | 350 | return; |
324 | if (f.filename >= 0 || | 351 | if (f.filename >= 0 || |
325 | f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) | 352 | f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) |
326 | return; | 353 | return; |
327 | if (__get_user(tmp, (char *)(long)f.filename)) | 354 | len = __strnlen_user((char *)(long)f.filename, PATH_MAX) - 1; |
355 | if (len < 0 || len >= PATH_MAX) | ||
328 | f.filename = (int)(long)"unmapped filename"; | 356 | f.filename = (int)(long)"unmapped filename"; |
357 | else if (len > 50) { | ||
358 | f.filename += len - 50; | ||
359 | prefix = "..."; | ||
360 | } | ||
329 | printk("----------- [cut here ] --------- [please bite here ] ---------\n"); | 361 | printk("----------- [cut here ] --------- [please bite here ] ---------\n"); |
330 | printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line); | 362 | printk(KERN_ALERT "Kernel BUG at %s%.50s:%d\n", prefix, (char *)(long)f.filename, f.line); |
331 | } | 363 | } |
332 | 364 | ||
333 | #ifdef CONFIG_BUG | 365 | #ifdef CONFIG_BUG |
@@ -382,7 +414,7 @@ void __die(const char * str, struct pt_regs * regs, long err) | |||
382 | printk("DEBUG_PAGEALLOC"); | 414 | printk("DEBUG_PAGEALLOC"); |
383 | #endif | 415 | #endif |
384 | printk("\n"); | 416 | printk("\n"); |
385 | notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); | 417 | notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); |
386 | show_registers(regs); | 418 | show_registers(regs); |
387 | /* Executive summary in case the oops scrolled away */ | 419 | /* Executive summary in case the oops scrolled away */ |
388 | printk(KERN_ALERT "RIP "); | 420 | printk(KERN_ALERT "RIP "); |
@@ -399,11 +431,6 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
399 | oops_end(flags); | 431 | oops_end(flags); |
400 | do_exit(SIGSEGV); | 432 | do_exit(SIGSEGV); |
401 | } | 433 | } |
402 | static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err) | ||
403 | { | ||
404 | if (!(regs->eflags & VM_MASK) && (regs->cs == __KERNEL_CS)) | ||
405 | die(str, regs, err); | ||
406 | } | ||
407 | 434 | ||
408 | void die_nmi(char *str, struct pt_regs *regs) | 435 | void die_nmi(char *str, struct pt_regs *regs) |
409 | { | 436 | { |
@@ -426,19 +453,20 @@ static void __kprobes do_trap(int trapnr, int signr, char *str, | |||
426 | struct pt_regs * regs, long error_code, | 453 | struct pt_regs * regs, long error_code, |
427 | siginfo_t *info) | 454 | siginfo_t *info) |
428 | { | 455 | { |
456 | struct task_struct *tsk = current; | ||
457 | |||
429 | conditional_sti(regs); | 458 | conditional_sti(regs); |
430 | 459 | ||
431 | if (user_mode(regs)) { | 460 | tsk->thread.error_code = error_code; |
432 | struct task_struct *tsk = current; | 461 | tsk->thread.trap_no = trapnr; |
433 | 462 | ||
463 | if (user_mode(regs)) { | ||
434 | if (exception_trace && unhandled_signal(tsk, signr)) | 464 | if (exception_trace && unhandled_signal(tsk, signr)) |
435 | printk(KERN_INFO | 465 | printk(KERN_INFO |
436 | "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", | 466 | "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", |
437 | tsk->comm, tsk->pid, str, | 467 | tsk->comm, tsk->pid, str, |
438 | regs->rip,regs->rsp,error_code); | 468 | regs->rip,regs->rsp,error_code); |
439 | 469 | ||
440 | tsk->thread.error_code = error_code; | ||
441 | tsk->thread.trap_no = trapnr; | ||
442 | if (info) | 470 | if (info) |
443 | force_sig_info(signr, info, tsk); | 471 | force_sig_info(signr, info, tsk); |
444 | else | 472 | else |
@@ -485,7 +513,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ | |||
485 | DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->rip) | 513 | DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->rip) |
486 | DO_ERROR( 4, SIGSEGV, "overflow", overflow) | 514 | DO_ERROR( 4, SIGSEGV, "overflow", overflow) |
487 | DO_ERROR( 5, SIGSEGV, "bounds", bounds) | 515 | DO_ERROR( 5, SIGSEGV, "bounds", bounds) |
488 | DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->rip) | 516 | DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->rip) |
489 | DO_ERROR( 7, SIGSEGV, "device not available", device_not_available) | 517 | DO_ERROR( 7, SIGSEGV, "device not available", device_not_available) |
490 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) | 518 | DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) |
491 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) | 519 | DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) |
@@ -493,24 +521,41 @@ DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) | |||
493 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) | 521 | DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) |
494 | DO_ERROR(18, SIGSEGV, "reserved", reserved) | 522 | DO_ERROR(18, SIGSEGV, "reserved", reserved) |
495 | DO_ERROR(12, SIGBUS, "stack segment", stack_segment) | 523 | DO_ERROR(12, SIGBUS, "stack segment", stack_segment) |
496 | DO_ERROR( 8, SIGSEGV, "double fault", double_fault) | 524 | |
525 | asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) | ||
526 | { | ||
527 | static const char str[] = "double fault"; | ||
528 | struct task_struct *tsk = current; | ||
529 | |||
530 | /* Return not checked because double check cannot be ignored */ | ||
531 | notify_die(DIE_TRAP, str, regs, error_code, 8, SIGSEGV); | ||
532 | |||
533 | tsk->thread.error_code = error_code; | ||
534 | tsk->thread.trap_no = 8; | ||
535 | |||
536 | /* This is always a kernel trap and never fixable (and thus must | ||
537 | never return). */ | ||
538 | for (;;) | ||
539 | die(str, regs, error_code); | ||
540 | } | ||
497 | 541 | ||
498 | asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, | 542 | asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, |
499 | long error_code) | 543 | long error_code) |
500 | { | 544 | { |
545 | struct task_struct *tsk = current; | ||
546 | |||
501 | conditional_sti(regs); | 547 | conditional_sti(regs); |
502 | 548 | ||
503 | if (user_mode(regs)) { | 549 | tsk->thread.error_code = error_code; |
504 | struct task_struct *tsk = current; | 550 | tsk->thread.trap_no = 13; |
505 | 551 | ||
552 | if (user_mode(regs)) { | ||
506 | if (exception_trace && unhandled_signal(tsk, SIGSEGV)) | 553 | if (exception_trace && unhandled_signal(tsk, SIGSEGV)) |
507 | printk(KERN_INFO | 554 | printk(KERN_INFO |
508 | "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", | 555 | "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", |
509 | tsk->comm, tsk->pid, | 556 | tsk->comm, tsk->pid, |
510 | regs->rip,regs->rsp,error_code); | 557 | regs->rip,regs->rsp,error_code); |
511 | 558 | ||
512 | tsk->thread.error_code = error_code; | ||
513 | tsk->thread.trap_no = 13; | ||
514 | force_sig(SIGSEGV, tsk); | 559 | force_sig(SIGSEGV, tsk); |
515 | return; | 560 | return; |
516 | } | 561 | } |
@@ -573,7 +618,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs) | |||
573 | reason = get_nmi_reason(); | 618 | reason = get_nmi_reason(); |
574 | 619 | ||
575 | if (!(reason & 0xc0)) { | 620 | if (!(reason & 0xc0)) { |
576 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) | 621 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) |
577 | == NOTIFY_STOP) | 622 | == NOTIFY_STOP) |
578 | return; | 623 | return; |
579 | #ifdef CONFIG_X86_LOCAL_APIC | 624 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -589,7 +634,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs) | |||
589 | unknown_nmi_error(reason, regs); | 634 | unknown_nmi_error(reason, regs); |
590 | return; | 635 | return; |
591 | } | 636 | } |
592 | if (notify_die(DIE_NMI, "nmi", regs, reason, 0, SIGINT) == NOTIFY_STOP) | 637 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) |
593 | return; | 638 | return; |
594 | 639 | ||
595 | /* AK: following checks seem to be broken on modern chipsets. FIXME */ | 640 | /* AK: following checks seem to be broken on modern chipsets. FIXME */ |
@@ -600,6 +645,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs) | |||
600 | io_check_error(reason, regs); | 645 | io_check_error(reason, regs); |
601 | } | 646 | } |
602 | 647 | ||
648 | /* runs on IST stack. */ | ||
603 | asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) | 649 | asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) |
604 | { | 650 | { |
605 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { | 651 | if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { |
@@ -684,11 +730,9 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs, | |||
684 | info.si_signo = SIGTRAP; | 730 | info.si_signo = SIGTRAP; |
685 | info.si_errno = 0; | 731 | info.si_errno = 0; |
686 | info.si_code = TRAP_BRKPT; | 732 | info.si_code = TRAP_BRKPT; |
687 | if (!user_mode(regs)) | 733 | info.si_addr = user_mode(regs) ? (void __user *)regs->rip : NULL; |
688 | goto clear_dr7; | 734 | force_sig_info(SIGTRAP, &info, tsk); |
689 | 735 | ||
690 | info.si_addr = (void __user *)regs->rip; | ||
691 | force_sig_info(SIGTRAP, &info, tsk); | ||
692 | clear_dr7: | 736 | clear_dr7: |
693 | set_debugreg(0UL, 7); | 737 | set_debugreg(0UL, 7); |
694 | return; | 738 | return; |
@@ -698,7 +742,7 @@ clear_TF_reenable: | |||
698 | regs->eflags &= ~TF_MASK; | 742 | regs->eflags &= ~TF_MASK; |
699 | } | 743 | } |
700 | 744 | ||
701 | static int kernel_math_error(struct pt_regs *regs, char *str) | 745 | static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr) |
702 | { | 746 | { |
703 | const struct exception_table_entry *fixup; | 747 | const struct exception_table_entry *fixup; |
704 | fixup = search_exception_tables(regs->rip); | 748 | fixup = search_exception_tables(regs->rip); |
@@ -706,8 +750,9 @@ static int kernel_math_error(struct pt_regs *regs, char *str) | |||
706 | regs->rip = fixup->fixup; | 750 | regs->rip = fixup->fixup; |
707 | return 1; | 751 | return 1; |
708 | } | 752 | } |
709 | notify_die(DIE_GPF, str, regs, 0, 16, SIGFPE); | 753 | notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE); |
710 | /* Illegal floating point operation in the kernel */ | 754 | /* Illegal floating point operation in the kernel */ |
755 | current->thread.trap_no = trapnr; | ||
711 | die(str, regs, 0); | 756 | die(str, regs, 0); |
712 | return 0; | 757 | return 0; |
713 | } | 758 | } |
@@ -726,7 +771,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs) | |||
726 | 771 | ||
727 | conditional_sti(regs); | 772 | conditional_sti(regs); |
728 | if (!user_mode(regs) && | 773 | if (!user_mode(regs) && |
729 | kernel_math_error(regs, "kernel x87 math error")) | 774 | kernel_math_error(regs, "kernel x87 math error", 16)) |
730 | return; | 775 | return; |
731 | 776 | ||
732 | /* | 777 | /* |
@@ -795,7 +840,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) | |||
795 | 840 | ||
796 | conditional_sti(regs); | 841 | conditional_sti(regs); |
797 | if (!user_mode(regs) && | 842 | if (!user_mode(regs) && |
798 | kernel_math_error(regs, "kernel simd math error")) | 843 | kernel_math_error(regs, "kernel simd math error", 19)) |
799 | return; | 844 | return; |
800 | 845 | ||
801 | /* | 846 | /* |
@@ -870,19 +915,14 @@ asmlinkage void math_state_restore(void) | |||
870 | me->thread_info->status |= TS_USEDFPU; | 915 | me->thread_info->status |= TS_USEDFPU; |
871 | } | 916 | } |
872 | 917 | ||
873 | void do_call_debug(struct pt_regs *regs) | ||
874 | { | ||
875 | notify_die(DIE_CALL, "debug call", regs, 0, 255, SIGINT); | ||
876 | } | ||
877 | |||
878 | void __init trap_init(void) | 918 | void __init trap_init(void) |
879 | { | 919 | { |
880 | set_intr_gate(0,÷_error); | 920 | set_intr_gate(0,÷_error); |
881 | set_intr_gate_ist(1,&debug,DEBUG_STACK); | 921 | set_intr_gate_ist(1,&debug,DEBUG_STACK); |
882 | set_intr_gate_ist(2,&nmi,NMI_STACK); | 922 | set_intr_gate_ist(2,&nmi,NMI_STACK); |
883 | set_system_gate(3,&int3); | 923 | set_system_gate_ist(3,&int3,DEBUG_STACK); /* int3 can be called from all */ |
884 | set_system_gate(4,&overflow); /* int4-5 can be called from all */ | 924 | set_system_gate(4,&overflow); /* int4 can be called from all */ |
885 | set_system_gate(5,&bounds); | 925 | set_intr_gate(5,&bounds); |
886 | set_intr_gate(6,&invalid_op); | 926 | set_intr_gate(6,&invalid_op); |
887 | set_intr_gate(7,&device_not_available); | 927 | set_intr_gate(7,&device_not_available); |
888 | set_intr_gate_ist(8,&double_fault, DOUBLEFAULT_STACK); | 928 | set_intr_gate_ist(8,&double_fault, DOUBLEFAULT_STACK); |
@@ -904,8 +944,6 @@ void __init trap_init(void) | |||
904 | set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall); | 944 | set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall); |
905 | #endif | 945 | #endif |
906 | 946 | ||
907 | set_intr_gate(KDB_VECTOR, call_debug); | ||
908 | |||
909 | /* | 947 | /* |
910 | * Should be a barrier for any external CPU state. | 948 | * Should be a barrier for any external CPU state. |
911 | */ | 949 | */ |
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index 58b19215b4b3..b0eed1faf740 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <asm/page.h> | 8 | #include <asm/page.h> |
9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
10 | 10 | ||
11 | #undef i386 /* in case the preprocessor is a 32bit one */ | ||
12 | |||
11 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") | 13 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") |
12 | OUTPUT_ARCH(i386:x86-64) | 14 | OUTPUT_ARCH(i386:x86-64) |
13 | ENTRY(phys_startup_64) | 15 | ENTRY(phys_startup_64) |
@@ -189,7 +191,7 @@ SECTIONS | |||
189 | /* Sections to be discarded */ | 191 | /* Sections to be discarded */ |
190 | /DISCARD/ : { | 192 | /DISCARD/ : { |
191 | *(.exitcall.exit) | 193 | *(.exitcall.exit) |
192 | #ifndef CONFIG_DEBUG_INFO | 194 | #ifndef CONFIG_UNWIND_INFO |
193 | *(.eh_frame) | 195 | *(.eh_frame) |
194 | #endif | 196 | #endif |
195 | } | 197 | } |
diff --git a/arch/x86_64/kernel/vsmp.c b/arch/x86_64/kernel/vsmp.c new file mode 100644 index 000000000000..92f70c74965f --- /dev/null +++ b/arch/x86_64/kernel/vsmp.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * vSMPowered(tm) systems specific initialization | ||
3 | * Copyright (C) 2005 ScaleMP Inc. | ||
4 | * | ||
5 | * Use of this code is subject to the terms and conditions of the | ||
6 | * GNU general public license version 2. See "COPYING" or | ||
7 | * http://www.gnu.org/licenses/gpl.html | ||
8 | * | ||
9 | * Ravikiran Thirumalai <kiran@scalemp.com>, | ||
10 | * Shai Fultheim <shai@scalemp.com> | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/pci_ids.h> | ||
15 | #include <linux/pci_regs.h> | ||
16 | #include <asm/pci-direct.h> | ||
17 | |||
18 | static int __init vsmp_init(void) | ||
19 | { | ||
20 | void *address; | ||
21 | unsigned int cap, ctl; | ||
22 | |||
23 | /* Check if we are running on a ScaleMP vSMP box */ | ||
24 | if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) != PCI_VENDOR_ID_SCALEMP) || | ||
25 | (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) != PCI_DEVICE_ID_SCALEMP_VSMP_CTL)) | ||
26 | return 0; | ||
27 | |||
28 | /* set vSMP magic bits to indicate vSMP capable kernel */ | ||
29 | address = ioremap(read_pci_config(0, 0x1f, 0, PCI_BASE_ADDRESS_0), 8); | ||
30 | cap = readl(address); | ||
31 | ctl = readl(address + 4); | ||
32 | printk("vSMP CTL: capabilities:0x%08x control:0x%08x\n", cap, ctl); | ||
33 | if (cap & ctl & (1 << 4)) { | ||
34 | /* Turn on vSMP IRQ fastpath handling (see system.h) */ | ||
35 | ctl &= ~(1 << 4); | ||
36 | writel(ctl, address + 4); | ||
37 | ctl = readl(address + 4); | ||
38 | printk("vSMP CTL: control set to:0x%08x\n", ctl); | ||
39 | } | ||
40 | |||
41 | iounmap(address); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | core_initcall(vsmp_init); | ||
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c index 70a0bd16085f..9468fb20b0bc 100644 --- a/arch/x86_64/kernel/vsyscall.c +++ b/arch/x86_64/kernel/vsyscall.c | |||
@@ -35,14 +35,13 @@ | |||
35 | #include <asm/io.h> | 35 | #include <asm/io.h> |
36 | 36 | ||
37 | #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) | 37 | #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) |
38 | #define force_inline __attribute__((always_inline)) inline | ||
39 | 38 | ||
40 | int __sysctl_vsyscall __section_sysctl_vsyscall = 1; | 39 | int __sysctl_vsyscall __section_sysctl_vsyscall = 1; |
41 | seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED; | 40 | seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED; |
42 | 41 | ||
43 | #include <asm/unistd.h> | 42 | #include <asm/unistd.h> |
44 | 43 | ||
45 | static force_inline void timeval_normalize(struct timeval * tv) | 44 | static __always_inline void timeval_normalize(struct timeval * tv) |
46 | { | 45 | { |
47 | time_t __sec; | 46 | time_t __sec; |
48 | 47 | ||
@@ -53,7 +52,7 @@ static force_inline void timeval_normalize(struct timeval * tv) | |||
53 | } | 52 | } |
54 | } | 53 | } |
55 | 54 | ||
56 | static force_inline void do_vgettimeofday(struct timeval * tv) | 55 | static __always_inline void do_vgettimeofday(struct timeval * tv) |
57 | { | 56 | { |
58 | long sequence, t; | 57 | long sequence, t; |
59 | unsigned long sec, usec; | 58 | unsigned long sec, usec; |
@@ -66,8 +65,7 @@ static force_inline void do_vgettimeofday(struct timeval * tv) | |||
66 | (__jiffies - __wall_jiffies) * (1000000 / HZ); | 65 | (__jiffies - __wall_jiffies) * (1000000 / HZ); |
67 | 66 | ||
68 | if (__vxtime.mode != VXTIME_HPET) { | 67 | if (__vxtime.mode != VXTIME_HPET) { |
69 | sync_core(); | 68 | t = get_cycles_sync(); |
70 | rdtscll(t); | ||
71 | if (t < __vxtime.last_tsc) | 69 | if (t < __vxtime.last_tsc) |
72 | t = __vxtime.last_tsc; | 70 | t = __vxtime.last_tsc; |
73 | usec += ((t - __vxtime.last_tsc) * | 71 | usec += ((t - __vxtime.last_tsc) * |
@@ -84,12 +82,12 @@ static force_inline void do_vgettimeofday(struct timeval * tv) | |||
84 | } | 82 | } |
85 | 83 | ||
86 | /* RED-PEN may want to readd seq locking, but then the variable should be write-once. */ | 84 | /* RED-PEN may want to readd seq locking, but then the variable should be write-once. */ |
87 | static force_inline void do_get_tz(struct timezone * tz) | 85 | static __always_inline void do_get_tz(struct timezone * tz) |
88 | { | 86 | { |
89 | *tz = __sys_tz; | 87 | *tz = __sys_tz; |
90 | } | 88 | } |
91 | 89 | ||
92 | static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz) | 90 | static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz) |
93 | { | 91 | { |
94 | int ret; | 92 | int ret; |
95 | asm volatile("vsysc2: syscall" | 93 | asm volatile("vsysc2: syscall" |
@@ -98,7 +96,7 @@ static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz) | |||
98 | return ret; | 96 | return ret; |
99 | } | 97 | } |
100 | 98 | ||
101 | static force_inline long time_syscall(long *t) | 99 | static __always_inline long time_syscall(long *t) |
102 | { | 100 | { |
103 | long secs; | 101 | long secs; |
104 | asm volatile("vsysc1: syscall" | 102 | asm volatile("vsysc1: syscall" |
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c index b7fd6681c629..b614d54d2ae4 100644 --- a/arch/x86_64/kernel/x8664_ksyms.c +++ b/arch/x86_64/kernel/x8664_ksyms.c | |||
@@ -44,22 +44,15 @@ extern struct drive_info_struct drive_info; | |||
44 | EXPORT_SYMBOL(drive_info); | 44 | EXPORT_SYMBOL(drive_info); |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | extern unsigned long get_cmos_time(void); | ||
48 | |||
49 | /* platform dependent support */ | 47 | /* platform dependent support */ |
50 | EXPORT_SYMBOL(boot_cpu_data); | 48 | EXPORT_SYMBOL(boot_cpu_data); |
51 | //EXPORT_SYMBOL(dump_fpu); | 49 | //EXPORT_SYMBOL(dump_fpu); |
52 | EXPORT_SYMBOL(__ioremap); | 50 | EXPORT_SYMBOL(__ioremap); |
53 | EXPORT_SYMBOL(ioremap_nocache); | 51 | EXPORT_SYMBOL(ioremap_nocache); |
54 | EXPORT_SYMBOL(iounmap); | 52 | EXPORT_SYMBOL(iounmap); |
55 | EXPORT_SYMBOL(enable_irq); | ||
56 | EXPORT_SYMBOL(disable_irq); | ||
57 | EXPORT_SYMBOL(disable_irq_nosync); | ||
58 | EXPORT_SYMBOL(probe_irq_mask); | ||
59 | EXPORT_SYMBOL(kernel_thread); | 53 | EXPORT_SYMBOL(kernel_thread); |
60 | EXPORT_SYMBOL(pm_idle); | 54 | EXPORT_SYMBOL(pm_idle); |
61 | EXPORT_SYMBOL(pm_power_off); | 55 | EXPORT_SYMBOL(pm_power_off); |
62 | EXPORT_SYMBOL(get_cmos_time); | ||
63 | 56 | ||
64 | EXPORT_SYMBOL(__down_failed); | 57 | EXPORT_SYMBOL(__down_failed); |
65 | EXPORT_SYMBOL(__down_failed_interruptible); | 58 | EXPORT_SYMBOL(__down_failed_interruptible); |
@@ -83,9 +76,6 @@ EXPORT_SYMBOL(__put_user_2); | |||
83 | EXPORT_SYMBOL(__put_user_4); | 76 | EXPORT_SYMBOL(__put_user_4); |
84 | EXPORT_SYMBOL(__put_user_8); | 77 | EXPORT_SYMBOL(__put_user_8); |
85 | 78 | ||
86 | EXPORT_SYMBOL(strpbrk); | ||
87 | EXPORT_SYMBOL(strstr); | ||
88 | |||
89 | EXPORT_SYMBOL(strncpy_from_user); | 79 | EXPORT_SYMBOL(strncpy_from_user); |
90 | EXPORT_SYMBOL(__strncpy_from_user); | 80 | EXPORT_SYMBOL(__strncpy_from_user); |
91 | EXPORT_SYMBOL(clear_user); | 81 | EXPORT_SYMBOL(clear_user); |
@@ -97,25 +87,18 @@ EXPORT_SYMBOL(copy_in_user); | |||
97 | EXPORT_SYMBOL(strnlen_user); | 87 | EXPORT_SYMBOL(strnlen_user); |
98 | 88 | ||
99 | #ifdef CONFIG_PCI | 89 | #ifdef CONFIG_PCI |
100 | EXPORT_SYMBOL(pci_alloc_consistent); | ||
101 | EXPORT_SYMBOL(pci_free_consistent); | ||
102 | #endif | ||
103 | |||
104 | #ifdef CONFIG_PCI | ||
105 | EXPORT_SYMBOL(pci_mem_start); | 90 | EXPORT_SYMBOL(pci_mem_start); |
106 | #endif | 91 | #endif |
107 | 92 | ||
108 | EXPORT_SYMBOL(copy_page); | 93 | EXPORT_SYMBOL(copy_page); |
109 | EXPORT_SYMBOL(clear_page); | 94 | EXPORT_SYMBOL(clear_page); |
110 | 95 | ||
111 | EXPORT_SYMBOL(cpu_pda); | 96 | EXPORT_SYMBOL(_cpu_pda); |
112 | #ifdef CONFIG_SMP | 97 | #ifdef CONFIG_SMP |
113 | EXPORT_SYMBOL(cpu_data); | 98 | EXPORT_SYMBOL(cpu_data); |
114 | EXPORT_SYMBOL(cpu_online_map); | ||
115 | EXPORT_SYMBOL(__write_lock_failed); | 99 | EXPORT_SYMBOL(__write_lock_failed); |
116 | EXPORT_SYMBOL(__read_lock_failed); | 100 | EXPORT_SYMBOL(__read_lock_failed); |
117 | 101 | ||
118 | EXPORT_SYMBOL(synchronize_irq); | ||
119 | EXPORT_SYMBOL(smp_call_function); | 102 | EXPORT_SYMBOL(smp_call_function); |
120 | EXPORT_SYMBOL(cpu_callout_map); | 103 | EXPORT_SYMBOL(cpu_callout_map); |
121 | #endif | 104 | #endif |
@@ -136,30 +119,17 @@ EXPORT_SYMBOL_GPL(unset_nmi_callback); | |||
136 | #undef memcpy | 119 | #undef memcpy |
137 | #undef memset | 120 | #undef memset |
138 | #undef memmove | 121 | #undef memmove |
139 | #undef memchr | ||
140 | #undef strlen | 122 | #undef strlen |
141 | #undef strncmp | ||
142 | #undef strncpy | ||
143 | #undef strchr | ||
144 | 123 | ||
145 | extern void * memset(void *,int,__kernel_size_t); | 124 | extern void * memset(void *,int,__kernel_size_t); |
146 | extern size_t strlen(const char *); | 125 | extern size_t strlen(const char *); |
147 | extern void * memmove(void * dest,const void *src,size_t count); | 126 | extern void * memmove(void * dest,const void *src,size_t count); |
148 | extern void *memchr(const void *s, int c, size_t n); | ||
149 | extern void * memcpy(void *,const void *,__kernel_size_t); | 127 | extern void * memcpy(void *,const void *,__kernel_size_t); |
150 | extern void * __memcpy(void *,const void *,__kernel_size_t); | 128 | extern void * __memcpy(void *,const void *,__kernel_size_t); |
151 | 129 | ||
152 | EXPORT_SYMBOL(memset); | 130 | EXPORT_SYMBOL(memset); |
153 | EXPORT_SYMBOL(strlen); | 131 | EXPORT_SYMBOL(strlen); |
154 | EXPORT_SYMBOL(memmove); | 132 | EXPORT_SYMBOL(memmove); |
155 | EXPORT_SYMBOL(strncmp); | ||
156 | EXPORT_SYMBOL(strncpy); | ||
157 | EXPORT_SYMBOL(strchr); | ||
158 | EXPORT_SYMBOL(strncat); | ||
159 | EXPORT_SYMBOL(memchr); | ||
160 | EXPORT_SYMBOL(strrchr); | ||
161 | EXPORT_SYMBOL(strnlen); | ||
162 | EXPORT_SYMBOL(memscan); | ||
163 | EXPORT_SYMBOL(memcpy); | 133 | EXPORT_SYMBOL(memcpy); |
164 | EXPORT_SYMBOL(__memcpy); | 134 | EXPORT_SYMBOL(__memcpy); |
165 | 135 | ||
diff --git a/arch/x86_64/lib/copy_user.S b/arch/x86_64/lib/copy_user.S index dfa358b05c89..79422b6559c3 100644 --- a/arch/x86_64/lib/copy_user.S +++ b/arch/x86_64/lib/copy_user.S | |||
@@ -4,12 +4,9 @@ | |||
4 | * Functions to copy from and to user space. | 4 | * Functions to copy from and to user space. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #define FIX_ALIGNMENT 1 | ||
8 | |||
9 | #include <asm/current.h> | 7 | #include <asm/current.h> |
10 | #include <asm/asm-offsets.h> | 8 | #include <asm/asm-offsets.h> |
11 | #include <asm/thread_info.h> | 9 | #include <asm/thread_info.h> |
12 | #include <asm/cpufeature.h> | ||
13 | 10 | ||
14 | /* Standard copy_to_user with segment limit checking */ | 11 | /* Standard copy_to_user with segment limit checking */ |
15 | .globl copy_to_user | 12 | .globl copy_to_user |
@@ -21,23 +18,7 @@ copy_to_user: | |||
21 | jc bad_to_user | 18 | jc bad_to_user |
22 | cmpq threadinfo_addr_limit(%rax),%rcx | 19 | cmpq threadinfo_addr_limit(%rax),%rcx |
23 | jae bad_to_user | 20 | jae bad_to_user |
24 | 2: | 21 | jmp copy_user_generic |
25 | .byte 0xe9 /* 32bit jump */ | ||
26 | .long .Lcug-1f | ||
27 | 1: | ||
28 | |||
29 | .section .altinstr_replacement,"ax" | ||
30 | 3: .byte 0xe9 /* replacement jmp with 8 bit immediate */ | ||
31 | .long copy_user_generic_c-1b /* offset */ | ||
32 | .previous | ||
33 | .section .altinstructions,"a" | ||
34 | .align 8 | ||
35 | .quad 2b | ||
36 | .quad 3b | ||
37 | .byte X86_FEATURE_K8_C | ||
38 | .byte 5 | ||
39 | .byte 5 | ||
40 | .previous | ||
41 | 22 | ||
42 | /* Standard copy_from_user with segment limit checking */ | 23 | /* Standard copy_from_user with segment limit checking */ |
43 | .globl copy_from_user | 24 | .globl copy_from_user |
@@ -72,223 +53,44 @@ bad_to_user: | |||
72 | * rsi source | 53 | * rsi source |
73 | * rdx count | 54 | * rdx count |
74 | * | 55 | * |
56 | * Only 4GB of copy is supported. This shouldn't be a problem | ||
57 | * because the kernel normally only writes from/to page sized chunks | ||
58 | * even if user space passed a longer buffer. | ||
59 | * And more would be dangerous because both Intel and AMD have | ||
60 | * errata with rep movsq > 4GB. If someone feels the need to fix | ||
61 | * this please consider this. | ||
62 | * | ||
75 | * Output: | 63 | * Output: |
76 | * eax uncopied bytes or 0 if successful. | 64 | * eax uncopied bytes or 0 if successful. |
77 | */ | 65 | */ |
78 | .globl copy_user_generic | ||
79 | .p2align 4 | ||
80 | copy_user_generic: | ||
81 | .byte 0x66,0x66,0x90 /* 5 byte nop for replacement jump */ | ||
82 | .byte 0x66,0x90 | ||
83 | 1: | ||
84 | .section .altinstr_replacement,"ax" | ||
85 | 2: .byte 0xe9 /* near jump with 32bit immediate */ | ||
86 | .long copy_user_generic_c-1b /* offset */ | ||
87 | .previous | ||
88 | .section .altinstructions,"a" | ||
89 | .align 8 | ||
90 | .quad copy_user_generic | ||
91 | .quad 2b | ||
92 | .byte X86_FEATURE_K8_C | ||
93 | .byte 5 | ||
94 | .byte 5 | ||
95 | .previous | ||
96 | .Lcug: | ||
97 | pushq %rbx | ||
98 | xorl %eax,%eax /*zero for the exception handler */ | ||
99 | |||
100 | #ifdef FIX_ALIGNMENT | ||
101 | /* check for bad alignment of destination */ | ||
102 | movl %edi,%ecx | ||
103 | andl $7,%ecx | ||
104 | jnz .Lbad_alignment | ||
105 | .Lafter_bad_alignment: | ||
106 | #endif | ||
107 | 66 | ||
108 | movq %rdx,%rcx | 67 | .globl copy_user_generic |
109 | 68 | copy_user_generic: | |
110 | movl $64,%ebx | ||
111 | shrq $6,%rdx | ||
112 | decq %rdx | ||
113 | js .Lhandle_tail | ||
114 | |||
115 | .p2align 4 | ||
116 | .Lloop: | ||
117 | .Ls1: movq (%rsi),%r11 | ||
118 | .Ls2: movq 1*8(%rsi),%r8 | ||
119 | .Ls3: movq 2*8(%rsi),%r9 | ||
120 | .Ls4: movq 3*8(%rsi),%r10 | ||
121 | .Ld1: movq %r11,(%rdi) | ||
122 | .Ld2: movq %r8,1*8(%rdi) | ||
123 | .Ld3: movq %r9,2*8(%rdi) | ||
124 | .Ld4: movq %r10,3*8(%rdi) | ||
125 | |||
126 | .Ls5: movq 4*8(%rsi),%r11 | ||
127 | .Ls6: movq 5*8(%rsi),%r8 | ||
128 | .Ls7: movq 6*8(%rsi),%r9 | ||
129 | .Ls8: movq 7*8(%rsi),%r10 | ||
130 | .Ld5: movq %r11,4*8(%rdi) | ||
131 | .Ld6: movq %r8,5*8(%rdi) | ||
132 | .Ld7: movq %r9,6*8(%rdi) | ||
133 | .Ld8: movq %r10,7*8(%rdi) | ||
134 | |||
135 | decq %rdx | ||
136 | |||
137 | leaq 64(%rsi),%rsi | ||
138 | leaq 64(%rdi),%rdi | ||
139 | |||
140 | jns .Lloop | ||
141 | |||
142 | .p2align 4 | ||
143 | .Lhandle_tail: | ||
144 | movl %ecx,%edx | ||
145 | andl $63,%ecx | ||
146 | shrl $3,%ecx | ||
147 | jz .Lhandle_7 | ||
148 | movl $8,%ebx | ||
149 | .p2align 4 | ||
150 | .Lloop_8: | ||
151 | .Ls9: movq (%rsi),%r8 | ||
152 | .Ld9: movq %r8,(%rdi) | ||
153 | decl %ecx | ||
154 | leaq 8(%rdi),%rdi | ||
155 | leaq 8(%rsi),%rsi | ||
156 | jnz .Lloop_8 | ||
157 | |||
158 | .Lhandle_7: | ||
159 | movl %edx,%ecx | ||
160 | andl $7,%ecx | ||
161 | jz .Lende | ||
162 | .p2align 4 | ||
163 | .Lloop_1: | ||
164 | .Ls10: movb (%rsi),%bl | ||
165 | .Ld10: movb %bl,(%rdi) | ||
166 | incq %rdi | ||
167 | incq %rsi | ||
168 | decl %ecx | ||
169 | jnz .Lloop_1 | ||
170 | |||
171 | .Lende: | ||
172 | popq %rbx | ||
173 | ret | ||
174 | |||
175 | #ifdef FIX_ALIGNMENT | ||
176 | /* align destination */ | ||
177 | .p2align 4 | ||
178 | .Lbad_alignment: | ||
179 | movl $8,%r9d | ||
180 | subl %ecx,%r9d | ||
181 | movl %r9d,%ecx | ||
182 | cmpq %r9,%rdx | ||
183 | jz .Lhandle_7 | ||
184 | js .Lhandle_7 | ||
185 | .Lalign_1: | ||
186 | .Ls11: movb (%rsi),%bl | ||
187 | .Ld11: movb %bl,(%rdi) | ||
188 | incq %rsi | ||
189 | incq %rdi | ||
190 | decl %ecx | ||
191 | jnz .Lalign_1 | ||
192 | subq %r9,%rdx | ||
193 | jmp .Lafter_bad_alignment | ||
194 | #endif | ||
195 | |||
196 | /* table sorted by exception address */ | ||
197 | .section __ex_table,"a" | ||
198 | .align 8 | ||
199 | .quad .Ls1,.Ls1e | ||
200 | .quad .Ls2,.Ls2e | ||
201 | .quad .Ls3,.Ls3e | ||
202 | .quad .Ls4,.Ls4e | ||
203 | .quad .Ld1,.Ls1e | ||
204 | .quad .Ld2,.Ls2e | ||
205 | .quad .Ld3,.Ls3e | ||
206 | .quad .Ld4,.Ls4e | ||
207 | .quad .Ls5,.Ls5e | ||
208 | .quad .Ls6,.Ls6e | ||
209 | .quad .Ls7,.Ls7e | ||
210 | .quad .Ls8,.Ls8e | ||
211 | .quad .Ld5,.Ls5e | ||
212 | .quad .Ld6,.Ls6e | ||
213 | .quad .Ld7,.Ls7e | ||
214 | .quad .Ld8,.Ls8e | ||
215 | .quad .Ls9,.Le_quad | ||
216 | .quad .Ld9,.Le_quad | ||
217 | .quad .Ls10,.Le_byte | ||
218 | .quad .Ld10,.Le_byte | ||
219 | #ifdef FIX_ALIGNMENT | ||
220 | .quad .Ls11,.Lzero_rest | ||
221 | .quad .Ld11,.Lzero_rest | ||
222 | #endif | ||
223 | .quad .Le5,.Le_zero | ||
224 | .previous | ||
225 | |||
226 | /* compute 64-offset for main loop. 8 bytes accuracy with error on the | ||
227 | pessimistic side. this is gross. it would be better to fix the | ||
228 | interface. */ | ||
229 | /* eax: zero, ebx: 64 */ | ||
230 | .Ls1e: addl $8,%eax | ||
231 | .Ls2e: addl $8,%eax | ||
232 | .Ls3e: addl $8,%eax | ||
233 | .Ls4e: addl $8,%eax | ||
234 | .Ls5e: addl $8,%eax | ||
235 | .Ls6e: addl $8,%eax | ||
236 | .Ls7e: addl $8,%eax | ||
237 | .Ls8e: addl $8,%eax | ||
238 | addq %rbx,%rdi /* +64 */ | ||
239 | subq %rax,%rdi /* correct destination with computed offset */ | ||
240 | |||
241 | shlq $6,%rdx /* loop counter * 64 (stride length) */ | ||
242 | addq %rax,%rdx /* add offset to loopcnt */ | ||
243 | andl $63,%ecx /* remaining bytes */ | ||
244 | addq %rcx,%rdx /* add them */ | ||
245 | jmp .Lzero_rest | ||
246 | |||
247 | /* exception on quad word loop in tail handling */ | ||
248 | /* ecx: loopcnt/8, %edx: length, rdi: correct */ | ||
249 | .Le_quad: | ||
250 | shll $3,%ecx | ||
251 | andl $7,%edx | ||
252 | addl %ecx,%edx | ||
253 | /* edx: bytes to zero, rdi: dest, eax:zero */ | ||
254 | .Lzero_rest: | ||
255 | movq %rdx,%rcx | ||
256 | .Le_byte: | ||
257 | xorl %eax,%eax | ||
258 | .Le5: rep | ||
259 | stosb | ||
260 | /* when there is another exception while zeroing the rest just return */ | ||
261 | .Le_zero: | ||
262 | movq %rdx,%rax | ||
263 | jmp .Lende | ||
264 | |||
265 | /* C stepping K8 run faster using the string copy instructions. | ||
266 | This is also a lot simpler. Use them when possible. | ||
267 | Patch in jmps to this code instead of copying it fully | ||
268 | to avoid unwanted aliasing in the exception tables. */ | ||
269 | |||
270 | /* rdi destination | ||
271 | * rsi source | ||
272 | * rdx count | ||
273 | * | ||
274 | * Output: | ||
275 | * eax uncopied bytes or 0 if successfull. | ||
276 | */ | ||
277 | copy_user_generic_c: | ||
278 | movl %edx,%ecx | 69 | movl %edx,%ecx |
279 | shrl $3,%ecx | 70 | shrl $3,%ecx |
280 | andl $7,%edx | 71 | andl $7,%edx |
72 | jz 5f | ||
281 | 1: rep | 73 | 1: rep |
282 | movsq | 74 | movsq |
283 | movl %edx,%ecx | 75 | movl %edx,%ecx |
76 | xor %eax,%eax | ||
284 | 2: rep | 77 | 2: rep |
285 | movsb | 78 | movsb |
286 | 4: movl %ecx,%eax | ||
287 | ret | 79 | ret |
80 | /* align here? */ | ||
81 | 5: xorl %eax,%eax | ||
82 | 6: rep movsq | ||
83 | ret | ||
84 | |||
85 | .section .fixup,"ax" | ||
288 | 3: lea (%rdx,%rcx,8),%rax | 86 | 3: lea (%rdx,%rcx,8),%rax |
289 | ret | 87 | ret |
290 | 88 | 4: movl %ecx,%eax | |
89 | ret | ||
90 | .previous | ||
91 | |||
291 | .section __ex_table,"a" | 92 | .section __ex_table,"a" |
292 | .quad 1b,3b | 93 | .quad 1b,3b |
293 | .quad 2b,4b | 94 | .quad 2b,4b |
95 | .quad 6b,4b | ||
294 | .previous | 96 | .previous |
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c index 841bd738a189..03c460cbdd1c 100644 --- a/arch/x86_64/lib/delay.c +++ b/arch/x86_64/lib/delay.c | |||
@@ -39,7 +39,7 @@ void __delay(unsigned long loops) | |||
39 | 39 | ||
40 | inline void __const_udelay(unsigned long xloops) | 40 | inline void __const_udelay(unsigned long xloops) |
41 | { | 41 | { |
42 | __delay(((xloops * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) * HZ); | 42 | __delay((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32); |
43 | } | 43 | } |
44 | 44 | ||
45 | void __udelay(unsigned long usecs) | 45 | void __udelay(unsigned long usecs) |
diff --git a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c index db8abba1ad81..9bc2c295818e 100644 --- a/arch/x86_64/lib/usercopy.c +++ b/arch/x86_64/lib/usercopy.c | |||
@@ -109,14 +109,11 @@ unsigned long clear_user(void __user *to, unsigned long n) | |||
109 | * Return 0 on exception, a value greater than N if too long | 109 | * Return 0 on exception, a value greater than N if too long |
110 | */ | 110 | */ |
111 | 111 | ||
112 | long strnlen_user(const char __user *s, long n) | 112 | long __strnlen_user(const char __user *s, long n) |
113 | { | 113 | { |
114 | long res = 0; | 114 | long res = 0; |
115 | char c; | 115 | char c; |
116 | 116 | ||
117 | if (!access_ok(VERIFY_READ, s, n)) | ||
118 | return 0; | ||
119 | |||
120 | while (1) { | 117 | while (1) { |
121 | if (res>n) | 118 | if (res>n) |
122 | return n+1; | 119 | return n+1; |
@@ -129,6 +126,13 @@ long strnlen_user(const char __user *s, long n) | |||
129 | } | 126 | } |
130 | } | 127 | } |
131 | 128 | ||
129 | long strnlen_user(const char __user *s, long n) | ||
130 | { | ||
131 | if (!access_ok(VERIFY_READ, s, n)) | ||
132 | return 0; | ||
133 | return __strnlen_user(s, n); | ||
134 | } | ||
135 | |||
132 | long strlen_user(const char __user *s) | 136 | long strlen_user(const char __user *s) |
133 | { | 137 | { |
134 | long res = 0; | 138 | long res = 0; |
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index 3a63707a698b..26eac194064b 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c | |||
@@ -35,6 +35,13 @@ | |||
35 | #include <asm-generic/sections.h> | 35 | #include <asm-generic/sections.h> |
36 | #include <asm/kdebug.h> | 36 | #include <asm/kdebug.h> |
37 | 37 | ||
38 | /* Page fault error code bits */ | ||
39 | #define PF_PROT (1<<0) /* or no page found */ | ||
40 | #define PF_WRITE (1<<1) | ||
41 | #define PF_USER (1<<2) | ||
42 | #define PF_RSVD (1<<3) | ||
43 | #define PF_INSTR (1<<4) | ||
44 | |||
38 | void bust_spinlocks(int yes) | 45 | void bust_spinlocks(int yes) |
39 | { | 46 | { |
40 | int loglevel_save = console_loglevel; | 47 | int loglevel_save = console_loglevel; |
@@ -68,7 +75,7 @@ static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr, | |||
68 | unsigned char *max_instr; | 75 | unsigned char *max_instr; |
69 | 76 | ||
70 | /* If it was a exec fault ignore */ | 77 | /* If it was a exec fault ignore */ |
71 | if (error_code & (1<<4)) | 78 | if (error_code & PF_INSTR) |
72 | return 0; | 79 | return 0; |
73 | 80 | ||
74 | instr = (unsigned char *)convert_rip_to_linear(current, regs); | 81 | instr = (unsigned char *)convert_rip_to_linear(current, regs); |
@@ -222,17 +229,22 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs, | |||
222 | unsigned long error_code) | 229 | unsigned long error_code) |
223 | { | 230 | { |
224 | unsigned long flags = oops_begin(); | 231 | unsigned long flags = oops_begin(); |
232 | struct task_struct *tsk; | ||
225 | 233 | ||
226 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", | 234 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", |
227 | current->comm, address); | 235 | current->comm, address); |
228 | dump_pagetable(address); | 236 | dump_pagetable(address); |
237 | tsk = current; | ||
238 | tsk->thread.cr2 = address; | ||
239 | tsk->thread.trap_no = 14; | ||
240 | tsk->thread.error_code = error_code; | ||
229 | __die("Bad pagetable", regs, error_code); | 241 | __die("Bad pagetable", regs, error_code); |
230 | oops_end(flags); | 242 | oops_end(flags); |
231 | do_exit(SIGKILL); | 243 | do_exit(SIGKILL); |
232 | } | 244 | } |
233 | 245 | ||
234 | /* | 246 | /* |
235 | * Handle a fault on the vmalloc or module mapping area | 247 | * Handle a fault on the vmalloc area |
236 | * | 248 | * |
237 | * This assumes no large pages in there. | 249 | * This assumes no large pages in there. |
238 | */ | 250 | */ |
@@ -278,7 +290,6 @@ static int vmalloc_fault(unsigned long address) | |||
278 | that. */ | 290 | that. */ |
279 | if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref)) | 291 | if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref)) |
280 | BUG(); | 292 | BUG(); |
281 | __flush_tlb_all(); | ||
282 | return 0; | 293 | return 0; |
283 | } | 294 | } |
284 | 295 | ||
@@ -289,12 +300,6 @@ int exception_trace = 1; | |||
289 | * This routine handles page faults. It determines the address, | 300 | * This routine handles page faults. It determines the address, |
290 | * and the problem, and then passes it off to one of the appropriate | 301 | * and the problem, and then passes it off to one of the appropriate |
291 | * routines. | 302 | * routines. |
292 | * | ||
293 | * error_code: | ||
294 | * bit 0 == 0 means no page found, 1 means protection fault | ||
295 | * bit 1 == 0 means read, 1 means write | ||
296 | * bit 2 == 0 means kernel, 1 means user-mode | ||
297 | * bit 3 == 1 means fault was an instruction fetch | ||
298 | */ | 303 | */ |
299 | asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | 304 | asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, |
300 | unsigned long error_code) | 305 | unsigned long error_code) |
@@ -337,12 +342,16 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
337 | * | 342 | * |
338 | * This verifies that the fault happens in kernel space | 343 | * This verifies that the fault happens in kernel space |
339 | * (error_code & 4) == 0, and that the fault was not a | 344 | * (error_code & 4) == 0, and that the fault was not a |
340 | * protection error (error_code & 1) == 0. | 345 | * protection error (error_code & 9) == 0. |
341 | */ | 346 | */ |
342 | if (unlikely(address >= TASK_SIZE64)) { | 347 | if (unlikely(address >= TASK_SIZE64)) { |
343 | if (!(error_code & 5) && | 348 | /* |
344 | ((address >= VMALLOC_START && address < VMALLOC_END) || | 349 | * Don't check for the module range here: its PML4 |
345 | (address >= MODULES_VADDR && address < MODULES_END))) { | 350 | * is always initialized because it's shared with the main |
351 | * kernel text. Only vmalloc may need PML4 syncups. | ||
352 | */ | ||
353 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && | ||
354 | ((address >= VMALLOC_START && address < VMALLOC_END))) { | ||
346 | if (vmalloc_fault(address) < 0) | 355 | if (vmalloc_fault(address) < 0) |
347 | goto bad_area_nosemaphore; | 356 | goto bad_area_nosemaphore; |
348 | return; | 357 | return; |
@@ -354,7 +363,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
354 | goto bad_area_nosemaphore; | 363 | goto bad_area_nosemaphore; |
355 | } | 364 | } |
356 | 365 | ||
357 | if (unlikely(error_code & (1 << 3))) | 366 | if (unlikely(error_code & PF_RSVD)) |
358 | pgtable_bad(address, regs, error_code); | 367 | pgtable_bad(address, regs, error_code); |
359 | 368 | ||
360 | /* | 369 | /* |
@@ -381,7 +390,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
381 | * thus avoiding the deadlock. | 390 | * thus avoiding the deadlock. |
382 | */ | 391 | */ |
383 | if (!down_read_trylock(&mm->mmap_sem)) { | 392 | if (!down_read_trylock(&mm->mmap_sem)) { |
384 | if ((error_code & 4) == 0 && | 393 | if ((error_code & PF_USER) == 0 && |
385 | !search_exception_tables(regs->rip)) | 394 | !search_exception_tables(regs->rip)) |
386 | goto bad_area_nosemaphore; | 395 | goto bad_area_nosemaphore; |
387 | down_read(&mm->mmap_sem); | 396 | down_read(&mm->mmap_sem); |
@@ -408,17 +417,17 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, | |||
408 | good_area: | 417 | good_area: |
409 | info.si_code = SEGV_ACCERR; | 418 | info.si_code = SEGV_ACCERR; |
410 | write = 0; | 419 | write = 0; |
411 | switch (error_code & 3) { | 420 | switch (error_code & (PF_PROT|PF_WRITE)) { |
412 | default: /* 3: write, present */ | 421 | default: /* 3: write, present */ |
413 | /* fall through */ | 422 | /* fall through */ |
414 | case 2: /* write, not present */ | 423 | case PF_WRITE: /* write, not present */ |
415 | if (!(vma->vm_flags & VM_WRITE)) | 424 | if (!(vma->vm_flags & VM_WRITE)) |
416 | goto bad_area; | 425 | goto bad_area; |
417 | write++; | 426 | write++; |
418 | break; | 427 | break; |
419 | case 1: /* read, present */ | 428 | case PF_PROT: /* read, present */ |
420 | goto bad_area; | 429 | goto bad_area; |
421 | case 0: /* read, not present */ | 430 | case 0: /* read, not present */ |
422 | if (!(vma->vm_flags & (VM_READ | VM_EXEC))) | 431 | if (!(vma->vm_flags & (VM_READ | VM_EXEC))) |
423 | goto bad_area; | 432 | goto bad_area; |
424 | } | 433 | } |
@@ -453,7 +462,7 @@ bad_area: | |||
453 | 462 | ||
454 | bad_area_nosemaphore: | 463 | bad_area_nosemaphore: |
455 | /* User mode accesses just cause a SIGSEGV */ | 464 | /* User mode accesses just cause a SIGSEGV */ |
456 | if (error_code & 4) { | 465 | if (error_code & PF_USER) { |
457 | if (is_prefetch(regs, address, error_code)) | 466 | if (is_prefetch(regs, address, error_code)) |
458 | return; | 467 | return; |
459 | 468 | ||
@@ -521,6 +530,9 @@ no_context: | |||
521 | printk_address(regs->rip); | 530 | printk_address(regs->rip); |
522 | printk("\n"); | 531 | printk("\n"); |
523 | dump_pagetable(address); | 532 | dump_pagetable(address); |
533 | tsk->thread.cr2 = address; | ||
534 | tsk->thread.trap_no = 14; | ||
535 | tsk->thread.error_code = error_code; | ||
524 | __die("Oops", regs, error_code); | 536 | __die("Oops", regs, error_code); |
525 | /* Executive summary in case the body of the oops scrolled away */ | 537 | /* Executive summary in case the body of the oops scrolled away */ |
526 | printk(KERN_EMERG "CR2: %016lx\n", address); | 538 | printk(KERN_EMERG "CR2: %016lx\n", address); |
@@ -546,7 +558,7 @@ do_sigbus: | |||
546 | up_read(&mm->mmap_sem); | 558 | up_read(&mm->mmap_sem); |
547 | 559 | ||
548 | /* Kernel mode? Handle exceptions or die */ | 560 | /* Kernel mode? Handle exceptions or die */ |
549 | if (!(error_code & 4)) | 561 | if (!(error_code & PF_USER)) |
550 | goto no_context; | 562 | goto no_context; |
551 | 563 | ||
552 | tsk->thread.cr2 = address; | 564 | tsk->thread.cr2 = address; |
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 1faae5fc1c01..eca60125efc3 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_fs.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/dma-mapping.h> | ||
26 | 27 | ||
27 | #include <asm/processor.h> | 28 | #include <asm/processor.h> |
28 | #include <asm/system.h> | 29 | #include <asm/system.h> |
@@ -38,11 +39,16 @@ | |||
38 | #include <asm/proto.h> | 39 | #include <asm/proto.h> |
39 | #include <asm/smp.h> | 40 | #include <asm/smp.h> |
40 | #include <asm/sections.h> | 41 | #include <asm/sections.h> |
42 | #include <asm/dma-mapping.h> | ||
43 | #include <asm/swiotlb.h> | ||
41 | 44 | ||
42 | #ifndef Dprintk | 45 | #ifndef Dprintk |
43 | #define Dprintk(x...) | 46 | #define Dprintk(x...) |
44 | #endif | 47 | #endif |
45 | 48 | ||
49 | struct dma_mapping_ops* dma_ops; | ||
50 | EXPORT_SYMBOL(dma_ops); | ||
51 | |||
46 | static unsigned long dma_reserve __initdata; | 52 | static unsigned long dma_reserve __initdata; |
47 | 53 | ||
48 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | 54 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
@@ -249,14 +255,26 @@ static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned lon | |||
249 | 255 | ||
250 | static void __init find_early_table_space(unsigned long end) | 256 | static void __init find_early_table_space(unsigned long end) |
251 | { | 257 | { |
252 | unsigned long puds, pmds, tables; | 258 | unsigned long puds, pmds, tables, start; |
253 | 259 | ||
254 | puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; | 260 | puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; |
255 | pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; | 261 | pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; |
256 | tables = round_up(puds * sizeof(pud_t), PAGE_SIZE) + | 262 | tables = round_up(puds * sizeof(pud_t), PAGE_SIZE) + |
257 | round_up(pmds * sizeof(pmd_t), PAGE_SIZE); | 263 | round_up(pmds * sizeof(pmd_t), PAGE_SIZE); |
258 | 264 | ||
259 | table_start = find_e820_area(0x8000, __pa_symbol(&_text), tables); | 265 | /* Put page tables beyond the DMA zones if possible. |
266 | RED-PEN might be better to spread them out more over | ||
267 | memory to avoid hotspots */ | ||
268 | if (end > MAX_DMA32_PFN<<PAGE_SHIFT) | ||
269 | start = MAX_DMA32_PFN << PAGE_SHIFT; | ||
270 | else if (end > MAX_DMA_PFN << PAGE_SHIFT) | ||
271 | start = MAX_DMA_PFN << PAGE_SHIFT; | ||
272 | else | ||
273 | start = 0x8000; | ||
274 | |||
275 | table_start = find_e820_area(start, end, tables); | ||
276 | if (table_start == -1) | ||
277 | table_start = find_e820_area(0x8000, end, tables); | ||
260 | if (table_start == -1UL) | 278 | if (table_start == -1UL) |
261 | panic("Cannot find space for the kernel page tables"); | 279 | panic("Cannot find space for the kernel page tables"); |
262 | 280 | ||
@@ -423,12 +441,9 @@ void __init mem_init(void) | |||
423 | long codesize, reservedpages, datasize, initsize; | 441 | long codesize, reservedpages, datasize, initsize; |
424 | 442 | ||
425 | #ifdef CONFIG_SWIOTLB | 443 | #ifdef CONFIG_SWIOTLB |
426 | if (!iommu_aperture && | 444 | pci_swiotlb_init(); |
427 | (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu)) | ||
428 | swiotlb = 1; | ||
429 | if (swiotlb) | ||
430 | swiotlb_init(); | ||
431 | #endif | 445 | #endif |
446 | no_iommu_init(); | ||
432 | 447 | ||
433 | /* How many end-of-memory variables you have, grandma! */ | 448 | /* How many end-of-memory variables you have, grandma! */ |
434 | max_low_pfn = end_pfn; | 449 | max_low_pfn = end_pfn; |
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index 15b67d2760cb..6ef9f9a76235 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -46,8 +46,8 @@ int numa_off __initdata; | |||
46 | * 0 if memnodmap[] too small (of shift too small) | 46 | * 0 if memnodmap[] too small (of shift too small) |
47 | * -1 if node overlap or lost ram (shift too big) | 47 | * -1 if node overlap or lost ram (shift too big) |
48 | */ | 48 | */ |
49 | static int __init populate_memnodemap( | 49 | static int __init |
50 | const struct node *nodes, int numnodes, int shift) | 50 | populate_memnodemap(const struct node *nodes, int numnodes, int shift) |
51 | { | 51 | { |
52 | int i; | 52 | int i; |
53 | int res = -1; | 53 | int res = -1; |
@@ -81,7 +81,7 @@ int __init compute_hash_shift(struct node *nodes, int numnodes) | |||
81 | while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0) | 81 | while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0) |
82 | shift++; | 82 | shift++; |
83 | 83 | ||
84 | printk(KERN_DEBUG "Using %d for the hash shift.\n", | 84 | printk(KERN_DEBUG "NUMA: Using %d for the hash shift.\n", |
85 | shift); | 85 | shift); |
86 | 86 | ||
87 | if (populate_memnodemap(nodes, numnodes, shift) != 1) { | 87 | if (populate_memnodemap(nodes, numnodes, shift) != 1) { |
@@ -110,7 +110,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en | |||
110 | 110 | ||
111 | start = round_up(start, ZONE_ALIGN); | 111 | start = round_up(start, ZONE_ALIGN); |
112 | 112 | ||
113 | printk("Bootmem setup node %d %016lx-%016lx\n", nodeid, start, end); | 113 | printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid, start, end); |
114 | 114 | ||
115 | start_pfn = start >> PAGE_SHIFT; | 115 | start_pfn = start >> PAGE_SHIFT; |
116 | end_pfn = end >> PAGE_SHIFT; | 116 | end_pfn = end >> PAGE_SHIFT; |
@@ -156,7 +156,7 @@ void __init setup_node_zones(int nodeid) | |||
156 | start_pfn = node_start_pfn(nodeid); | 156 | start_pfn = node_start_pfn(nodeid); |
157 | end_pfn = node_end_pfn(nodeid); | 157 | end_pfn = node_end_pfn(nodeid); |
158 | 158 | ||
159 | Dprintk(KERN_INFO "setting up node %d %lx-%lx\n", | 159 | Dprintk(KERN_INFO "Setting up node %d %lx-%lx\n", |
160 | nodeid, start_pfn, end_pfn); | 160 | nodeid, start_pfn, end_pfn); |
161 | 161 | ||
162 | size_zones(zones, holes, start_pfn, end_pfn); | 162 | size_zones(zones, holes, start_pfn, end_pfn); |
@@ -200,7 +200,7 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) | |||
200 | while ((x << 1) < sz) | 200 | while ((x << 1) < sz) |
201 | x <<= 1; | 201 | x <<= 1; |
202 | if (x < sz/2) | 202 | if (x < sz/2) |
203 | printk("Numa emulation unbalanced. Complain to maintainer\n"); | 203 | printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n"); |
204 | sz = x; | 204 | sz = x; |
205 | } | 205 | } |
206 | 206 | ||
@@ -272,7 +272,7 @@ __cpuinit void numa_add_cpu(int cpu) | |||
272 | 272 | ||
273 | void __cpuinit numa_set_node(int cpu, int node) | 273 | void __cpuinit numa_set_node(int cpu, int node) |
274 | { | 274 | { |
275 | cpu_pda[cpu].nodenumber = node; | 275 | cpu_pda(cpu)->nodenumber = node; |
276 | cpu_to_node[cpu] = node; | 276 | cpu_to_node[cpu] = node; |
277 | } | 277 | } |
278 | 278 | ||
@@ -330,8 +330,69 @@ __init int numa_setup(char *opt) | |||
330 | return 1; | 330 | return 1; |
331 | } | 331 | } |
332 | 332 | ||
333 | /* | ||
334 | * Setup early cpu_to_node. | ||
335 | * | ||
336 | * Populate cpu_to_node[] only if x86_cpu_to_apicid[], | ||
337 | * and apicid_to_node[] tables have valid entries for a CPU. | ||
338 | * This means we skip cpu_to_node[] initialisation for NUMA | ||
339 | * emulation and faking node case (when running a kernel compiled | ||
340 | * for NUMA on a non NUMA box), which is OK as cpu_to_node[] | ||
341 | * is already initialized in a round robin manner at numa_init_array, | ||
342 | * prior to this call, and this initialization is good enough | ||
343 | * for the fake NUMA cases. | ||
344 | */ | ||
345 | void __init init_cpu_to_node(void) | ||
346 | { | ||
347 | int i; | ||
348 | for (i = 0; i < NR_CPUS; i++) { | ||
349 | u8 apicid = x86_cpu_to_apicid[i]; | ||
350 | if (apicid == BAD_APICID) | ||
351 | continue; | ||
352 | if (apicid_to_node[apicid] == NUMA_NO_NODE) | ||
353 | continue; | ||
354 | cpu_to_node[i] = apicid_to_node[apicid]; | ||
355 | } | ||
356 | } | ||
357 | |||
333 | EXPORT_SYMBOL(cpu_to_node); | 358 | EXPORT_SYMBOL(cpu_to_node); |
334 | EXPORT_SYMBOL(node_to_cpumask); | 359 | EXPORT_SYMBOL(node_to_cpumask); |
335 | EXPORT_SYMBOL(memnode_shift); | 360 | EXPORT_SYMBOL(memnode_shift); |
336 | EXPORT_SYMBOL(memnodemap); | 361 | EXPORT_SYMBOL(memnodemap); |
337 | EXPORT_SYMBOL(node_data); | 362 | EXPORT_SYMBOL(node_data); |
363 | |||
364 | #ifdef CONFIG_DISCONTIGMEM | ||
365 | /* | ||
366 | * Functions to convert PFNs from/to per node page addresses. | ||
367 | * These are out of line because they are quite big. | ||
368 | * They could be all tuned by pre caching more state. | ||
369 | * Should do that. | ||
370 | */ | ||
371 | |||
372 | /* Requires pfn_valid(pfn) to be true */ | ||
373 | struct page *pfn_to_page(unsigned long pfn) | ||
374 | { | ||
375 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); | ||
376 | return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map; | ||
377 | } | ||
378 | EXPORT_SYMBOL(pfn_to_page); | ||
379 | |||
380 | unsigned long page_to_pfn(struct page *page) | ||
381 | { | ||
382 | return (long)(((page) - page_zone(page)->zone_mem_map) + | ||
383 | page_zone(page)->zone_start_pfn); | ||
384 | } | ||
385 | EXPORT_SYMBOL(page_to_pfn); | ||
386 | |||
387 | int pfn_valid(unsigned long pfn) | ||
388 | { | ||
389 | unsigned nid; | ||
390 | if (pfn >= num_physpages) | ||
391 | return 0; | ||
392 | nid = pfn_to_nid(pfn); | ||
393 | if (nid == 0xff) | ||
394 | return 0; | ||
395 | return pfn >= node_start_pfn(nid) && (pfn) < node_end_pfn(nid); | ||
396 | } | ||
397 | EXPORT_SYMBOL(pfn_valid); | ||
398 | #endif | ||
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 33340bd1e328..8b7f85608fa8 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -17,21 +17,23 @@ | |||
17 | #include <linux/topology.h> | 17 | #include <linux/topology.h> |
18 | #include <asm/proto.h> | 18 | #include <asm/proto.h> |
19 | #include <asm/numa.h> | 19 | #include <asm/numa.h> |
20 | #include <asm/e820.h> | ||
20 | 21 | ||
21 | static struct acpi_table_slit *acpi_slit; | 22 | static struct acpi_table_slit *acpi_slit; |
22 | 23 | ||
23 | static nodemask_t nodes_parsed __initdata; | 24 | static nodemask_t nodes_parsed __initdata; |
24 | static nodemask_t nodes_found __initdata; | 25 | static nodemask_t nodes_found __initdata; |
25 | static struct node nodes[MAX_NUMNODES] __initdata; | 26 | static struct node nodes[MAX_NUMNODES] __initdata; |
26 | static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; | 27 | static u8 pxm2node[256] = { [0 ... 255] = 0xff }; |
27 | 28 | ||
28 | static int node_to_pxm(int n); | 29 | static int node_to_pxm(int n); |
29 | 30 | ||
30 | int pxm_to_node(int pxm) | 31 | int pxm_to_node(int pxm) |
31 | { | 32 | { |
32 | if ((unsigned)pxm >= 256) | 33 | if ((unsigned)pxm >= 256) |
33 | return 0; | 34 | return -1; |
34 | return pxm2node[pxm]; | 35 | /* Extend 0xff to (int)-1 */ |
36 | return (signed char)pxm2node[pxm]; | ||
35 | } | 37 | } |
36 | 38 | ||
37 | static __init int setup_node(int pxm) | 39 | static __init int setup_node(int pxm) |
@@ -91,9 +93,36 @@ static __init inline int srat_disabled(void) | |||
91 | return numa_off || acpi_numa < 0; | 93 | return numa_off || acpi_numa < 0; |
92 | } | 94 | } |
93 | 95 | ||
96 | /* | ||
97 | * A lot of BIOS fill in 10 (= no distance) everywhere. This messes | ||
98 | * up the NUMA heuristics which wants the local node to have a smaller | ||
99 | * distance than the others. | ||
100 | * Do some quick checks here and only use the SLIT if it passes. | ||
101 | */ | ||
102 | static __init int slit_valid(struct acpi_table_slit *slit) | ||
103 | { | ||
104 | int i, j; | ||
105 | int d = slit->localities; | ||
106 | for (i = 0; i < d; i++) { | ||
107 | for (j = 0; j < d; j++) { | ||
108 | u8 val = slit->entry[d*i + j]; | ||
109 | if (i == j) { | ||
110 | if (val != 10) | ||
111 | return 0; | ||
112 | } else if (val <= 10) | ||
113 | return 0; | ||
114 | } | ||
115 | } | ||
116 | return 1; | ||
117 | } | ||
118 | |||
94 | /* Callback for SLIT parsing */ | 119 | /* Callback for SLIT parsing */ |
95 | void __init acpi_numa_slit_init(struct acpi_table_slit *slit) | 120 | void __init acpi_numa_slit_init(struct acpi_table_slit *slit) |
96 | { | 121 | { |
122 | if (!slit_valid(slit)) { | ||
123 | printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n"); | ||
124 | return; | ||
125 | } | ||
97 | acpi_slit = slit; | 126 | acpi_slit = slit; |
98 | } | 127 | } |
99 | 128 | ||
@@ -168,12 +197,39 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) | |||
168 | nd->start, nd->end); | 197 | nd->start, nd->end); |
169 | } | 198 | } |
170 | 199 | ||
200 | /* Sanity check to catch more bad SRATs (they are amazingly common). | ||
201 | Make sure the PXMs cover all memory. */ | ||
202 | static int nodes_cover_memory(void) | ||
203 | { | ||
204 | int i; | ||
205 | unsigned long pxmram, e820ram; | ||
206 | |||
207 | pxmram = 0; | ||
208 | for_each_node_mask(i, nodes_parsed) { | ||
209 | unsigned long s = nodes[i].start >> PAGE_SHIFT; | ||
210 | unsigned long e = nodes[i].end >> PAGE_SHIFT; | ||
211 | pxmram += e - s; | ||
212 | pxmram -= e820_hole_size(s, e); | ||
213 | } | ||
214 | |||
215 | e820ram = end_pfn - e820_hole_size(0, end_pfn); | ||
216 | if (pxmram < e820ram) { | ||
217 | printk(KERN_ERR | ||
218 | "SRAT: PXMs only cover %luMB of your %luMB e820 RAM. Not used.\n", | ||
219 | (pxmram << PAGE_SHIFT) >> 20, | ||
220 | (e820ram << PAGE_SHIFT) >> 20); | ||
221 | return 0; | ||
222 | } | ||
223 | return 1; | ||
224 | } | ||
225 | |||
171 | void __init acpi_numa_arch_fixup(void) {} | 226 | void __init acpi_numa_arch_fixup(void) {} |
172 | 227 | ||
173 | /* Use the information discovered above to actually set up the nodes. */ | 228 | /* Use the information discovered above to actually set up the nodes. */ |
174 | int __init acpi_scan_nodes(unsigned long start, unsigned long end) | 229 | int __init acpi_scan_nodes(unsigned long start, unsigned long end) |
175 | { | 230 | { |
176 | int i; | 231 | int i; |
232 | |||
177 | if (acpi_numa <= 0) | 233 | if (acpi_numa <= 0) |
178 | return -1; | 234 | return -1; |
179 | 235 | ||
@@ -184,6 +240,11 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
184 | node_clear(i, nodes_parsed); | 240 | node_clear(i, nodes_parsed); |
185 | } | 241 | } |
186 | 242 | ||
243 | if (!nodes_cover_memory()) { | ||
244 | bad_srat(); | ||
245 | return -1; | ||
246 | } | ||
247 | |||
187 | memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); | 248 | memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); |
188 | if (memnode_shift < 0) { | 249 | if (memnode_shift < 0) { |
189 | printk(KERN_ERR | 250 | printk(KERN_ERR |
diff --git a/arch/x86_64/pci/Makefile-BUS b/arch/x86_64/pci/Makefile-BUS deleted file mode 100644 index 4f0c05abd408..000000000000 --- a/arch/x86_64/pci/Makefile-BUS +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for X86_64 specific PCI routines | ||
3 | # | ||
4 | # Reuse the i386 PCI subsystem | ||
5 | # | ||
6 | CFLAGS += -I arch/i386/pci | ||
7 | |||
8 | obj-y := i386.o | ||
9 | obj-$(CONFIG_PCI_DIRECT)+= direct.o | ||
10 | obj-y += fixup.o | ||
11 | obj-$(CONFIG_ACPI) += acpi.o | ||
12 | obj-y += legacy.o irq.o common.o | ||
13 | # mmconfig has a 64bit special | ||
14 | obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o | ||
15 | |||
16 | direct-y += ../../i386/pci/direct.o | ||
17 | acpi-y += ../../i386/pci/acpi.o | ||
18 | legacy-y += ../../i386/pci/legacy.o | ||
19 | irq-y += ../../i386/pci/irq.o | ||
20 | common-y += ../../i386/pci/common.o | ||
21 | fixup-y += ../../i386/pci/fixup.o | ||
22 | i386-y += ../../i386/pci/i386.o | ||
diff --git a/block/ioctl.c b/block/ioctl.c index 82030e1dfd63..e1109491c234 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include <linux/sched.h> /* for capable() */ | 1 | #include <linux/capability.h> |
2 | #include <linux/blkdev.h> | 2 | #include <linux/blkdev.h> |
3 | #include <linux/blkpg.h> | 3 | #include <linux/blkpg.h> |
4 | #include <linux/hdreg.h> | 4 | #include <linux/hdreg.h> |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 18de84c8ccd8..cc72210687eb 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <linux/capability.h> | ||
24 | #include <linux/completion.h> | 25 | #include <linux/completion.h> |
25 | #include <linux/cdrom.h> | 26 | #include <linux/cdrom.h> |
26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
diff --git a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c index c22bb9dca1ec..c26c08b36829 100644 --- a/drivers/acorn/char/i2c.c +++ b/drivers/acorn/char/i2c.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * On Acorn machines, the following i2c devices are on the bus: | 12 | * On Acorn machines, the following i2c devices are on the bus: |
13 | * - PCF8583 real time clock & static RAM | 13 | * - PCF8583 real time clock & static RAM |
14 | */ | 14 | */ |
15 | #include <linux/capability.h> | ||
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
17 | #include <linux/time.h> | 18 | #include <linux/time.h> |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 807b0df308f1..cc049338e418 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -843,6 +843,15 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
843 | unsigned int i; | 843 | unsigned int i; |
844 | unsigned int working = 0; | 844 | unsigned int working = 0; |
845 | 845 | ||
846 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 | ||
847 | struct cpuinfo_x86 *c = cpu_data + pr->id; | ||
848 | cpumask_t mask = cpumask_of_cpu(pr->id); | ||
849 | |||
850 | if (c->x86_vendor == X86_VENDOR_INTEL) { | ||
851 | on_each_cpu(switch_ipi_to_APIC_timer, &mask, 1, 1); | ||
852 | } | ||
853 | #endif | ||
854 | |||
846 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 855 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
847 | struct acpi_processor_cx *cx = &pr->power.states[i]; | 856 | struct acpi_processor_cx *cx = &pr->power.states[i]; |
848 | 857 | ||
@@ -857,6 +866,12 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
857 | 866 | ||
858 | case ACPI_STATE_C3: | 867 | case ACPI_STATE_C3: |
859 | acpi_processor_power_verify_c3(pr, cx); | 868 | acpi_processor_power_verify_c3(pr, cx); |
869 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 | ||
870 | if (c->x86_vendor == X86_VENDOR_INTEL) { | ||
871 | on_each_cpu(switch_APIC_timer_to_ipi, | ||
872 | &mask, 1, 1); | ||
873 | } | ||
874 | #endif | ||
860 | break; | 875 | break; |
861 | } | 876 | } |
862 | 877 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 5b3d5e9ddcb6..3d384e3d34de 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/capability.h> | ||
10 | #include <linux/device.h> | 11 | #include <linux/device.h> |
11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 58801d718cc2..d1a05224627e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -13,8 +13,8 @@ | |||
13 | #include <linux/sysdev.h> | 13 | #include <linux/sysdev.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/sched.h> /* capable() */ | ||
17 | #include <linux/topology.h> | 16 | #include <linux/topology.h> |
17 | #include <linux/capability.h> | ||
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/memory.h> | 19 | #include <linux/memory.h> |
20 | #include <linux/kobject.h> | 20 | #include <linux/kobject.h> |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index beea450ee4b2..c67ef3e47ad5 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1056,7 +1056,7 @@ MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for" | |||
1056 | #define IPMI_MEM_ADDR_SPACE 1 | 1056 | #define IPMI_MEM_ADDR_SPACE 1 |
1057 | #define IPMI_IO_ADDR_SPACE 2 | 1057 | #define IPMI_IO_ADDR_SPACE 2 |
1058 | 1058 | ||
1059 | #if defined(CONFIG_ACPI) || defined(CONFIG_X86) || defined(CONFIG_PCI) | 1059 | #if defined(CONFIG_ACPI) || defined(CONFIG_DMI) || defined(CONFIG_PCI) |
1060 | static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr) | 1060 | static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr) |
1061 | { | 1061 | { |
1062 | int i; | 1062 | int i; |
@@ -1669,7 +1669,7 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1669 | } | 1669 | } |
1670 | #endif | 1670 | #endif |
1671 | 1671 | ||
1672 | #ifdef CONFIG_X86 | 1672 | #ifdef CONFIG_DMI |
1673 | typedef struct dmi_ipmi_data | 1673 | typedef struct dmi_ipmi_data |
1674 | { | 1674 | { |
1675 | u8 type; | 1675 | u8 type; |
@@ -1829,7 +1829,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info) | |||
1829 | ipmi_data->slave_addr); | 1829 | ipmi_data->slave_addr); |
1830 | return 0; | 1830 | return 0; |
1831 | } | 1831 | } |
1832 | #endif /* CONFIG_X86 */ | 1832 | #endif /* CONFIG_DMI */ |
1833 | 1833 | ||
1834 | #ifdef CONFIG_PCI | 1834 | #ifdef CONFIG_PCI |
1835 | 1835 | ||
@@ -2222,7 +2222,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi) | |||
2222 | if (rv && si_trydefaults) | 2222 | if (rv && si_trydefaults) |
2223 | rv = try_init_acpi(intf_num, &new_smi); | 2223 | rv = try_init_acpi(intf_num, &new_smi); |
2224 | #endif | 2224 | #endif |
2225 | #ifdef CONFIG_X86 | 2225 | #ifdef CONFIG_DMI |
2226 | if (rv && si_trydefaults) | 2226 | if (rv && si_trydefaults) |
2227 | rv = try_init_smbios(intf_num, &new_smi); | 2227 | rv = try_init_smbios(intf_num, &new_smi); |
2228 | #endif | 2228 | #endif |
@@ -2433,7 +2433,7 @@ static __init int init_ipmi_si(void) | |||
2433 | 2433 | ||
2434 | printk(KERN_INFO "IPMI System Interface driver.\n"); | 2434 | printk(KERN_INFO "IPMI System Interface driver.\n"); |
2435 | 2435 | ||
2436 | #ifdef CONFIG_X86 | 2436 | #ifdef CONFIG_DMI |
2437 | dmi_find_bmc(); | 2437 | dmi_find_bmc(); |
2438 | #endif | 2438 | #endif |
2439 | 2439 | ||
diff --git a/drivers/char/random.c b/drivers/char/random.c index bdfdfd28594d..86be04b241e1 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -632,7 +632,7 @@ out: | |||
632 | preempt_enable(); | 632 | preempt_enable(); |
633 | } | 633 | } |
634 | 634 | ||
635 | extern void add_input_randomness(unsigned int type, unsigned int code, | 635 | void add_input_randomness(unsigned int type, unsigned int code, |
636 | unsigned int value) | 636 | unsigned int value) |
637 | { | 637 | { |
638 | static unsigned char last_value; | 638 | static unsigned char last_value; |
diff --git a/drivers/char/rio/board.h b/drivers/char/rio/board.h index 0b397e1c8f1c..29c980204098 100644 --- a/drivers/char/rio/board.h +++ b/drivers/char/rio/board.h | |||
@@ -52,63 +52,57 @@ static char *_board_h_sccs_ = "@(#)board.h 1.2"; | |||
52 | /* | 52 | /* |
53 | ** The shape of the Host Control area, at offset 0x7C00, Write Only | 53 | ** The shape of the Host Control area, at offset 0x7C00, Write Only |
54 | */ | 54 | */ |
55 | struct s_Ctrl | 55 | struct s_Ctrl { |
56 | { | 56 | BYTE DpCtl; /* 7C00 */ |
57 | BYTE DpCtl; /* 7C00 */ | 57 | BYTE Dp_Unused2_[127]; |
58 | BYTE Dp_Unused2_[127]; | 58 | BYTE DpIntSet; /* 7C80 */ |
59 | BYTE DpIntSet; /* 7C80 */ | 59 | BYTE Dp_Unused3_[127]; |
60 | BYTE Dp_Unused3_[127]; | 60 | BYTE DpTpuReset; /* 7D00 */ |
61 | BYTE DpTpuReset; /* 7D00 */ | 61 | BYTE Dp_Unused4_[127]; |
62 | BYTE Dp_Unused4_[127]; | 62 | BYTE DpIntReset; /* 7D80 */ |
63 | BYTE DpIntReset; /* 7D80 */ | 63 | BYTE Dp_Unused5_[127]; |
64 | BYTE Dp_Unused5_[127]; | ||
65 | }; | 64 | }; |
66 | 65 | ||
67 | /* | 66 | /* |
68 | ** The PROM data area on the host (0x7C00), Read Only | 67 | ** The PROM data area on the host (0x7C00), Read Only |
69 | */ | 68 | */ |
70 | struct s_Prom | 69 | struct s_Prom { |
71 | { | 70 | WORD DpSlxCode[2]; |
72 | WORD DpSlxCode[2]; | 71 | WORD DpRev; |
73 | WORD DpRev; | 72 | WORD Dp_Unused6_; |
74 | WORD Dp_Unused6_; | 73 | WORD DpUniq[4]; |
75 | WORD DpUniq[4]; | 74 | WORD DpJahre; |
76 | WORD DpJahre; | 75 | WORD DpWoche; |
77 | WORD DpWoche; | 76 | WORD DpHwFeature[5]; |
78 | WORD DpHwFeature[5]; | 77 | WORD DpOemId; |
79 | WORD DpOemId; | 78 | WORD DpSiggy[16]; |
80 | WORD DpSiggy[16]; | ||
81 | }; | 79 | }; |
82 | 80 | ||
83 | /* | 81 | /* |
84 | ** Union of the Ctrl and Prom areas | 82 | ** Union of the Ctrl and Prom areas |
85 | */ | 83 | */ |
86 | union u_CtrlProm /* This is the control/PROM area (0x7C00) */ | 84 | union u_CtrlProm { /* This is the control/PROM area (0x7C00) */ |
87 | { | 85 | struct s_Ctrl DpCtrl; |
88 | struct s_Ctrl DpCtrl; | 86 | struct s_Prom DpProm; |
89 | struct s_Prom DpProm; | ||
90 | }; | 87 | }; |
91 | 88 | ||
92 | /* | 89 | /* |
93 | ** The top end of memory! | 90 | ** The top end of memory! |
94 | */ | 91 | */ |
95 | struct s_ParmMapS /* Area containing Parm Map Pointer */ | 92 | struct s_ParmMapS { /* Area containing Parm Map Pointer */ |
96 | { | 93 | BYTE Dp_Unused8_[DP_PARMMAP_ADDR]; |
97 | BYTE Dp_Unused8_[DP_PARMMAP_ADDR]; | 94 | WORD DpParmMapAd; |
98 | WORD DpParmMapAd; | ||
99 | }; | 95 | }; |
100 | 96 | ||
101 | struct s_StartUpS | 97 | struct s_StartUpS { |
102 | { | 98 | BYTE Dp_Unused9_[DP_STARTUP_ADDR]; |
103 | BYTE Dp_Unused9_[DP_STARTUP_ADDR]; | 99 | BYTE Dp_LongJump[0x4]; |
104 | BYTE Dp_LongJump[0x4]; | 100 | BYTE Dp_Unused10_[2]; |
105 | BYTE Dp_Unused10_[2]; | 101 | BYTE Dp_ShortJump[0x2]; |
106 | BYTE Dp_ShortJump[0x2]; | ||
107 | }; | 102 | }; |
108 | 103 | ||
109 | union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */ | 104 | union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */ |
110 | { | 105 | BYTE DpSramMem[DP_SRAM2_SIZE]; |
111 | BYTE DpSramMem[DP_SRAM2_SIZE]; | ||
112 | struct s_ParmMapS DpParmMapS; | 106 | struct s_ParmMapS DpParmMapS; |
113 | struct s_StartUpS DpStartUpS; | 107 | struct s_StartUpS DpStartUpS; |
114 | }; | 108 | }; |
@@ -116,13 +110,12 @@ union u_Sram2ParmMap /* This is the top of memory (0x7E00-0x7FFF) */ | |||
116 | /* | 110 | /* |
117 | ** This is the DP RAM overlay. | 111 | ** This is the DP RAM overlay. |
118 | */ | 112 | */ |
119 | struct DpRam | 113 | struct DpRam { |
120 | { | 114 | BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ |
121 | BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ | 115 | union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ |
122 | union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ | 116 | union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ |
123 | union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ | 117 | BYTE DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ |
124 | BYTE DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ | 118 | BYTE DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ |
125 | BYTE DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ | ||
126 | }; | 119 | }; |
127 | 120 | ||
128 | #define DpControl DpCtrlProm.DpCtrl.DpCtl | 121 | #define DpControl DpCtrlProm.DpCtrl.DpCtl |
diff --git a/drivers/char/rio/bootpkt.h b/drivers/char/rio/bootpkt.h index c329aeb7c871..602266e0c085 100644 --- a/drivers/char/rio/bootpkt.h +++ b/drivers/char/rio/bootpkt.h | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | #ifndef lint | 42 | #ifndef lint |
43 | #ifdef SCCS | 43 | #ifdef SCCS |
44 | static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ; | 44 | static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1"; |
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
@@ -49,14 +49,13 @@ static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1" ; | |||
49 | * Overlayed onto the Data fields of a regular | 49 | * Overlayed onto the Data fields of a regular |
50 | * Packet | 50 | * Packet |
51 | ************************************************/ | 51 | ************************************************/ |
52 | typedef struct BOOT_PKT BOOT_PKT ; | 52 | typedef struct BOOT_PKT BOOT_PKT; |
53 | struct BOOT_PKT { | 53 | struct BOOT_PKT { |
54 | short seq_num ; | 54 | short seq_num; |
55 | char data[10] ; | 55 | char data[10]; |
56 | } ; | 56 | }; |
57 | 57 | ||
58 | 58 | ||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | /*********** end of file ***********/ | 61 | /*********** end of file ***********/ |
62 | |||
diff --git a/drivers/char/rio/brates.h b/drivers/char/rio/brates.h index bd4fc84ec6cf..dd686d58fd66 100644 --- a/drivers/char/rio/brates.h +++ b/drivers/char/rio/brates.h | |||
@@ -97,11 +97,10 @@ | |||
97 | 97 | ||
98 | #define MAX_RATE B2000 | 98 | #define MAX_RATE B2000 |
99 | 99 | ||
100 | struct baud_rate /* Tag for baud rates */ | 100 | struct baud_rate { /* Tag for baud rates */ |
101 | { | 101 | /* short host_rate, *//* As passed by the driver */ |
102 | /* short host_rate,*/ /* As passed by the driver */ | 102 | short divisor, /* The divisor */ |
103 | short divisor, /* The divisor */ | 103 | prescaler; /* The pre-scaler */ |
104 | prescaler; /* The pre-scaler */ | ||
105 | }; | 104 | }; |
106 | 105 | ||
107 | #endif | 106 | #endif |
diff --git a/drivers/char/rio/chan.h b/drivers/char/rio/chan.h index 5b306543328f..af14311f9b66 100644 --- a/drivers/char/rio/chan.h +++ b/drivers/char/rio/chan.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #ifndef lint | 22 | #ifndef lint |
23 | #ifdef SCCS | 23 | #ifdef SCCS |
24 | static char *_rio_chan_h_sccs = "@(#)chan.h 1.1" ; | 24 | static char *_rio_chan_h_sccs = "@(#)chan.h 1.1"; |
25 | #endif | 25 | #endif |
26 | #endif | 26 | #endif |
27 | 27 | ||
diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h index cf056a990f18..217ff09f2fa1 100644 --- a/drivers/char/rio/cirrus.h +++ b/drivers/char/rio/cirrus.h | |||
@@ -73,20 +73,20 @@ | |||
73 | #define TIMER_TICK 0x82 | 73 | #define TIMER_TICK 0x82 |
74 | #define STOP_BREAK 0x83 | 74 | #define STOP_BREAK 0x83 |
75 | #define BASE(a) ((a) < 4 ? (short*)CIRRUS_FIRST : ((a) < 8 ? (short *)CIRRUS_SECOND : ((a) < 12 ? (short*)CIRRUS_THIRD : (short *)CIRRUS_FOURTH))) | 75 | #define BASE(a) ((a) < 4 ? (short*)CIRRUS_FIRST : ((a) < 8 ? (short *)CIRRUS_SECOND : ((a) < 12 ? (short*)CIRRUS_THIRD : (short *)CIRRUS_FOURTH))) |
76 | #define txack1 ((short *)0x7104) | 76 | #define txack1 ((short *)0x7104) |
77 | #define rxack1 ((short *)0x7102) | 77 | #define rxack1 ((short *)0x7102) |
78 | #define mdack1 ((short *)0x7106) | 78 | #define mdack1 ((short *)0x7106) |
79 | #define txack2 ((short *)0x7006) | 79 | #define txack2 ((short *)0x7006) |
80 | #define rxack2 ((short *)0x7004) | 80 | #define rxack2 ((short *)0x7004) |
81 | #define mdack2 ((short *)0x7100) | 81 | #define mdack2 ((short *)0x7100) |
82 | #define int_latch ((short *) 0x7800) | 82 | #define int_latch ((short *) 0x7800) |
83 | #define int_status ((short *) 0x7c00) | 83 | #define int_status ((short *) 0x7c00) |
84 | #define tx1_pending 0x20 | 84 | #define tx1_pending 0x20 |
85 | #define rx1_pending 0x10 | 85 | #define rx1_pending 0x10 |
86 | #define md1_pending 0x40 | 86 | #define md1_pending 0x40 |
87 | #define tx2_pending 0x02 | 87 | #define tx2_pending 0x02 |
88 | #define rx2_pending 0x01 | 88 | #define rx2_pending 0x01 |
89 | #define md2_pending 0x40 | 89 | #define md2_pending 0x40 |
90 | #define module1_bits 0x07 | 90 | #define module1_bits 0x07 |
91 | #define module1_modern 0x08 | 91 | #define module1_modern 0x08 |
92 | #define module2_bits 0x70 | 92 | #define module2_bits 0x70 |
@@ -113,65 +113,65 @@ | |||
113 | NB. These registers are relative values on 8 bit boundaries whereas | 113 | NB. These registers are relative values on 8 bit boundaries whereas |
114 | on the RTA's the CIRRUS registers are on word boundaries. Use pointer | 114 | on the RTA's the CIRRUS registers are on word boundaries. Use pointer |
115 | arithmetic (short *) to obtain the real addresses required */ | 115 | arithmetic (short *) to obtain the real addresses required */ |
116 | #define ccr 0x05 /* Channel Command Register */ | 116 | #define ccr 0x05 /* Channel Command Register */ |
117 | #define ier 0x06 /* Interrupt Enable Register */ | 117 | #define ier 0x06 /* Interrupt Enable Register */ |
118 | #define cor1 0x08 /* Channel Option Register 1 */ | 118 | #define cor1 0x08 /* Channel Option Register 1 */ |
119 | #define cor2 0x09 /* Channel Option Register 2 */ | 119 | #define cor2 0x09 /* Channel Option Register 2 */ |
120 | #define cor3 0x0a /* Channel Option Register 3 */ | 120 | #define cor3 0x0a /* Channel Option Register 3 */ |
121 | #define cor4 0x1e /* Channel Option Register 4 */ | 121 | #define cor4 0x1e /* Channel Option Register 4 */ |
122 | #define cor5 0x1f /* Channel Option Register 5 */ | 122 | #define cor5 0x1f /* Channel Option Register 5 */ |
123 | 123 | ||
124 | #define ccsr 0x0b /* Channel Control Status Register */ | 124 | #define ccsr 0x0b /* Channel Control Status Register */ |
125 | #define rdcr 0x0e /* Receive Data Count Register */ | 125 | #define rdcr 0x0e /* Receive Data Count Register */ |
126 | #define tdcr 0x12 /* Transmit Data Count Register */ | 126 | #define tdcr 0x12 /* Transmit Data Count Register */ |
127 | #define mcor1 0x15 /* Modem Change Option Register 1 */ | 127 | #define mcor1 0x15 /* Modem Change Option Register 1 */ |
128 | #define mcor2 0x16 /* Modem Change Option Regsiter 2 */ | 128 | #define mcor2 0x16 /* Modem Change Option Regsiter 2 */ |
129 | 129 | ||
130 | #define livr 0x18 /* Local Interrupt Vector Register */ | 130 | #define livr 0x18 /* Local Interrupt Vector Register */ |
131 | #define schr1 0x1a /* Special Character Register 1 */ | 131 | #define schr1 0x1a /* Special Character Register 1 */ |
132 | #define schr2 0x1b /* Special Character Register 2 */ | 132 | #define schr2 0x1b /* Special Character Register 2 */ |
133 | #define schr3 0x1c /* Special Character Register 3 */ | 133 | #define schr3 0x1c /* Special Character Register 3 */ |
134 | #define schr4 0x1d /* Special Character Register 4 */ | 134 | #define schr4 0x1d /* Special Character Register 4 */ |
135 | 135 | ||
136 | #define rtr 0x20 /* Receive Timer Register */ | 136 | #define rtr 0x20 /* Receive Timer Register */ |
137 | #define rtpr 0x21 /* Receive Timeout Period Register */ | 137 | #define rtpr 0x21 /* Receive Timeout Period Register */ |
138 | #define lnc 0x24 /* Lnext character */ | 138 | #define lnc 0x24 /* Lnext character */ |
139 | 139 | ||
140 | #define rivr 0x43 /* Receive Interrupt Vector Register */ | 140 | #define rivr 0x43 /* Receive Interrupt Vector Register */ |
141 | #define tivr 0x42 /* Transmit Interrupt Vector Register */ | 141 | #define tivr 0x42 /* Transmit Interrupt Vector Register */ |
142 | #define mivr 0x41 /* Modem Interrupt Vector Register */ | 142 | #define mivr 0x41 /* Modem Interrupt Vector Register */ |
143 | #define gfrcr 0x40 /* Global Firmware Revision code Reg */ | 143 | #define gfrcr 0x40 /* Global Firmware Revision code Reg */ |
144 | #define ricr 0x44 /* Receive Interrupting Channel Reg */ | 144 | #define ricr 0x44 /* Receive Interrupting Channel Reg */ |
145 | #define ticr 0x45 /* Transmit Interrupting Channel Reg */ | 145 | #define ticr 0x45 /* Transmit Interrupting Channel Reg */ |
146 | #define micr 0x46 /* Modem Interrupting Channel Register */ | 146 | #define micr 0x46 /* Modem Interrupting Channel Register */ |
147 | 147 | ||
148 | #define gcr 0x4b /* Global configuration register*/ | 148 | #define gcr 0x4b /* Global configuration register */ |
149 | #define misr 0x4c /* Modem interrupt status register */ | 149 | #define misr 0x4c /* Modem interrupt status register */ |
150 | 150 | ||
151 | #define rbusr 0x59 | 151 | #define rbusr 0x59 |
152 | #define tbusr 0x5a | 152 | #define tbusr 0x5a |
153 | #define mbusr 0x5b | 153 | #define mbusr 0x5b |
154 | 154 | ||
155 | #define eoir 0x60 /* End Of Interrupt Register */ | 155 | #define eoir 0x60 /* End Of Interrupt Register */ |
156 | #define rdsr 0x62 /* Receive Data / Status Register */ | 156 | #define rdsr 0x62 /* Receive Data / Status Register */ |
157 | #define tdr 0x63 /* Transmit Data Register */ | 157 | #define tdr 0x63 /* Transmit Data Register */ |
158 | #define svrr 0x67 /* Service Request Register */ | 158 | #define svrr 0x67 /* Service Request Register */ |
159 | 159 | ||
160 | #define car 0x68 /* Channel Access Register */ | 160 | #define car 0x68 /* Channel Access Register */ |
161 | #define mir 0x69 /* Modem Interrupt Register */ | 161 | #define mir 0x69 /* Modem Interrupt Register */ |
162 | #define tir 0x6a /* Transmit Interrupt Register */ | 162 | #define tir 0x6a /* Transmit Interrupt Register */ |
163 | #define rir 0x6b /* Receive Interrupt Register */ | 163 | #define rir 0x6b /* Receive Interrupt Register */ |
164 | #define msvr1 0x6c /* Modem Signal Value Register 1 */ | 164 | #define msvr1 0x6c /* Modem Signal Value Register 1 */ |
165 | #define msvr2 0x6d /* Modem Signal Value Register 2*/ | 165 | #define msvr2 0x6d /* Modem Signal Value Register 2 */ |
166 | #define psvr 0x6f /* Printer Signal Value Register*/ | 166 | #define psvr 0x6f /* Printer Signal Value Register */ |
167 | 167 | ||
168 | #define tbpr 0x72 /* Transmit Baud Rate Period Register */ | 168 | #define tbpr 0x72 /* Transmit Baud Rate Period Register */ |
169 | #define tcor 0x76 /* Transmit Clock Option Register */ | 169 | #define tcor 0x76 /* Transmit Clock Option Register */ |
170 | 170 | ||
171 | #define rbpr 0x78 /* Receive Baud Rate Period Register */ | 171 | #define rbpr 0x78 /* Receive Baud Rate Period Register */ |
172 | #define rber 0x7a /* Receive Baud Rate Extension Register */ | 172 | #define rber 0x7a /* Receive Baud Rate Extension Register */ |
173 | #define rcor 0x7c /* Receive Clock Option Register*/ | 173 | #define rcor 0x7c /* Receive Clock Option Register */ |
174 | #define ppr 0x7e /* Prescalar Period Register */ | 174 | #define ppr 0x7e /* Prescalar Period Register */ |
175 | 175 | ||
176 | /* Misc registers used for forcing the 1400 out of its reset woes */ | 176 | /* Misc registers used for forcing the 1400 out of its reset woes */ |
177 | #define airl 0x6d | 177 | #define airl 0x6d |
@@ -192,10 +192,10 @@ | |||
192 | 192 | ||
193 | /* RDSR - when status read from FIFO */ | 193 | /* RDSR - when status read from FIFO */ |
194 | #define RDSR_BREAK 0x08 /* Break received */ | 194 | #define RDSR_BREAK 0x08 /* Break received */ |
195 | #define RDSR_TIMEOUT 0x80 /* No new data timeout */ | 195 | #define RDSR_TIMEOUT 0x80 /* No new data timeout */ |
196 | #define RDSR_SC1 0x10 /* Special char 1 (tx XON) matched */ | 196 | #define RDSR_SC1 0x10 /* Special char 1 (tx XON) matched */ |
197 | #define RDSR_SC2 0x20 /* Special char 2 (tx XOFF) matched */ | 197 | #define RDSR_SC2 0x20 /* Special char 2 (tx XOFF) matched */ |
198 | #define RDSR_SC12_MASK 0x30 /* Mask for special chars 1 and 2 */ | 198 | #define RDSR_SC12_MASK 0x30 /* Mask for special chars 1 and 2 */ |
199 | 199 | ||
200 | /* PPR */ | 200 | /* PPR */ |
201 | #define PPR_DEFAULT 0x31 /* Default value - for a 25Mhz clock gives | 201 | #define PPR_DEFAULT 0x31 /* Default value - for a 25Mhz clock gives |
@@ -244,7 +244,7 @@ | |||
244 | #define IER_TIMEOUT 0x01 /* Timeout on no data */ | 244 | #define IER_TIMEOUT 0x01 /* Timeout on no data */ |
245 | 245 | ||
246 | #define IER_DEFAULT 0x94 /* Default values */ | 246 | #define IER_DEFAULT 0x94 /* Default values */ |
247 | #define IER_PARALLEL 0x84 /* Default for Parallel */ | 247 | #define IER_PARALLEL 0x84 /* Default for Parallel */ |
248 | #define IER_EMPTY 0x92 /* Transmitter empty rather than ready */ | 248 | #define IER_EMPTY 0x92 /* Transmitter empty rather than ready */ |
249 | 249 | ||
250 | /* COR1 - Driver only */ | 250 | /* COR1 - Driver only */ |
@@ -264,11 +264,11 @@ | |||
264 | #define COR1_7BITS 0x02 /* 7 data bits */ | 264 | #define COR1_7BITS 0x02 /* 7 data bits */ |
265 | #define COR1_8BITS 0x03 /* 8 data bits */ | 265 | #define COR1_8BITS 0x03 /* 8 data bits */ |
266 | 266 | ||
267 | #define COR1_HOST 0xef /* Safe host bits */ | 267 | #define COR1_HOST 0xef /* Safe host bits */ |
268 | 268 | ||
269 | /* RTA only */ | 269 | /* RTA only */ |
270 | #define COR1_CINPCK 0x00 /* Check parity of received characters */ | 270 | #define COR1_CINPCK 0x00 /* Check parity of received characters */ |
271 | #define COR1_CNINPCK 0x10 /* Don't check parity */ | 271 | #define COR1_CNINPCK 0x10 /* Don't check parity */ |
272 | 272 | ||
273 | /* COR2 bits for both RTA and driver use */ | 273 | /* COR2 bits for both RTA and driver use */ |
274 | #define COR2_IXANY 0x80 /* IXANY - any character is XON */ | 274 | #define COR2_IXANY 0x80 /* IXANY - any character is XON */ |
@@ -293,9 +293,9 @@ | |||
293 | #define COR3_FCT 0x20 /* Flow control transparency */ | 293 | #define COR3_FCT 0x20 /* Flow control transparency */ |
294 | #define COR3_SCD12 0x10 /* Special character detect for SCHR's 1 + 2 */ | 294 | #define COR3_SCD12 0x10 /* Special character detect for SCHR's 1 + 2 */ |
295 | #define COR3_FIFO12 0x0c /* 12 chars for receive FIFO threshold */ | 295 | #define COR3_FIFO12 0x0c /* 12 chars for receive FIFO threshold */ |
296 | #define COR3_FIFO10 0x0a /* 10 chars for receive FIFO threshold */ | 296 | #define COR3_FIFO10 0x0a /* 10 chars for receive FIFO threshold */ |
297 | #define COR3_FIFO8 0x08 /* 8 chars for receive FIFO threshold */ | 297 | #define COR3_FIFO8 0x08 /* 8 chars for receive FIFO threshold */ |
298 | #define COR3_FIFO6 0x06 /* 6 chars for receive FIFO threshold */ | 298 | #define COR3_FIFO6 0x06 /* 6 chars for receive FIFO threshold */ |
299 | 299 | ||
300 | #define COR3_THRESHOLD COR3_FIFO8 /* MUST BE LESS THAN MCOR_THRESHOLD */ | 300 | #define COR3_THRESHOLD COR3_FIFO8 /* MUST BE LESS THAN MCOR_THRESHOLD */ |
301 | 301 | ||
@@ -386,7 +386,7 @@ | |||
386 | 386 | ||
387 | #define MCOR_THRESHBITS 0x0F /* mask for ANDing out the above */ | 387 | #define MCOR_THRESHBITS 0x0F /* mask for ANDing out the above */ |
388 | 388 | ||
389 | #define MCOR_THRESHOLD MCOR_THRESH9 /* MUST BE GREATER THAN COR3_THRESHOLD */ | 389 | #define MCOR_THRESHOLD MCOR_THRESH9 /* MUST BE GREATER THAN COR3_THRESHOLD */ |
390 | 390 | ||
391 | 391 | ||
392 | /* RTPR */ | 392 | /* RTPR */ |
@@ -429,25 +429,25 @@ | |||
429 | #define CONFIG 0x01 /* Configure a port */ | 429 | #define CONFIG 0x01 /* Configure a port */ |
430 | #define MOPEN 0x02 /* Modem open (block for DCD) */ | 430 | #define MOPEN 0x02 /* Modem open (block for DCD) */ |
431 | #define CLOSE 0x03 /* Close a port */ | 431 | #define CLOSE 0x03 /* Close a port */ |
432 | #define WFLUSH (0x04 | PRE_EMPTIVE) /* Write flush */ | 432 | #define WFLUSH (0x04 | PRE_EMPTIVE) /* Write flush */ |
433 | #define RFLUSH (0x05 | PRE_EMPTIVE) /* Read flush */ | 433 | #define RFLUSH (0x05 | PRE_EMPTIVE) /* Read flush */ |
434 | #define RESUME (0x06 | PRE_EMPTIVE) /* Resume if xoffed */ | 434 | #define RESUME (0x06 | PRE_EMPTIVE) /* Resume if xoffed */ |
435 | #define SBREAK 0x07 /* Start break */ | 435 | #define SBREAK 0x07 /* Start break */ |
436 | #define EBREAK 0x08 /* End break */ | 436 | #define EBREAK 0x08 /* End break */ |
437 | #define SUSPEND (0x09 | PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */ | 437 | #define SUSPEND (0x09 | PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */ |
438 | #define FCLOSE (0x0a | PRE_EMPTIVE) /* Force close */ | 438 | #define FCLOSE (0x0a | PRE_EMPTIVE) /* Force close */ |
439 | #define XPRINT 0x0b /* Xprint packet */ | 439 | #define XPRINT 0x0b /* Xprint packet */ |
440 | #define MBIS (0x0c | PRE_EMPTIVE) /* Set modem lines */ | 440 | #define MBIS (0x0c | PRE_EMPTIVE) /* Set modem lines */ |
441 | #define MBIC (0x0d | PRE_EMPTIVE) /* Clear modem lines */ | 441 | #define MBIC (0x0d | PRE_EMPTIVE) /* Clear modem lines */ |
442 | #define MSET (0x0e | PRE_EMPTIVE) /* Set modem lines */ | 442 | #define MSET (0x0e | PRE_EMPTIVE) /* Set modem lines */ |
443 | #define PCLOSE 0x0f /* Pseudo close - Leaves rx/tx enabled */ | 443 | #define PCLOSE 0x0f /* Pseudo close - Leaves rx/tx enabled */ |
444 | #define MGET (0x10 | PRE_EMPTIVE) /* Force update of modem status */ | 444 | #define MGET (0x10 | PRE_EMPTIVE) /* Force update of modem status */ |
445 | #define MEMDUMP (0x11 | PRE_EMPTIVE) /* Send back mem from addr supplied */ | 445 | #define MEMDUMP (0x11 | PRE_EMPTIVE) /* Send back mem from addr supplied */ |
446 | #define READ_REGISTER (0x12 | PRE_EMPTIVE) /* Read CD1400 register (debug) */ | 446 | #define READ_REGISTER (0x12 | PRE_EMPTIVE) /* Read CD1400 register (debug) */ |
447 | 447 | ||
448 | /* "Command" packets going from remote to host COMPLETE and MODEM_STATUS | 448 | /* "Command" packets going from remote to host COMPLETE and MODEM_STATUS |
449 | use data[4] / data[3] to indicate current state and modem status respectively | 449 | use data[4] / data[3] to indicate current state and modem status respectively |
450 | */ | 450 | */ |
451 | 451 | ||
452 | #define COMPLETE (0x20 | PRE_EMPTIVE) | 452 | #define COMPLETE (0x20 | PRE_EMPTIVE) |
453 | /* Command complete */ | 453 | /* Command complete */ |
diff --git a/drivers/char/rio/cmd.h b/drivers/char/rio/cmd.h index c369edaea2b3..797b62400c91 100644 --- a/drivers/char/rio/cmd.h +++ b/drivers/char/rio/cmd.h | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | #ifndef lint | 43 | #ifndef lint |
44 | #ifdef SCCS | 44 | #ifdef SCCS |
45 | static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; | 45 | static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1"; |
46 | #endif | 46 | #endif |
47 | #endif | 47 | #endif |
48 | 48 | ||
@@ -52,7 +52,7 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; | |||
52 | 52 | ||
53 | #define CMD_IGNORE_PKT ( (ushort) 0) | 53 | #define CMD_IGNORE_PKT ( (ushort) 0) |
54 | #define CMD_STATUS_REQ ( (ushort) 1) | 54 | #define CMD_STATUS_REQ ( (ushort) 1) |
55 | #define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */ | 55 | #define CMD_UNIT_STATUS_REQ ( (ushort) 2) /* Is this needed ??? */ |
56 | #define CMD_CONF_PORT ( (ushort) 3) | 56 | #define CMD_CONF_PORT ( (ushort) 3) |
57 | #define CMD_CONF_UNIT ( (ushort) 4) | 57 | #define CMD_CONF_UNIT ( (ushort) 4) |
58 | #define CMD_ROUTE_MAP_REQ ( (ushort) 5) | 58 | #define CMD_ROUTE_MAP_REQ ( (ushort) 5) |
@@ -81,4 +81,3 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h 1.1" ; | |||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | /*********** end of file ***********/ | 83 | /*********** end of file ***********/ |
84 | |||
diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h index 2b8efbdbee1c..a9a8c45631d7 100644 --- a/drivers/char/rio/cmdblk.h +++ b/drivers/char/rio/cmdblk.h | |||
@@ -44,16 +44,15 @@ static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2"; | |||
44 | ** a rup. | 44 | ** a rup. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | struct CmdBlk | 47 | struct CmdBlk { |
48 | { | 48 | struct CmdBlk *NextP; /* Pointer to next command block */ |
49 | struct CmdBlk *NextP; /* Pointer to next command block */ | 49 | struct PKT Packet; /* A packet, to copy to the rup */ |
50 | struct PKT Packet; /* A packet, to copy to the rup */ | 50 | /* The func to call to check if OK */ |
51 | /* The func to call to check if OK */ | 51 | int (*PreFuncP) (int, struct CmdBlk *); |
52 | int (*PreFuncP)(int, struct CmdBlk *); | 52 | int PreArg; /* The arg for the func */ |
53 | int PreArg; /* The arg for the func */ | 53 | /* The func to call when completed */ |
54 | /* The func to call when completed */ | 54 | int (*PostFuncP) (int, struct CmdBlk *); |
55 | int (*PostFuncP)(int, struct CmdBlk *); | 55 | int PostArg; /* The arg for the func */ |
56 | int PostArg; /* The arg for the func */ | ||
57 | }; | 56 | }; |
58 | 57 | ||
59 | #define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4)) | 58 | #define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4)) |
diff --git a/drivers/char/rio/cmdpkt.h b/drivers/char/rio/cmdpkt.h index 46befd354f20..77cee8df68ef 100644 --- a/drivers/char/rio/cmdpkt.h +++ b/drivers/char/rio/cmdpkt.h | |||
@@ -54,135 +54,112 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2"; | |||
54 | ** This structure overlays a PktCmd->CmdData structure, and so starts | 54 | ** This structure overlays a PktCmd->CmdData structure, and so starts |
55 | ** at Data[2] in the actual pkt! | 55 | ** at Data[2] in the actual pkt! |
56 | */ | 56 | */ |
57 | struct BootSequence | 57 | struct BootSequence { |
58 | { | 58 | WORD NumPackets; |
59 | WORD NumPackets; | 59 | WORD LoadBase; |
60 | WORD LoadBase; | 60 | WORD CodeSize; |
61 | WORD CodeSize; | ||
62 | }; | 61 | }; |
63 | 62 | ||
64 | #define BOOT_SEQUENCE_LEN 8 | 63 | #define BOOT_SEQUENCE_LEN 8 |
65 | 64 | ||
66 | struct SamTop | 65 | struct SamTop { |
67 | { | 66 | BYTE Unit; |
68 | BYTE Unit; | 67 | BYTE Link; |
69 | BYTE Link; | ||
70 | }; | 68 | }; |
71 | 69 | ||
72 | struct CmdHdr | 70 | struct CmdHdr { |
73 | { | 71 | BYTE PcCommand; |
74 | BYTE PcCommand; | 72 | union { |
75 | union | 73 | BYTE PcPhbNum; |
76 | { | 74 | BYTE PcLinkNum; |
77 | BYTE PcPhbNum; | 75 | BYTE PcIDNum; |
78 | BYTE PcLinkNum; | 76 | } U0; |
79 | BYTE PcIDNum; | ||
80 | } U0; | ||
81 | }; | 77 | }; |
82 | 78 | ||
83 | 79 | ||
84 | struct PktCmd | 80 | struct PktCmd { |
85 | { | 81 | union { |
86 | union | 82 | struct { |
87 | { | 83 | struct CmdHdr CmdHdr; |
88 | struct | 84 | struct BootSequence PcBootSequence; |
89 | { | 85 | } S1; |
90 | struct CmdHdr CmdHdr; | 86 | struct { |
91 | struct BootSequence PcBootSequence; | 87 | WORD PcSequence; |
92 | } S1; | 88 | BYTE PcBootData[RTA_BOOT_DATA_SIZE]; |
93 | struct | 89 | } S2; |
94 | { | 90 | struct { |
95 | WORD PcSequence; | 91 | WORD __crud__; |
96 | BYTE PcBootData[RTA_BOOT_DATA_SIZE]; | 92 | BYTE PcUniqNum[4]; /* this is really a uint. */ |
97 | } S2; | 93 | BYTE PcModuleTypes; /* what modules are fitted */ |
98 | struct | 94 | } S3; |
99 | { | 95 | struct { |
100 | WORD __crud__; | 96 | struct CmdHdr CmdHdr; |
101 | BYTE PcUniqNum[4]; /* this is really a uint. */ | 97 | BYTE __undefined__; |
102 | BYTE PcModuleTypes; /* what modules are fitted */ | 98 | BYTE PcModemStatus; |
103 | } S3; | 99 | BYTE PcPortStatus; |
104 | struct | 100 | BYTE PcSubCommand; /* commands like mem or register dump */ |
105 | { | 101 | WORD PcSubAddr; /* Address for command */ |
106 | struct CmdHdr CmdHdr; | 102 | BYTE PcSubData[64]; /* Date area for command */ |
107 | BYTE __undefined__; | 103 | } S4; |
108 | BYTE PcModemStatus; | 104 | struct { |
109 | BYTE PcPortStatus; | 105 | struct CmdHdr CmdHdr; |
110 | BYTE PcSubCommand; /* commands like mem or register dump */ | 106 | BYTE PcCommandText[1]; |
111 | WORD PcSubAddr; /* Address for command */ | 107 | BYTE __crud__[20]; |
112 | BYTE PcSubData[64]; /* Date area for command */ | 108 | BYTE PcIDNum2; /* It had to go somewhere! */ |
113 | } S4; | 109 | } S5; |
114 | struct | 110 | struct { |
115 | { | 111 | struct CmdHdr CmdHdr; |
116 | struct CmdHdr CmdHdr; | 112 | struct SamTop Topology[LINKS_PER_UNIT]; |
117 | BYTE PcCommandText[1]; | 113 | } S6; |
118 | BYTE __crud__[20]; | 114 | } U1; |
119 | BYTE PcIDNum2; /* It had to go somewhere! */ | ||
120 | } S5; | ||
121 | struct | ||
122 | { | ||
123 | struct CmdHdr CmdHdr; | ||
124 | struct SamTop Topology[LINKS_PER_UNIT]; | ||
125 | } S6; | ||
126 | } U1; | ||
127 | }; | 115 | }; |
128 | 116 | ||
129 | struct PktCmd_M | 117 | struct PktCmd_M { |
130 | { | 118 | union { |
131 | union | 119 | struct { |
132 | { | 120 | struct { |
133 | struct | 121 | uchar PcCommand; |
134 | { | 122 | union { |
135 | struct | 123 | uchar PcPhbNum; |
136 | { | 124 | uchar PcLinkNum; |
137 | uchar PcCommand; | 125 | uchar PcIDNum; |
138 | union | 126 | } U0; |
139 | { | 127 | } CmdHdr; |
140 | uchar PcPhbNum; | 128 | struct { |
141 | uchar PcLinkNum; | 129 | ushort NumPackets; |
142 | uchar PcIDNum; | 130 | ushort LoadBase; |
143 | } U0; | 131 | ushort CodeSize; |
144 | } CmdHdr; | 132 | } PcBootSequence; |
145 | struct | 133 | } S1; |
146 | { | 134 | struct { |
147 | ushort NumPackets; | 135 | ushort PcSequence; |
148 | ushort LoadBase; | 136 | uchar PcBootData[RTA_BOOT_DATA_SIZE]; |
149 | ushort CodeSize; | 137 | } S2; |
150 | } PcBootSequence; | 138 | struct { |
151 | } S1; | 139 | ushort __crud__; |
152 | struct | 140 | uchar PcUniqNum[4]; /* this is really a uint. */ |
153 | { | 141 | uchar PcModuleTypes; /* what modules are fitted */ |
154 | ushort PcSequence; | 142 | } S3; |
155 | uchar PcBootData[RTA_BOOT_DATA_SIZE]; | 143 | struct { |
156 | } S2; | 144 | ushort __cmd_hdr__; |
157 | struct | 145 | uchar __undefined__; |
158 | { | 146 | uchar PcModemStatus; |
159 | ushort __crud__; | 147 | uchar PcPortStatus; |
160 | uchar PcUniqNum[4]; /* this is really a uint. */ | 148 | uchar PcSubCommand; |
161 | uchar PcModuleTypes; /* what modules are fitted */ | 149 | ushort PcSubAddr; |
162 | } S3; | 150 | uchar PcSubData[64]; |
163 | struct | 151 | } S4; |
164 | { | 152 | struct { |
165 | ushort __cmd_hdr__; | 153 | ushort __cmd_hdr__; |
166 | uchar __undefined__; | 154 | uchar PcCommandText[1]; |
167 | uchar PcModemStatus; | 155 | uchar __crud__[20]; |
168 | uchar PcPortStatus; | 156 | uchar PcIDNum2; /* Tacked on end */ |
169 | uchar PcSubCommand; | 157 | } S5; |
170 | ushort PcSubAddr; | 158 | struct { |
171 | uchar PcSubData[64]; | 159 | ushort __cmd_hdr__; |
172 | } S4; | 160 | struct Top Topology[LINKS_PER_UNIT]; |
173 | struct | 161 | } S6; |
174 | { | 162 | } U1; |
175 | ushort __cmd_hdr__; | ||
176 | uchar PcCommandText[1]; | ||
177 | uchar __crud__[20]; | ||
178 | uchar PcIDNum2; /* Tacked on end */ | ||
179 | } S5; | ||
180 | struct | ||
181 | { | ||
182 | ushort __cmd_hdr__; | ||
183 | struct Top Topology[LINKS_PER_UNIT]; | ||
184 | } S6; | ||
185 | } U1; | ||
186 | }; | 163 | }; |
187 | 164 | ||
188 | #define Command U1.S1.CmdHdr.PcCommand | 165 | #define Command U1.S1.CmdHdr.PcCommand |
diff --git a/drivers/char/rio/control.h b/drivers/char/rio/control.h index 1712f6261dd1..6853d03304a3 100644 --- a/drivers/char/rio/control.h +++ b/drivers/char/rio/control.h | |||
@@ -51,12 +51,11 @@ | |||
51 | #define UFOAD ( CONTROL + 4 ) | 51 | #define UFOAD ( CONTROL + 4 ) |
52 | #define IWAIT ( CONTROL + 5 ) | 52 | #define IWAIT ( CONTROL + 5 ) |
53 | 53 | ||
54 | #define IFOAD_MAGIC 0xF0AD /* of course */ | 54 | #define IFOAD_MAGIC 0xF0AD /* of course */ |
55 | #define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ | 55 | #define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ |
56 | #define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ | 56 | #define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ |
57 | #define IWAIT_MAGIC 0xB1DE /* Bide your time */ | 57 | #define IWAIT_MAGIC 0xB1DE /* Bide your time */ |
58 | 58 | ||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | /*********** end of file ***********/ | 61 | /*********** end of file ***********/ |
62 | |||
diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h index 62dba0e68b3e..28a991bd4fe6 100644 --- a/drivers/char/rio/daemon.h +++ b/drivers/char/rio/daemon.h | |||
@@ -44,18 +44,16 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3"; | |||
44 | ** structures used on /dev/rio | 44 | ** structures used on /dev/rio |
45 | */ | 45 | */ |
46 | 46 | ||
47 | struct Error | 47 | struct Error { |
48 | { | 48 | uint Error; |
49 | uint Error; | 49 | uint Entry; |
50 | uint Entry; | 50 | uint Other; |
51 | uint Other; | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | struct DownLoad | 53 | struct DownLoad { |
55 | { | 54 | char *DataP; |
56 | char *DataP; | 55 | uint Count; |
57 | uint Count; | 56 | uint ProductCode; |
58 | uint ProductCode; | ||
59 | }; | 57 | }; |
60 | 58 | ||
61 | /* | 59 | /* |
@@ -66,46 +64,41 @@ struct DownLoad | |||
66 | #endif | 64 | #endif |
67 | 65 | ||
68 | #ifndef MAX_XP_CTRL_LEN | 66 | #ifndef MAX_XP_CTRL_LEN |
69 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */ | 67 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN PORT.H */ |
70 | #endif | 68 | #endif |
71 | 69 | ||
72 | struct PortSetup | 70 | struct PortSetup { |
73 | { | 71 | uint From; /* Set/Clear XP & IXANY Control from this port.... */ |
74 | uint From; /* Set/Clear XP & IXANY Control from this port.... */ | 72 | uint To; /* .... to this port */ |
75 | uint To; /* .... to this port */ | 73 | uint XpCps; /* at this speed */ |
76 | uint XpCps; /* at this speed */ | 74 | char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ |
77 | char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ | 75 | char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ |
78 | char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ | 76 | uchar IxAny; /* enable/disable IXANY */ |
79 | uchar IxAny; /* enable/disable IXANY */ | 77 | uchar IxOn; /* enable/disable IXON */ |
80 | uchar IxOn; /* enable/disable IXON */ | 78 | uchar Lock; /* lock port params */ |
81 | uchar Lock; /* lock port params */ | 79 | uchar Store; /* store params across closes */ |
82 | uchar Store; /* store params across closes */ | 80 | uchar Drain; /* close only when drained */ |
83 | uchar Drain; /* close only when drained */ | ||
84 | }; | 81 | }; |
85 | 82 | ||
86 | struct LpbReq | 83 | struct LpbReq { |
87 | { | 84 | uint Host; |
88 | uint Host; | 85 | uint Link; |
89 | uint Link; | 86 | struct LPB *LpbP; |
90 | struct LPB *LpbP; | ||
91 | }; | 87 | }; |
92 | 88 | ||
93 | struct RupReq | 89 | struct RupReq { |
94 | { | 90 | uint HostNum; |
95 | uint HostNum; | 91 | uint RupNum; |
96 | uint RupNum; | 92 | struct RUP *RupP; |
97 | struct RUP *RupP; | ||
98 | }; | 93 | }; |
99 | 94 | ||
100 | struct PortReq | 95 | struct PortReq { |
101 | { | 96 | uint SysPort; |
102 | uint SysPort; | 97 | struct Port *PortP; |
103 | struct Port *PortP; | ||
104 | }; | 98 | }; |
105 | 99 | ||
106 | struct StreamInfo | 100 | struct StreamInfo { |
107 | { | 101 | uint SysPort; |
108 | uint SysPort; | ||
109 | #if 0 | 102 | #if 0 |
110 | queue_t RQueue; | 103 | queue_t RQueue; |
111 | queue_t WQueue; | 104 | queue_t WQueue; |
@@ -115,68 +108,59 @@ struct StreamInfo | |||
115 | #endif | 108 | #endif |
116 | }; | 109 | }; |
117 | 110 | ||
118 | struct HostReq | 111 | struct HostReq { |
119 | { | 112 | uint HostNum; |
120 | uint HostNum; | 113 | struct Host *HostP; |
121 | struct Host *HostP; | ||
122 | }; | 114 | }; |
123 | 115 | ||
124 | struct HostDpRam | 116 | struct HostDpRam { |
125 | { | 117 | uint HostNum; |
126 | uint HostNum; | 118 | struct DpRam *DpRamP; |
127 | struct DpRam *DpRamP; | ||
128 | }; | 119 | }; |
129 | 120 | ||
130 | struct DebugCtrl | 121 | struct DebugCtrl { |
131 | { | 122 | uint SysPort; |
132 | uint SysPort; | 123 | uint Debug; |
133 | uint Debug; | 124 | uint Wait; |
134 | uint Wait; | ||
135 | }; | 125 | }; |
136 | 126 | ||
137 | struct MapInfo | 127 | struct MapInfo { |
138 | { | 128 | uint FirstPort; /* 8 ports, starting from this (tty) number */ |
139 | uint FirstPort; /* 8 ports, starting from this (tty) number */ | 129 | uint RtaUnique; /* reside on this RTA (unique number) */ |
140 | uint RtaUnique; /* reside on this RTA (unique number) */ | ||
141 | }; | 130 | }; |
142 | 131 | ||
143 | struct MapIn | 132 | struct MapIn { |
144 | { | 133 | uint NumEntries; /* How many port sets are we mapping? */ |
145 | uint NumEntries; /* How many port sets are we mapping? */ | 134 | struct MapInfo *MapInfoP; /* Pointer to (user space) info */ |
146 | struct MapInfo *MapInfoP; /* Pointer to (user space) info */ | ||
147 | }; | 135 | }; |
148 | 136 | ||
149 | struct SendPack | 137 | struct SendPack { |
150 | { | 138 | unsigned int PortNum; |
151 | unsigned int PortNum; | 139 | unsigned char Len; |
152 | unsigned char Len; | 140 | unsigned char Data[PKT_MAX_DATA_LEN]; |
153 | unsigned char Data[PKT_MAX_DATA_LEN]; | ||
154 | }; | 141 | }; |
155 | 142 | ||
156 | struct SpecialRupCmd | 143 | struct SpecialRupCmd { |
157 | { | 144 | struct PKT Packet; |
158 | struct PKT Packet; | 145 | unsigned short Host; |
159 | unsigned short Host; | 146 | unsigned short RupNum; |
160 | unsigned short RupNum; | ||
161 | }; | 147 | }; |
162 | 148 | ||
163 | struct IdentifyRta | 149 | struct IdentifyRta { |
164 | { | 150 | ulong RtaUnique; |
165 | ulong RtaUnique; | 151 | uchar ID; |
166 | uchar ID; | ||
167 | }; | 152 | }; |
168 | 153 | ||
169 | struct KillNeighbour | 154 | struct KillNeighbour { |
170 | { | 155 | ulong UniqueNum; |
171 | ulong UniqueNum; | 156 | uchar Link; |
172 | uchar Link; | ||
173 | }; | 157 | }; |
174 | 158 | ||
175 | struct rioVersion { | 159 | struct rioVersion { |
176 | char version[MAX_VERSION_LEN]; | 160 | char version[MAX_VERSION_LEN]; |
177 | char relid[MAX_VERSION_LEN]; | 161 | char relid[MAX_VERSION_LEN]; |
178 | int buildLevel; | 162 | int buildLevel; |
179 | char buildDate[MAX_VERSION_LEN]; | 163 | char buildDate[MAX_VERSION_LEN]; |
180 | }; | 164 | }; |
181 | 165 | ||
182 | 166 | ||
@@ -316,16 +300,16 @@ struct rioVersion { | |||
316 | #define RIO_SET_XP_CPS rIOCW(155,int) | 300 | #define RIO_SET_XP_CPS rIOCW(155,int) |
317 | #define RIO_GET_IXANY rIOCR(156,int) /* ixany allowed? */ | 301 | #define RIO_GET_IXANY rIOCR(156,int) /* ixany allowed? */ |
318 | #define RIO_SET_IXANY rIOCW(157,int) | 302 | #define RIO_SET_IXANY rIOCW(157,int) |
319 | #define RIO_SET_IXANY_ON rIOCN(158) /* allow ixany */ | 303 | #define RIO_SET_IXANY_ON rIOCN(158) /* allow ixany */ |
320 | #define RIO_SET_IXANY_OFF rIOCN(159) /* disallow ixany */ | 304 | #define RIO_SET_IXANY_OFF rIOCN(159) /* disallow ixany */ |
321 | #define RIO_GET_MODEM rIOCR(160,int) /* port is modem/direct line? */ | 305 | #define RIO_GET_MODEM rIOCR(160,int) /* port is modem/direct line? */ |
322 | #define RIO_SET_MODEM rIOCW(161,int) | 306 | #define RIO_SET_MODEM rIOCW(161,int) |
323 | #define RIO_SET_MODEM_ON rIOCN(162) /* port is a modem */ | 307 | #define RIO_SET_MODEM_ON rIOCN(162) /* port is a modem */ |
324 | #define RIO_SET_MODEM_OFF rIOCN(163) /* port is direct */ | 308 | #define RIO_SET_MODEM_OFF rIOCN(163) /* port is direct */ |
325 | #define RIO_GET_IXON rIOCR(164,int) /* ixon allowed? */ | 309 | #define RIO_GET_IXON rIOCR(164,int) /* ixon allowed? */ |
326 | #define RIO_SET_IXON rIOCW(165,int) | 310 | #define RIO_SET_IXON rIOCW(165,int) |
327 | #define RIO_SET_IXON_ON rIOCN(166) /* allow ixon */ | 311 | #define RIO_SET_IXON_ON rIOCN(166) /* allow ixon */ |
328 | #define RIO_SET_IXON_OFF rIOCN(167) /* disallow ixon */ | 312 | #define RIO_SET_IXON_OFF rIOCN(167) /* disallow ixon */ |
329 | 313 | ||
330 | #define RIO_GET_SIVIEW ((('s')<<8) | 106) /* backwards compatible with SI */ | 314 | #define RIO_GET_SIVIEW ((('s')<<8) | 106) /* backwards compatible with SI */ |
331 | 315 | ||
diff --git a/drivers/char/rio/debug.h b/drivers/char/rio/debug.h index b6e0d0935552..6ae95c00db4a 100644 --- a/drivers/char/rio/debug.h +++ b/drivers/char/rio/debug.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn)) | 33 | #define DBPACKET(pkt, opt, str, chn) debug_packet((pkt), (opt), (str), (chn)) |
34 | #else | 34 | #else |
35 | #define DBPACKET(pkt, opt, str, c) | 35 | #define DBPACKET(pkt, opt, str, c) |
36 | #endif /* DCIRRUS */ | 36 | #endif /* DCIRRUS */ |
37 | 37 | ||
38 | 38 | ||
39 | #endif /* _debug_h_ */ | 39 | #endif /* _debug_h_ */ |
diff --git a/drivers/char/rio/defaults.h b/drivers/char/rio/defaults.h index 2e7309e27622..5b600c32ac02 100644 --- a/drivers/char/rio/defaults.h +++ b/drivers/char/rio/defaults.h | |||
@@ -37,13 +37,13 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS | 39 | #ifdef SCCS |
40 | static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ; | 40 | static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | 44 | ||
45 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ | 45 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ |
46 | #define SECOND (int) 15625 /* Low priority ticks */ | 46 | #define SECOND (int) 15625 /* Low priority ticks */ |
47 | 47 | ||
48 | #ifdef RTA | 48 | #ifdef RTA |
49 | #define RX_LIMIT (ushort) 3 | 49 | #define RX_LIMIT (ushort) 3 |
@@ -56,4 +56,3 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1" ; | |||
56 | 56 | ||
57 | 57 | ||
58 | /*********** end of file ***********/ | 58 | /*********** end of file ***********/ |
59 | |||
diff --git a/drivers/char/rio/eisa.h b/drivers/char/rio/eisa.h index 59371b0528b0..c2abaf0eab04 100644 --- a/drivers/char/rio/eisa.h +++ b/drivers/char/rio/eisa.h | |||
@@ -60,7 +60,7 @@ static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2"; | |||
60 | 60 | ||
61 | #define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */ | 61 | #define EISA_PRODUCT_IDENT_LO 0xC80 /* where RIO_EISA_IDENT is */ |
62 | #define EISA_PRODUCT_IDENT_HI 0xC81 | 62 | #define EISA_PRODUCT_IDENT_HI 0xC81 |
63 | #define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */ | 63 | #define EISA_PRODUCT_NUMBER 0xC82 /* where PROD_CODE is */ |
64 | #define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */ | 64 | #define EISA_REVISION_NUMBER 0xC83 /* revision (1dp) */ |
65 | #define EISA_ENABLE 0xC84 /* set LSB to enable card */ | 65 | #define EISA_ENABLE 0xC84 /* set LSB to enable card */ |
66 | #define EISA_UNIQUE_NUM_0 0xC88 /* vomit */ | 66 | #define EISA_UNIQUE_NUM_0 0xC88 /* vomit */ |
@@ -101,4 +101,4 @@ static char *_eisa_h_sccs_ = "@(#)eisa.h 1.2"; | |||
101 | #define INBZ(z,x) inb(((z)<<12) | (x)) | 101 | #define INBZ(z,x) inb(((z)<<12) | (x)) |
102 | #define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y) | 102 | #define OUTBZ(z,x,y) outb((((z)<<12) | (x)), y) |
103 | 103 | ||
104 | #endif /* __rio_eisa_h__ */ | 104 | #endif /* __rio_eisa_h__ */ |
diff --git a/drivers/char/rio/enable.h b/drivers/char/rio/enable.h index 8e9a419e15b0..e06673fa48cf 100644 --- a/drivers/char/rio/enable.h +++ b/drivers/char/rio/enable.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifndef lint | 37 | #ifndef lint |
38 | #ifdef SCCS | 38 | #ifdef SCCS |
39 | static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ; | 39 | static char *_rio_enable_h_sccs = "@(#)enable.h 1.1"; |
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -46,5 +46,3 @@ static char *_rio_enable_h_sccs = "@(#)enable.h 1.1" ; | |||
46 | 46 | ||
47 | 47 | ||
48 | /*********** end of file ***********/ | 48 | /*********** end of file ***********/ |
49 | |||
50 | |||
diff --git a/drivers/char/rio/error.h b/drivers/char/rio/error.h index 229438e355f2..f20f0789db8f 100644 --- a/drivers/char/rio/error.h +++ b/drivers/char/rio/error.h | |||
@@ -80,6 +80,3 @@ | |||
80 | 80 | ||
81 | 81 | ||
82 | /*********** end of file ***********/ | 82 | /*********** end of file ***********/ |
83 | |||
84 | |||
85 | |||
diff --git a/drivers/char/rio/errors.h b/drivers/char/rio/errors.h index f920b9f3e2bd..1d0d89144337 100644 --- a/drivers/char/rio/errors.h +++ b/drivers/char/rio/errors.h | |||
@@ -101,4 +101,4 @@ static char *_errors_h_sccs_ = "@(#)errors.h 1.2"; | |||
101 | #define NOT_ENOUGH_CORE_FOR_PCI_COPY 53 | 101 | #define NOT_ENOUGH_CORE_FOR_PCI_COPY 53 |
102 | 102 | ||
103 | 103 | ||
104 | #endif /* __rio_errors_h__ */ | 104 | #endif /* __rio_errors_h__ */ |
diff --git a/drivers/char/rio/formpkt.h b/drivers/char/rio/formpkt.h index a8b65ae0de90..3c7c91ace3ee 100644 --- a/drivers/char/rio/formpkt.h +++ b/drivers/char/rio/formpkt.h | |||
@@ -41,114 +41,113 @@ | |||
41 | 41 | ||
42 | #ifndef lint | 42 | #ifndef lint |
43 | #ifdef SCCS | 43 | #ifdef SCCS |
44 | static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1" ; | 44 | static char *_rio_formpkt_h_sccs = "@(#)formpkt.h 1.1"; |
45 | #endif | 45 | #endif |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1 ; | 48 | typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1; |
49 | struct FORM_BOOT_PKT_1 { | 49 | struct FORM_BOOT_PKT_1 { |
50 | ushort pkt_number ; | 50 | ushort pkt_number; |
51 | ushort pkt_total ; | 51 | ushort pkt_total; |
52 | ushort boot_top ; | 52 | ushort boot_top; |
53 | } ; | 53 | }; |
54 | 54 | ||
55 | typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2 ; | 55 | typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2; |
56 | struct FORM_BOOT_PKT_2 { | 56 | struct FORM_BOOT_PKT_2 { |
57 | ushort pkt_number ; | 57 | ushort pkt_number; |
58 | char boot_data[10] ; | 58 | char boot_data[10]; |
59 | } ; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA ; | 62 | typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA; |
63 | struct FORM_ATTACH_RTA { | 63 | struct FORM_ATTACH_RTA { |
64 | char cmd_code ; | 64 | char cmd_code; |
65 | char booter_serial[4] ; | 65 | char booter_serial[4]; |
66 | char booter_link ; | 66 | char booter_link; |
67 | char bootee_serial[4] ; | 67 | char bootee_serial[4]; |
68 | char bootee_link ; | 68 | char bootee_link; |
69 | } ; | 69 | }; |
70 | 70 | ||
71 | 71 | ||
72 | typedef struct FORM_BOOT_ID FORM_BOOT_ID ; | 72 | typedef struct FORM_BOOT_ID FORM_BOOT_ID; |
73 | struct FORM_BOOT_ID { | 73 | struct FORM_BOOT_ID { |
74 | char cmd_code ; | 74 | char cmd_code; |
75 | char bootee_serial[4] ; | 75 | char bootee_serial[4]; |
76 | char bootee_prod_id ; | 76 | char bootee_prod_id; |
77 | char bootee_link ; | 77 | char bootee_link; |
78 | } ; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | typedef struct FORM_ROUTE_1 FORM_ROUTE_1 ; | 82 | typedef struct FORM_ROUTE_1 FORM_ROUTE_1; |
83 | struct FORM_ROUTE_1 { | 83 | struct FORM_ROUTE_1 { |
84 | char cmd_code ; | 84 | char cmd_code; |
85 | char pkt_number ; | 85 | char pkt_number; |
86 | char total_in_sequence ; | 86 | char total_in_sequence; |
87 | char unit_id ; | 87 | char unit_id; |
88 | char host_unit_id ; | 88 | char host_unit_id; |
89 | } ; | 89 | }; |
90 | 90 | ||
91 | typedef struct FORM_ROUTE_2 FORM_ROUTE_2 ; | 91 | typedef struct FORM_ROUTE_2 FORM_ROUTE_2; |
92 | struct FORM_ROUTE_2 { | 92 | struct FORM_ROUTE_2 { |
93 | char cmd_code ; | 93 | char cmd_code; |
94 | char pkt_number ; | 94 | char pkt_number; |
95 | char total_in_sequence ; | 95 | char total_in_sequence; |
96 | char route_data[9] ; | 96 | char route_data[9]; |
97 | } ; | 97 | }; |
98 | 98 | ||
99 | typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ ; | 99 | typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ; |
100 | struct FORM_ROUTE_REQ { | 100 | struct FORM_ROUTE_REQ { |
101 | char cmd_code ; | 101 | char cmd_code; |
102 | char pkt_number ; | 102 | char pkt_number; |
103 | char total_in_sequence ; | 103 | char total_in_sequence; |
104 | char route_data[10] ; | 104 | char route_data[10]; |
105 | } ; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | typedef struct FORM_ERROR FORM_ERROR ; | 108 | typedef struct FORM_ERROR FORM_ERROR; |
109 | struct FORM_ERROR { | 109 | struct FORM_ERROR { |
110 | char cmd_code ; | 110 | char cmd_code; |
111 | char error_code ; | 111 | char error_code; |
112 | 112 | ||
113 | } ; | 113 | }; |
114 | 114 | ||
115 | typedef struct FORM_STATUS FORM_STATUS ; | 115 | typedef struct FORM_STATUS FORM_STATUS; |
116 | struct FORM_STATUS { | 116 | struct FORM_STATUS { |
117 | char cmd_code ; | 117 | char cmd_code; |
118 | char status_code ; | 118 | char status_code; |
119 | char last_packet_valid ; | 119 | char last_packet_valid; |
120 | char tx_buffer ; | 120 | char tx_buffer; |
121 | char rx_buffer ; | 121 | char rx_buffer; |
122 | char port_status ; | 122 | char port_status; |
123 | char phb_status ; | 123 | char phb_status; |
124 | } ; | 124 | }; |
125 | 125 | ||
126 | 126 | ||
127 | typedef struct FORM_LINK_STATUS FORM_LINK_STATUS ; | 127 | typedef struct FORM_LINK_STATUS FORM_LINK_STATUS; |
128 | struct FORM_LINK_STATUS { | 128 | struct FORM_LINK_STATUS { |
129 | char cmd_code ; | 129 | char cmd_code; |
130 | char status_code ; | 130 | char status_code; |
131 | char link_number ; | 131 | char link_number; |
132 | ushort rx_errors ; | 132 | ushort rx_errors; |
133 | ushort tx_errors ; | 133 | ushort tx_errors; |
134 | ushort csum_errors ; | 134 | ushort csum_errors; |
135 | ushort disconnects ; | 135 | ushort disconnects; |
136 | } ; | 136 | }; |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | typedef struct FORM_PARTITION FORM_PARTITION ; | 140 | typedef struct FORM_PARTITION FORM_PARTITION; |
141 | struct FORM_PARTITION { | 141 | struct FORM_PARTITION { |
142 | char cmd_code ; | 142 | char cmd_code; |
143 | char status_code ; | 143 | char status_code; |
144 | char port_number ; | 144 | char port_number; |
145 | char tx_max ; | 145 | char tx_max; |
146 | char rx_max ; | 146 | char rx_max; |
147 | char rx_limit ; | 147 | char rx_limit; |
148 | } ; | 148 | }; |
149 | 149 | ||
150 | 150 | ||
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | /*********** end of file ***********/ | 153 | /*********** end of file ***********/ |
154 | |||
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h index 01987c6dc398..b4778410ec6e 100644 --- a/drivers/char/rio/func.h +++ b/drivers/char/rio/func.h | |||
@@ -47,20 +47,19 @@ int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *); | |||
47 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); | 47 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); |
48 | void msec_timeout(struct Host *); | 48 | void msec_timeout(struct Host *); |
49 | int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); | 49 | int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); |
50 | int RIOBootOk(struct rio_info *,struct Host *, ulong); | 50 | int RIOBootOk(struct rio_info *, struct Host *, ulong); |
51 | int RIORtaBound(struct rio_info *, uint); | 51 | int RIORtaBound(struct rio_info *, uint); |
52 | void FillSlot(int, int, uint, struct Host *); | 52 | void FillSlot(int, int, uint, struct Host *); |
53 | 53 | ||
54 | /* riocmd.c */ | 54 | /* riocmd.c */ |
55 | int RIOFoadRta(struct Host *, struct Map *); | 55 | int RIOFoadRta(struct Host *, struct Map *); |
56 | int RIOZombieRta(struct Host *, struct Map *); | 56 | int RIOZombieRta(struct Host *, struct Map *); |
57 | int RIOCommandRta(struct rio_info *, uint, int (* func)( struct Host *, | 57 | int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *)); |
58 | struct Map *)); | 58 | int RIOIdentifyRta(struct rio_info *, caddr_t); |
59 | int RIOIdentifyRta(struct rio_info *, caddr_t); | ||
60 | int RIOKillNeighbour(struct rio_info *, caddr_t); | 59 | int RIOKillNeighbour(struct rio_info *, caddr_t); |
61 | int RIOSuspendBootRta(struct Host *, int, int); | 60 | int RIOSuspendBootRta(struct Host *, int, int); |
62 | int RIOFoadWakeup(struct rio_info *); | 61 | int RIOFoadWakeup(struct rio_info *); |
63 | struct CmdBlk * RIOGetCmdBlk(void); | 62 | struct CmdBlk *RIOGetCmdBlk(void); |
64 | void RIOFreeCmdBlk(struct CmdBlk *); | 63 | void RIOFreeCmdBlk(struct CmdBlk *); |
65 | int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); | 64 | int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); |
66 | void RIOPollHostCommands(struct rio_info *, struct Host *); | 65 | void RIOPollHostCommands(struct rio_info *, struct Host *); |
@@ -71,13 +70,13 @@ void ShowPacket(uint, struct PKT *); | |||
71 | 70 | ||
72 | /* rioctrl.c */ | 71 | /* rioctrl.c */ |
73 | int copyin(int, caddr_t, int); | 72 | int copyin(int, caddr_t, int); |
74 | int riocontrol(struct rio_info *, dev_t,int,caddr_t,int); | 73 | int riocontrol(struct rio_info *, dev_t, int, caddr_t, int); |
75 | int RIOPreemptiveCmd(struct rio_info *,struct Port *,uchar); | 74 | int RIOPreemptiveCmd(struct rio_info *, struct Port *, uchar); |
76 | 75 | ||
77 | /* rioinit.c */ | 76 | /* rioinit.c */ |
78 | void rioinit(struct rio_info *, struct RioHostInfo *); | 77 | void rioinit(struct rio_info *, struct RioHostInfo *); |
79 | void RIOInitHosts(struct rio_info *, struct RioHostInfo *); | 78 | void RIOInitHosts(struct rio_info *, struct RioHostInfo *); |
80 | void RIOISAinit(struct rio_info *,int); | 79 | void RIOISAinit(struct rio_info *, int); |
81 | int RIODoAT(struct rio_info *, int, int); | 80 | int RIODoAT(struct rio_info *, int, int); |
82 | caddr_t RIOCheckForATCard(int); | 81 | caddr_t RIOCheckForATCard(int); |
83 | int RIOAssignAT(struct rio_info *, int, caddr_t, int); | 82 | int RIOAssignAT(struct rio_info *, int, caddr_t, int); |
@@ -85,7 +84,7 @@ int RIOBoardTest(paddr_t, caddr_t, uchar, int); | |||
85 | void RIOAllocDataStructs(struct rio_info *); | 84 | void RIOAllocDataStructs(struct rio_info *); |
86 | void RIOSetupDataStructs(struct rio_info *); | 85 | void RIOSetupDataStructs(struct rio_info *); |
87 | int RIODefaultName(struct rio_info *, struct Host *, uint); | 86 | int RIODefaultName(struct rio_info *, struct Host *, uint); |
88 | struct rioVersion * RIOVersid(void); | 87 | struct rioVersion *RIOVersid(void); |
89 | int RIOMapin(paddr_t, int, caddr_t *); | 88 | int RIOMapin(paddr_t, int, caddr_t *); |
90 | void RIOMapout(paddr_t, long, caddr_t); | 89 | void RIOMapout(paddr_t, long, caddr_t); |
91 | void RIOHostReset(uint, volatile struct DpRam *, uint); | 90 | void RIOHostReset(uint, volatile struct DpRam *, uint); |
@@ -108,7 +107,7 @@ void remove_receive(struct Port *); | |||
108 | 107 | ||
109 | /* rioroute.c */ | 108 | /* rioroute.c */ |
110 | int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *); | 109 | int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *); |
111 | void RIOFixPhbs(struct rio_info *, struct Host *, uint); | 110 | void RIOFixPhbs(struct rio_info *, struct Host *, uint); |
112 | uint GetUnitType(uint); | 111 | uint GetUnitType(uint); |
113 | int RIOSetChange(struct rio_info *); | 112 | int RIOSetChange(struct rio_info *); |
114 | int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); | 113 | int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); |
@@ -116,9 +115,9 @@ int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); | |||
116 | 115 | ||
117 | /* riotty.c */ | 116 | /* riotty.c */ |
118 | 117 | ||
119 | int riotopen(struct tty_struct * tty, struct file * filp); | 118 | int riotopen(struct tty_struct *tty, struct file *filp); |
120 | int riotclose(void *ptr); | 119 | int riotclose(void *ptr); |
121 | int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); | 120 | int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); |
122 | void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); | 121 | void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); |
123 | 122 | ||
124 | /* riotable.c */ | 123 | /* riotable.c */ |
@@ -127,27 +126,27 @@ int RIOApel(struct rio_info *); | |||
127 | int RIODeleteRta(struct rio_info *, struct Map *); | 126 | int RIODeleteRta(struct rio_info *, struct Map *); |
128 | int RIOAssignRta(struct rio_info *, struct Map *); | 127 | int RIOAssignRta(struct rio_info *, struct Map *); |
129 | int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *); | 128 | int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *); |
130 | int RIOChangeName(struct rio_info *, struct Map*); | 129 | int RIOChangeName(struct rio_info *, struct Map *); |
131 | 130 | ||
132 | #if 0 | 131 | #if 0 |
133 | /* riodrvr.c */ | 132 | /* riodrvr.c */ |
134 | struct rio_info * rio_install(struct RioHostInfo *); | 133 | struct rio_info *rio_install(struct RioHostInfo *); |
135 | int rio_uninstall(register struct rio_info *); | 134 | int rio_uninstall(register struct rio_info *); |
136 | int rio_open(struct rio_info *, int, struct file *); | 135 | int rio_open(struct rio_info *, int, struct file *); |
137 | int rio_close(struct rio_info *, struct file *); | 136 | int rio_close(struct rio_info *, struct file *); |
138 | int rio_read(struct rio_info *, struct file *, char *, int); | 137 | int rio_read(struct rio_info *, struct file *, char *, int); |
139 | int rio_write(struct rio_info *, struct file * f, char *, int); | 138 | int rio_write(struct rio_info *, struct file *f, char *, int); |
140 | int rio_ioctl(struct rio_info *, struct file *, int, char *); | 139 | int rio_ioctl(struct rio_info *, struct file *, int, char *); |
141 | int rio_select(struct rio_info *, struct file * f, int, struct sel *); | 140 | int rio_select(struct rio_info *, struct file *f, int, struct sel *); |
142 | int rio_intr(char *); | 141 | int rio_intr(char *); |
143 | int rio_isr_thread(char *); | 142 | int rio_isr_thread(char *); |
144 | struct rio_info * rio_info_store( int cmd, struct rio_info * p); | 143 | struct rio_info *rio_info_store(int cmd, struct rio_info *p); |
145 | #endif | 144 | #endif |
146 | 145 | ||
147 | extern int rio_pcicopy(char *src, char *dst, int n); | 146 | extern int rio_pcicopy(char *src, char *dst, int n); |
148 | extern int rio_minor (struct tty_struct *tty); | 147 | extern int rio_minor(struct tty_struct *tty); |
149 | extern int rio_ismodem (struct tty_struct *tty); | 148 | extern int rio_ismodem(struct tty_struct *tty); |
150 | 149 | ||
151 | extern void rio_start_card_running (struct Host * HostP); | 150 | extern void rio_start_card_running(struct Host *HostP); |
152 | 151 | ||
153 | #endif /* __func_h_def */ | 152 | #endif /* __func_h_def */ |
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index 4c65963870a4..f7dfcedf7d45 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h | |||
@@ -49,33 +49,32 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2"; | |||
49 | ** Host data structure. This is used for the software equiv. of | 49 | ** Host data structure. This is used for the software equiv. of |
50 | ** the host. | 50 | ** the host. |
51 | */ | 51 | */ |
52 | struct Host | 52 | struct Host { |
53 | { | 53 | uchar Type; /* RIO_EISA, RIO_MCA, ... */ |
54 | uchar Type; /* RIO_EISA, RIO_MCA, ... */ | 54 | uchar Ivec; /* POLLED or ivec number */ |
55 | uchar Ivec; /* POLLED or ivec number */ | 55 | uchar Mode; /* Control stuff */ |
56 | uchar Mode; /* Control stuff */ | 56 | uchar Slot; /* Slot */ |
57 | uchar Slot; /* Slot */ | 57 | volatile caddr_t Caddr; /* KV address of DPRAM */ |
58 | volatile caddr_t Caddr; /* KV address of DPRAM */ | 58 | volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */ |
59 | volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */ | 59 | paddr_t PaddrP; /* Phys. address of DPRAM */ |
60 | paddr_t PaddrP; /* Phys. address of DPRAM */ | 60 | char Name[MAX_NAME_LEN]; /* The name of the host */ |
61 | char Name[MAX_NAME_LEN]; /* The name of the host */ | 61 | uint UniqueNum; /* host unique number */ |
62 | uint UniqueNum; /* host unique number */ | 62 | spinlock_t HostLock; /* Lock structure for MPX */ |
63 | spinlock_t HostLock; /* Lock structure for MPX */ | 63 | /*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */ |
64 | /*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */ | 64 | /*struct lockb HostLock; *//* Lock structure for MPX */ |
65 | /*struct lockb HostLock; *//* Lock structure for MPX */ | 65 | uint WorkToBeDone; /* set to true each interrupt */ |
66 | uint WorkToBeDone; /* set to true each interrupt */ | 66 | uint InIntr; /* Being serviced? */ |
67 | uint InIntr; /* Being serviced? */ | 67 | uint IntSrvDone; /* host's interrupt has been serviced */ |
68 | uint IntSrvDone;/* host's interrupt has been serviced */ | 68 | int (*Copy) (caddr_t, caddr_t, int); /* copy func */ |
69 | int (*Copy)( caddr_t, caddr_t, int ); /* copy func */ | 69 | struct timer_list timer; |
70 | struct timer_list timer; | 70 | /* |
71 | /* | 71 | ** I M P O R T A N T ! |
72 | ** I M P O R T A N T ! | 72 | ** |
73 | ** | 73 | ** The rest of this data structure is cleared to zero after |
74 | ** The rest of this data structure is cleared to zero after | 74 | ** a RIO_HOST_FOAD command. |
75 | ** a RIO_HOST_FOAD command. | 75 | */ |
76 | */ | 76 | |
77 | 77 | ulong Flags; /* Whats going down */ | |
78 | ulong Flags; /* Whats going down */ | ||
79 | #define RC_WAITING 0 | 78 | #define RC_WAITING 0 |
80 | #define RC_STARTUP 1 | 79 | #define RC_STARTUP 1 |
81 | #define RC_RUNNING 2 | 80 | #define RC_RUNNING 2 |
@@ -93,25 +92,25 @@ struct Host | |||
93 | #define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ | 92 | #define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ |
94 | #define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ | 93 | #define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ |
95 | 94 | ||
96 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ | 95 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ |
97 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ | 96 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ |
98 | struct PHB *PhbP; /* Pointer to the PHB array */ | 97 | struct PHB *PhbP; /* Pointer to the PHB array */ |
99 | ushort *PhbNumP; /* Ptr to Number of PHB's */ | 98 | ushort *PhbNumP; /* Ptr to Number of PHB's */ |
100 | struct LPB *LinkStrP ; /* Link Structure Array */ | 99 | struct LPB *LinkStrP; /* Link Structure Array */ |
101 | struct RUP *RupP; /* Sixteen real rups here */ | 100 | struct RUP *RupP; /* Sixteen real rups here */ |
102 | struct PARM_MAP *ParmMapP; /* points to the parmmap */ | 101 | struct PARM_MAP *ParmMapP; /* points to the parmmap */ |
103 | uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ | 102 | uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ |
104 | uint NumExtraBooted; /* how many of the above */ | 103 | uint NumExtraBooted; /* how many of the above */ |
105 | /* | 104 | /* |
106 | ** Twenty logical rups. | 105 | ** Twenty logical rups. |
107 | ** The first sixteen are the real Rup entries (above), the last four | 106 | ** The first sixteen are the real Rup entries (above), the last four |
108 | ** are the link RUPs. | 107 | ** are the link RUPs. |
109 | */ | 108 | */ |
110 | struct UnixRup UnixRups[MAX_RUP+LINKS_PER_UNIT]; | 109 | struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT]; |
111 | int timeout_id; /* For calling 100 ms delays */ | 110 | int timeout_id; /* For calling 100 ms delays */ |
112 | int timeout_sem;/* For calling 100 ms delays */ | 111 | int timeout_sem; /* For calling 100 ms delays */ |
113 | long locks; /* long req'd for set_bit --RR */ | 112 | long locks; /* long req'd for set_bit --RR */ |
114 | char ____end_marker____; | 113 | char ____end_marker____; |
115 | }; | 114 | }; |
116 | #define Control CardP->DpControl | 115 | #define Control CardP->DpControl |
117 | #define SetInt CardP->DpSetInt | 116 | #define SetInt CardP->DpSetInt |
@@ -129,6 +128,6 @@ struct Host | |||
129 | #define Year CardP->DpYear | 128 | #define Year CardP->DpYear |
130 | #define Week CardP->DpWeek | 129 | #define Week CardP->DpWeek |
131 | 130 | ||
132 | #define RIO_DUMBPARM 0x0860 /* what not to expect */ | 131 | #define RIO_DUMBPARM 0x0860 /* what not to expect */ |
133 | 132 | ||
134 | #endif | 133 | #endif |
diff --git a/drivers/char/rio/hosthw.h b/drivers/char/rio/hosthw.h index f6f31ece6e32..6281fe47f4e9 100644 --- a/drivers/char/rio/hosthw.h +++ b/drivers/char/rio/hosthw.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ; | 40 | static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -53,5 +53,3 @@ static char *_rio_hosthw_h_sccs = "@(#)hosthw.h 1.2" ; | |||
53 | 53 | ||
54 | 54 | ||
55 | /*********** end of file ***********/ | 55 | /*********** end of file ***********/ |
56 | |||
57 | |||
diff --git a/drivers/char/rio/link.h b/drivers/char/rio/link.h index 972250348f4a..bfba5b0c033e 100644 --- a/drivers/char/rio/link.h +++ b/drivers/char/rio/link.h | |||
@@ -70,27 +70,27 @@ | |||
70 | #define DIE_NOW (ushort) 0x0200 | 70 | #define DIE_NOW (ushort) 0x0200 |
71 | 71 | ||
72 | /* Boot request stuff */ | 72 | /* Boot request stuff */ |
73 | #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ | 73 | #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ |
74 | #define BOOT_ABORT ((ushort) 1) /* Abort a boot */ | 74 | #define BOOT_ABORT ((ushort) 1) /* Abort a boot */ |
75 | #define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets | 75 | #define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets |
76 | and load address */ | 76 | and load address */ |
77 | #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ | 77 | #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ |
78 | 78 | ||
79 | /* States that a link can be in */ | 79 | /* States that a link can be in */ |
80 | #define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */ | 80 | #define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */ |
81 | #define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */ | 81 | #define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */ |
82 | #define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */ | 82 | #define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */ |
83 | #define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */ | 83 | #define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */ |
84 | #define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */ | 84 | #define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */ |
85 | #define LINK_SYNC ((ushort) 5) /* Syncing */ | 85 | #define LINK_SYNC ((ushort) 5) /* Syncing */ |
86 | 86 | ||
87 | #define LINK_INTRO ((ushort) 10) /* Introductory packet */ | 87 | #define LINK_INTRO ((ushort) 10) /* Introductory packet */ |
88 | #define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */ | 88 | #define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */ |
89 | #define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */ | 89 | #define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */ |
90 | #define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */ | 90 | #define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */ |
91 | #define LINK_CONNECTED ((ushort) 14) /* Connected */ | 91 | #define LINK_CONNECTED ((ushort) 14) /* Connected */ |
92 | 92 | ||
93 | #define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */ | 93 | #define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */ |
94 | 94 | ||
95 | #define LINK_SPARE ((ushort) 40) | 95 | #define LINK_SPARE ((ushort) 40) |
96 | 96 | ||
@@ -103,12 +103,12 @@ | |||
103 | ** LED stuff | 103 | ** LED stuff |
104 | */ | 104 | */ |
105 | #if defined(RTA) | 105 | #if defined(RTA) |
106 | #define LED_OFF ((ushort) 0) /* LED off */ | 106 | #define LED_OFF ((ushort) 0) /* LED off */ |
107 | #define LED_RED ((ushort) 1) /* LED Red */ | 107 | #define LED_RED ((ushort) 1) /* LED Red */ |
108 | #define LED_GREEN ((ushort) 2) /* LED Green */ | 108 | #define LED_GREEN ((ushort) 2) /* LED Green */ |
109 | #define LED_ORANGE ((ushort) 4) /* LED Orange */ | 109 | #define LED_ORANGE ((ushort) 4) /* LED Orange */ |
110 | #define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */ | 110 | #define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */ |
111 | #define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */ | 111 | #define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */ |
112 | #define LED_SET_COLOUR(colour) (link->led = (colour)) | 112 | #define LED_SET_COLOUR(colour) (link->led = (colour)) |
113 | #define LED_OR_COLOUR(colour) (link->led |= (colour)) | 113 | #define LED_OR_COLOUR(colour) (link->led |= (colour)) |
114 | #define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time))) | 114 | #define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time))) |
@@ -116,72 +116,72 @@ | |||
116 | #define LED_SET_COLOUR(colour) | 116 | #define LED_SET_COLOUR(colour) |
117 | #define LED_OR_COLOUR(colour) | 117 | #define LED_OR_COLOUR(colour) |
118 | #define LED_TIMEOUT(time) | 118 | #define LED_TIMEOUT(time) |
119 | #endif /* RTA */ | 119 | #endif /* RTA */ |
120 | 120 | ||
121 | struct LPB { | 121 | struct LPB { |
122 | WORD link_number ; /* Link Number */ | 122 | WORD link_number; /* Link Number */ |
123 | Channel_ptr in_ch ; /* Link In Channel */ | 123 | Channel_ptr in_ch; /* Link In Channel */ |
124 | Channel_ptr out_ch ; /* Link Out Channel */ | 124 | Channel_ptr out_ch; /* Link Out Channel */ |
125 | #ifdef RTA | 125 | #ifdef RTA |
126 | uchar stat_led ; /* Port open leds */ | 126 | uchar stat_led; /* Port open leds */ |
127 | uchar led ; /* True, light led! */ | 127 | uchar led; /* True, light led! */ |
128 | #endif | 128 | #endif |
129 | BYTE attached_serial[4]; /* Attached serial number */ | 129 | BYTE attached_serial[4]; /* Attached serial number */ |
130 | BYTE attached_host_serial[4]; | 130 | BYTE attached_host_serial[4]; |
131 | /* Serial number of Host who | 131 | /* Serial number of Host who |
132 | booted the other end */ | 132 | booted the other end */ |
133 | WORD descheduled ; /* Currently Descheduled */ | 133 | WORD descheduled; /* Currently Descheduled */ |
134 | WORD state; /* Current state */ | 134 | WORD state; /* Current state */ |
135 | WORD send_poll ; /* Send a Poll Packet */ | 135 | WORD send_poll; /* Send a Poll Packet */ |
136 | Process_ptr ltt_p ; /* Process Descriptor */ | 136 | Process_ptr ltt_p; /* Process Descriptor */ |
137 | Process_ptr lrt_p ; /* Process Descriptor */ | 137 | Process_ptr lrt_p; /* Process Descriptor */ |
138 | WORD lrt_status ; /* Current lrt status */ | 138 | WORD lrt_status; /* Current lrt status */ |
139 | WORD ltt_status ; /* Current ltt status */ | 139 | WORD ltt_status; /* Current ltt status */ |
140 | WORD timeout ; /* Timeout value */ | 140 | WORD timeout; /* Timeout value */ |
141 | WORD topology; /* Topology bits */ | 141 | WORD topology; /* Topology bits */ |
142 | WORD mon_ltt ; | 142 | WORD mon_ltt; |
143 | WORD mon_lrt ; | 143 | WORD mon_lrt; |
144 | WORD WaitNoBoot ; /* Secs to hold off booting */ | 144 | WORD WaitNoBoot; /* Secs to hold off booting */ |
145 | PKT_ptr add_packet_list; /* Add packets to here */ | 145 | PKT_ptr add_packet_list; /* Add packets to here */ |
146 | PKT_ptr remove_packet_list; /* Send packets from here */ | 146 | PKT_ptr remove_packet_list; /* Send packets from here */ |
147 | #ifdef RTA | 147 | #ifdef RTA |
148 | #ifdef DCIRRUS | 148 | #ifdef DCIRRUS |
149 | #define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) | 149 | #define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) |
150 | #else | 150 | #else |
151 | #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) | 151 | #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) |
152 | #endif | 152 | #endif |
153 | PKT_ptr_ptr rd_add ; /* Add a new Packet here */ | 153 | PKT_ptr_ptr rd_add; /* Add a new Packet here */ |
154 | Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ | 154 | Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ |
155 | PKT_ptr_ptr rd_add_st_qbb ; /* Pointer to start of the Q's buf */ | 155 | PKT_ptr_ptr rd_add_st_qbb; /* Pointer to start of the Q's buf */ |
156 | PKT_ptr_ptr rd_add_end_qbb ; /* Pointer to the end of the Q's buf */ | 156 | PKT_ptr_ptr rd_add_end_qbb; /* Pointer to the end of the Q's buf */ |
157 | PKT_ptr_ptr rd_remove ; /* Remove a Packet here */ | 157 | PKT_ptr_ptr rd_remove; /* Remove a Packet here */ |
158 | Q_BUF_ptr rd_remove_qb ; /* Pointer to the remove Q buf */ | 158 | Q_BUF_ptr rd_remove_qb; /* Pointer to the remove Q buf */ |
159 | PKT_ptr_ptr rd_remove_st_qbb ; /* Pointer to the start of the Q buf */ | 159 | PKT_ptr_ptr rd_remove_st_qbb; /* Pointer to the start of the Q buf */ |
160 | PKT_ptr_ptr rd_remove_end_qbb ; /* Pointer to the end of the Q buf */ | 160 | PKT_ptr_ptr rd_remove_end_qbb; /* Pointer to the end of the Q buf */ |
161 | ushort pkts_in_q ; /* Packets in queue */ | 161 | ushort pkts_in_q; /* Packets in queue */ |
162 | #endif | 162 | #endif |
163 | 163 | ||
164 | Channel_ptr lrt_fail_chan ; /* Lrt's failure channel */ | 164 | Channel_ptr lrt_fail_chan; /* Lrt's failure channel */ |
165 | Channel_ptr ltt_fail_chan ; /* Ltt's failure channel */ | 165 | Channel_ptr ltt_fail_chan; /* Ltt's failure channel */ |
166 | 166 | ||
167 | #if defined (HOST) || defined (INKERNEL) | 167 | #if defined (HOST) || defined (INKERNEL) |
168 | /* RUP structure for HOST to driver communications */ | 168 | /* RUP structure for HOST to driver communications */ |
169 | struct RUP rup ; | 169 | struct RUP rup; |
170 | #endif | 170 | #endif |
171 | struct RUP link_rup; /* RUP for the link (POLL, | 171 | struct RUP link_rup; /* RUP for the link (POLL, |
172 | topology etc.) */ | 172 | topology etc.) */ |
173 | WORD attached_link ; /* Number of attached link */ | 173 | WORD attached_link; /* Number of attached link */ |
174 | WORD csum_errors ; /* csum errors */ | 174 | WORD csum_errors; /* csum errors */ |
175 | WORD num_disconnects ; /* number of disconnects */ | 175 | WORD num_disconnects; /* number of disconnects */ |
176 | WORD num_sync_rcvd ; /* # sync's received */ | 176 | WORD num_sync_rcvd; /* # sync's received */ |
177 | WORD num_sync_rqst ; /* # sync requests */ | 177 | WORD num_sync_rqst; /* # sync requests */ |
178 | WORD num_tx ; /* Num pkts sent */ | 178 | WORD num_tx; /* Num pkts sent */ |
179 | WORD num_rx ; /* Num pkts received */ | 179 | WORD num_rx; /* Num pkts received */ |
180 | WORD module_attached; /* Module tpyes of attached */ | 180 | WORD module_attached; /* Module tpyes of attached */ |
181 | WORD led_timeout; /* LED timeout */ | 181 | WORD led_timeout; /* LED timeout */ |
182 | WORD first_port; /* First port to service */ | 182 | WORD first_port; /* First port to service */ |
183 | WORD last_port; /* Last port to service */ | 183 | WORD last_port; /* Last port to service */ |
184 | } ; | 184 | }; |
185 | 185 | ||
186 | #endif | 186 | #endif |
187 | 187 | ||
diff --git a/drivers/char/rio/linux_compat.h b/drivers/char/rio/linux_compat.h index d53843abe02d..17a14c4a3420 100644 --- a/drivers/char/rio/linux_compat.h +++ b/drivers/char/rio/linux_compat.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | struct ttystatics { | 43 | struct ttystatics { |
44 | struct termios tm; | 44 | struct termios tm; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #define bzero(d, n) memset((d), 0, (n)) | 47 | #define bzero(d, n) memset((d), 0, (n)) |
@@ -97,26 +97,24 @@ the older driver. The older driver includes "brates.h" which shadows | |||
97 | the definitions from Linux, and is incompatible... */ | 97 | the definitions from Linux, and is incompatible... */ |
98 | 98 | ||
99 | /* RxBaud and TxBaud definitions... */ | 99 | /* RxBaud and TxBaud definitions... */ |
100 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ | 100 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ |
101 | #define RIO_B50 0x01 /* 50 baud */ | 101 | #define RIO_B50 0x01 /* 50 baud */ |
102 | #define RIO_B75 0x02 /* 75 baud */ | 102 | #define RIO_B75 0x02 /* 75 baud */ |
103 | #define RIO_B110 0x03 /* 110 baud */ | 103 | #define RIO_B110 0x03 /* 110 baud */ |
104 | #define RIO_B134 0x04 /* 134.5 baud */ | 104 | #define RIO_B134 0x04 /* 134.5 baud */ |
105 | #define RIO_B150 0x05 /* 150 baud */ | 105 | #define RIO_B150 0x05 /* 150 baud */ |
106 | #define RIO_B200 0x06 /* 200 baud */ | 106 | #define RIO_B200 0x06 /* 200 baud */ |
107 | #define RIO_B300 0x07 /* 300 baud */ | 107 | #define RIO_B300 0x07 /* 300 baud */ |
108 | #define RIO_B600 0x08 /* 600 baud */ | 108 | #define RIO_B600 0x08 /* 600 baud */ |
109 | #define RIO_B1200 0x09 /* 1200 baud */ | 109 | #define RIO_B1200 0x09 /* 1200 baud */ |
110 | #define RIO_B1800 0x0A /* 1800 baud */ | 110 | #define RIO_B1800 0x0A /* 1800 baud */ |
111 | #define RIO_B2400 0x0B /* 2400 baud */ | 111 | #define RIO_B2400 0x0B /* 2400 baud */ |
112 | #define RIO_B4800 0x0C /* 4800 baud */ | 112 | #define RIO_B4800 0x0C /* 4800 baud */ |
113 | #define RIO_B9600 0x0D /* 9600 baud */ | 113 | #define RIO_B9600 0x0D /* 9600 baud */ |
114 | #define RIO_B19200 0x0E /* 19200 baud */ | 114 | #define RIO_B19200 0x0E /* 19200 baud */ |
115 | #define RIO_B38400 0x0F /* 38400 baud */ | 115 | #define RIO_B38400 0x0F /* 38400 baud */ |
116 | #define RIO_B56000 0x10 /* 56000 baud */ | 116 | #define RIO_B56000 0x10 /* 56000 baud */ |
117 | #define RIO_B57600 0x11 /* 57600 baud */ | 117 | #define RIO_B57600 0x11 /* 57600 baud */ |
118 | #define RIO_B64000 0x12 /* 64000 baud */ | 118 | #define RIO_B64000 0x12 /* 64000 baud */ |
119 | #define RIO_B115200 0x13 /* 115200 baud */ | 119 | #define RIO_B115200 0x13 /* 115200 baud */ |
120 | #define RIO_B2000 0x14 /* 2000 baud */ | 120 | #define RIO_B2000 0x14 /* 2000 baud */ |
121 | |||
122 | |||
diff --git a/drivers/char/rio/list.h b/drivers/char/rio/list.h index a4f7f1f56255..36aad4c9cb3a 100644 --- a/drivers/char/rio/list.h +++ b/drivers/char/rio/list.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | #ifndef lint | 40 | #ifndef lint |
41 | static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; | 41 | static char *_rio_list_h_sccs = "@(#)list.h 1.9"; |
42 | #endif | 42 | #endif |
43 | #endif | 43 | #endif |
44 | 44 | ||
@@ -166,7 +166,7 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; | |||
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | 168 | ||
169 | #else /* !IN_KERNEL */ | 169 | #else /* !IN_KERNEL */ |
170 | 170 | ||
171 | #define ZERO_PTR NULL | 171 | #define ZERO_PTR NULL |
172 | 172 | ||
@@ -192,5 +192,5 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9" ; | |||
192 | #define splx(oldspl) if ((oldspl) == 0) spl0() | 192 | #define splx(oldspl) if ((oldspl) == 0) spl0() |
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | #endif /* ifndef _list.h */ | 195 | #endif /* ifndef _list.h */ |
196 | /*********** end of file ***********/ | 196 | /*********** end of file ***********/ |
diff --git a/drivers/char/rio/lrt.h b/drivers/char/rio/lrt.h index bbac8fa18fee..b41764d7a22a 100644 --- a/drivers/char/rio/lrt.h +++ b/drivers/char/rio/lrt.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifndef lint | 37 | #ifndef lint |
38 | #ifdef SCCS_LABELS | 38 | #ifdef SCCS_LABELS |
39 | static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ; | 39 | static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1"; |
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -50,6 +50,3 @@ static char *_rio_lrt_h_sccs = "@(#)lrt.h 1.1" ; | |||
50 | 50 | ||
51 | 51 | ||
52 | /*********** end of file ***********/ | 52 | /*********** end of file ***********/ |
53 | |||
54 | |||
55 | |||
diff --git a/drivers/char/rio/ltt.h b/drivers/char/rio/ltt.h index f27dcecf03ca..ab04004d4048 100644 --- a/drivers/char/rio/ltt.h +++ b/drivers/char/rio/ltt.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifndef lint | 37 | #ifndef lint |
38 | #ifdef SCCS_LABELS | 38 | #ifdef SCCS_LABELS |
39 | static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ; | 39 | static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1"; |
40 | #endif | 40 | #endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -45,11 +45,8 @@ static char *_rio_ltt_h_sccs = "@(#)ltt.h 1.1" ; | |||
45 | #else | 45 | #else |
46 | #define LTT_STACK (ushort) 200 | 46 | #define LTT_STACK (ushort) 200 |
47 | #endif | 47 | #endif |
48 | |||
49 | 48 | ||
50 | 49 | ||
51 | 50 | ||
52 | /*********** end of file ***********/ | ||
53 | |||
54 | |||
55 | 51 | ||
52 | /*********** end of file ***********/ | ||
diff --git a/drivers/char/rio/lttwake.h b/drivers/char/rio/lttwake.h index fe17d0ee4933..fdf0c1f250ab 100644 --- a/drivers/char/rio/lttwake.h +++ b/drivers/char/rio/lttwake.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS_LABELS | 41 | #ifdef SCCS_LABELS |
42 | static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ; | 42 | static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
@@ -48,6 +48,3 @@ static char *_rio_lttwake_h_sccs = "@(#)lttwake.h 1.1" ; | |||
48 | 48 | ||
49 | 49 | ||
50 | /*********** end of file ***********/ | 50 | /*********** end of file ***********/ |
51 | |||
52 | |||
53 | |||
diff --git a/drivers/char/rio/map.h b/drivers/char/rio/map.h index 400645a1ff28..97fe287aab2a 100644 --- a/drivers/char/rio/map.h +++ b/drivers/char/rio/map.h | |||
@@ -46,21 +46,20 @@ static char *_map_h_sccs_ = "@(#)map.h 1.2"; | |||
46 | #define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS) | 46 | #define TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS) |
47 | #define MAX_NAME_LEN 32 | 47 | #define MAX_NAME_LEN 32 |
48 | 48 | ||
49 | struct Map | 49 | struct Map { |
50 | { | 50 | uint HostUniqueNum; /* Supporting hosts unique number */ |
51 | uint HostUniqueNum; /* Supporting hosts unique number */ | 51 | uint RtaUniqueNum; /* Unique number */ |
52 | uint RtaUniqueNum; /* Unique number */ | ||
53 | /* | 52 | /* |
54 | ** The next two IDs must be swapped on big-endian architectures | 53 | ** The next two IDs must be swapped on big-endian architectures |
55 | ** when using a v2.04 /etc/rio/config with a v3.00 driver (when | 54 | ** when using a v2.04 /etc/rio/config with a v3.00 driver (when |
56 | ** upgrading for example). | 55 | ** upgrading for example). |
57 | */ | 56 | */ |
58 | ushort ID; /* ID used in the subnet */ | 57 | ushort ID; /* ID used in the subnet */ |
59 | ushort ID2; /* ID of 2nd block of 8 for 16 port */ | 58 | ushort ID2; /* ID of 2nd block of 8 for 16 port */ |
60 | ulong Flags; /* Booted, ID Given, Disconnected */ | 59 | ulong Flags; /* Booted, ID Given, Disconnected */ |
61 | ulong SysPort; /* First tty mapped to this port */ | 60 | ulong SysPort; /* First tty mapped to this port */ |
62 | struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */ | 61 | struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */ |
63 | char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */ | 62 | char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */ |
64 | }; | 63 | }; |
65 | 64 | ||
66 | /* | 65 | /* |
diff --git a/drivers/char/rio/mca.h b/drivers/char/rio/mca.h index 08a327e473af..d01e76be7a17 100644 --- a/drivers/char/rio/mca.h +++ b/drivers/char/rio/mca.h | |||
@@ -70,4 +70,4 @@ static char *_mca_h_sccs_ = "@(#)mca.h 1.2"; | |||
70 | 70 | ||
71 | #define RIO_MCA_DEFAULT_MODE SLOW_LINKS | 71 | #define RIO_MCA_DEFAULT_MODE SLOW_LINKS |
72 | 72 | ||
73 | #endif /* __rio_mca_h__ */ | 73 | #endif /* __rio_mca_h__ */ |
diff --git a/drivers/char/rio/mesg.h b/drivers/char/rio/mesg.h index 9cf6c0bacea4..dd9be586ec6f 100644 --- a/drivers/char/rio/mesg.h +++ b/drivers/char/rio/mesg.h | |||
@@ -38,4 +38,4 @@ static char *_mesg_h_sccs_ = "@(#)mesg.h 1.2"; | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | 40 | ||
41 | #endif /* __rio_mesg_h__ */ | 41 | #endif /* __rio_mesg_h__ */ |
diff --git a/drivers/char/rio/param.h b/drivers/char/rio/param.h index 2dc30b9aab37..de7e57180c91 100644 --- a/drivers/char/rio/param.h +++ b/drivers/char/rio/param.h | |||
@@ -42,20 +42,19 @@ static char *_param_h_sccs_ = "@(#)param.h 1.2"; | |||
42 | ** the param command block, as used in OPEN and PARAM calls. | 42 | ** the param command block, as used in OPEN and PARAM calls. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | struct phb_param | 45 | struct phb_param { |
46 | { | 46 | BYTE Cmd; /* It is very important that these line up */ |
47 | BYTE Cmd; /* It is very important that these line up */ | 47 | BYTE Cor1; /* with what is expected at the other end. */ |
48 | BYTE Cor1; /* with what is expected at the other end. */ | 48 | BYTE Cor2; /* to confirm that you've got it right, */ |
49 | BYTE Cor2; /* to confirm that you've got it right, */ | 49 | BYTE Cor4; /* check with cirrus/cirrus.h */ |
50 | BYTE Cor4; /* check with cirrus/cirrus.h */ | 50 | BYTE Cor5; |
51 | BYTE Cor5; | 51 | BYTE TxXon; /* Transmit X-On character */ |
52 | BYTE TxXon; /* Transmit X-On character */ | 52 | BYTE TxXoff; /* Transmit X-Off character */ |
53 | BYTE TxXoff; /* Transmit X-Off character */ | 53 | BYTE RxXon; /* Receive X-On character */ |
54 | BYTE RxXon; /* Receive X-On character */ | 54 | BYTE RxXoff; /* Receive X-Off character */ |
55 | BYTE RxXoff; /* Receive X-Off character */ | 55 | BYTE LNext; /* Literal-next character */ |
56 | BYTE LNext; /* Literal-next character */ | 56 | BYTE TxBaud; /* Transmit baudrate */ |
57 | BYTE TxBaud; /* Transmit baudrate */ | 57 | BYTE RxBaud; /* Receive baudrate */ |
58 | BYTE RxBaud; /* Receive baudrate */ | ||
59 | }; | 58 | }; |
60 | 59 | ||
61 | #endif | 60 | #endif |
diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h index 46f99dfdac8d..fe4e00567065 100644 --- a/drivers/char/rio/parmmap.h +++ b/drivers/char/rio/parmmap.h | |||
@@ -44,53 +44,50 @@ | |||
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | typedef struct PARM_MAP PARM_MAP ; | 47 | typedef struct PARM_MAP PARM_MAP; |
48 | 48 | ||
49 | struct PARM_MAP | 49 | struct PARM_MAP { |
50 | { | 50 | PHB_ptr phb_ptr; /* Pointer to the PHB array */ |
51 | PHB_ptr phb_ptr ; /* Pointer to the PHB array */ | 51 | WORD_ptr phb_num_ptr; /* Ptr to Number of PHB's */ |
52 | WORD_ptr phb_num_ptr ; /* Ptr to Number of PHB's */ | 52 | FREE_LIST_ptr free_list; /* Free List pointer */ |
53 | FREE_LIST_ptr free_list; /* Free List pointer */ | 53 | FREE_LIST_ptr free_list_end; /* Free List End pointer */ |
54 | FREE_LIST_ptr free_list_end; /* Free List End pointer */ | 54 | Q_BUF_ptr_ptr q_free_list_ptr; /* Ptr to Q_BUF variable */ |
55 | Q_BUF_ptr_ptr q_free_list_ptr ; /* Ptr to Q_BUF variable */ | 55 | BYTE_ptr unit_id_ptr; /* Unit Id */ |
56 | BYTE_ptr unit_id_ptr ; /* Unit Id */ | 56 | LPB_ptr link_str_ptr; /* Link Structure Array */ |
57 | LPB_ptr link_str_ptr ; /* Link Structure Array */ | 57 | BYTE_ptr bootloader_1; /* 1st Stage Boot Loader */ |
58 | BYTE_ptr bootloader_1 ; /* 1st Stage Boot Loader */ | 58 | BYTE_ptr bootloader_2; /* 2nd Stage Boot Loader */ |
59 | BYTE_ptr bootloader_2 ; /* 2nd Stage Boot Loader */ | 59 | WORD_ptr port_route_map_ptr; /* Port Route Map */ |
60 | WORD_ptr port_route_map_ptr ; /* Port Route Map */ | 60 | ROUTE_STR_ptr route_ptr; /* Unit Route Map */ |
61 | ROUTE_STR_ptr route_ptr ; /* Unit Route Map */ | 61 | NUMBER_ptr map_present; /* Route Map present */ |
62 | NUMBER_ptr map_present ; /* Route Map present */ | 62 | NUMBER pkt_num; /* Total number of packets */ |
63 | NUMBER pkt_num ; /* Total number of packets */ | 63 | NUMBER q_num; /* Total number of Q packets */ |
64 | NUMBER q_num ; /* Total number of Q packets */ | 64 | WORD buffers_per_port; /* Number of buffers per port */ |
65 | WORD buffers_per_port ; /* Number of buffers per port */ | 65 | WORD heap_size; /* Initial size of heap */ |
66 | WORD heap_size ; /* Initial size of heap */ | 66 | WORD heap_left; /* Current Heap left */ |
67 | WORD heap_left ; /* Current Heap left */ | 67 | WORD error; /* Error code */ |
68 | WORD error ; /* Error code */ | 68 | WORD tx_max; /* Max number of tx pkts per phb */ |
69 | WORD tx_max; /* Max number of tx pkts per phb */ | 69 | WORD rx_max; /* Max number of rx pkts per phb */ |
70 | WORD rx_max; /* Max number of rx pkts per phb */ | 70 | WORD rx_limit; /* For high / low watermarks */ |
71 | WORD rx_limit; /* For high / low watermarks */ | 71 | NUMBER links; /* Links to use */ |
72 | NUMBER links ; /* Links to use */ | 72 | NUMBER timer; /* Interrupts per second */ |
73 | NUMBER timer ; /* Interrupts per second */ | 73 | RUP_ptr rups; /* Pointer to the RUPs */ |
74 | RUP_ptr rups ; /* Pointer to the RUPs */ | 74 | WORD max_phb; /* Mostly for debugging */ |
75 | WORD max_phb ; /* Mostly for debugging */ | 75 | WORD living; /* Just increments!! */ |
76 | WORD living ; /* Just increments!! */ | 76 | WORD init_done; /* Initialisation over */ |
77 | WORD init_done ; /* Initialisation over */ | 77 | WORD booting_link; |
78 | WORD booting_link ; | 78 | WORD idle_count; /* Idle time counter */ |
79 | WORD idle_count ; /* Idle time counter */ | 79 | WORD busy_count; /* Busy counter */ |
80 | WORD busy_count ; /* Busy counter */ | 80 | WORD idle_control; /* Control Idle Process */ |
81 | WORD idle_control ; /* Control Idle Process */ | ||
82 | #if defined(HOST) || defined(INKERNEL) | 81 | #if defined(HOST) || defined(INKERNEL) |
83 | WORD tx_intr; /* TX interrupt pending */ | 82 | WORD tx_intr; /* TX interrupt pending */ |
84 | WORD rx_intr; /* RX interrupt pending */ | 83 | WORD rx_intr; /* RX interrupt pending */ |
85 | WORD rup_intr; /* RUP interrupt pending */ | 84 | WORD rup_intr; /* RUP interrupt pending */ |
86 | #endif | 85 | #endif |
87 | #if defined(RTA) | 86 | #if defined(RTA) |
88 | WORD dying_count; /* Count of processes dead */ | 87 | WORD dying_count; /* Count of processes dead */ |
89 | #endif | 88 | #endif |
90 | } ; | 89 | }; |
91 | 90 | ||
92 | #endif | 91 | #endif |
93 | 92 | ||
94 | /*********** end of file ***********/ | 93 | /*********** end of file ***********/ |
95 | |||
96 | |||
diff --git a/drivers/char/rio/pci.h b/drivers/char/rio/pci.h index dc635bd25194..1eba9118079b 100644 --- a/drivers/char/rio/pci.h +++ b/drivers/char/rio/pci.h | |||
@@ -73,4 +73,4 @@ static char *_pci_h_sccs_ = "@(#)pci.h 1.2"; | |||
73 | 73 | ||
74 | #define RIO_PCI_DEFAULT_MODE 0x05 | 74 | #define RIO_PCI_DEFAULT_MODE 0x05 |
75 | 75 | ||
76 | #endif /* __rio_pci_h__ */ | 76 | #endif /* __rio_pci_h__ */ |
diff --git a/drivers/char/rio/phb.h b/drivers/char/rio/phb.h index e1483a0e30bd..3baebf8513af 100644 --- a/drivers/char/rio/phb.h +++ b/drivers/char/rio/phb.h | |||
@@ -58,37 +58,37 @@ | |||
58 | /************************************************* | 58 | /************************************************* |
59 | * Handshake asserted. Deasserted by the LTT(s) | 59 | * Handshake asserted. Deasserted by the LTT(s) |
60 | ************************************************/ | 60 | ************************************************/ |
61 | #define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */ | 61 | #define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */ |
62 | 62 | ||
63 | #define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */ | 63 | #define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */ |
64 | 64 | ||
65 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET) | 65 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET) |
66 | /* Reset by ltt */ | 66 | /* Reset by ltt */ |
67 | 67 | ||
68 | 68 | ||
69 | /************************************************* | 69 | /************************************************* |
70 | * Maximum number of PHB's | 70 | * Maximum number of PHB's |
71 | ************************************************/ | 71 | ************************************************/ |
72 | #if defined (HOST) || defined (INKERNEL) | 72 | #if defined (HOST) || defined (INKERNEL) |
73 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ | 73 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ |
74 | #else | 74 | #else |
75 | #define MAX_PHB ((ushort) 8) /* range 0-7 */ | 75 | #define MAX_PHB ((ushort) 8) /* range 0-7 */ |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | /************************************************* | 78 | /************************************************* |
79 | * Defines for the mode fields | 79 | * Defines for the mode fields |
80 | ************************************************/ | 80 | ************************************************/ |
81 | #define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */ | 81 | #define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */ |
82 | #define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */ | 82 | #define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */ |
83 | #define TX_TAB3 0x0004 /* TAB3 mode */ | 83 | #define TX_TAB3 0x0004 /* TAB3 mode */ |
84 | #define TX_OCRNL 0x0008 /* OCRNL mode */ | 84 | #define TX_OCRNL 0x0008 /* OCRNL mode */ |
85 | #define TX_ONLCR 0x0010 /* ONLCR mode */ | 85 | #define TX_ONLCR 0x0010 /* ONLCR mode */ |
86 | #define TX_SENDSPACES 0x0020 /* Send n spaces command needs | 86 | #define TX_SENDSPACES 0x0020 /* Send n spaces command needs |
87 | completing */ | 87 | completing */ |
88 | #define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */ | 88 | #define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */ |
89 | #define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */ | 89 | #define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */ |
90 | #define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel | 90 | #define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel |
91 | port */ | 91 | port */ |
92 | #define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL) | 92 | #define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL) |
93 | #define TX_DTRFLOW 0x0200 /* DTR tx flow control */ | 93 | #define TX_DTRFLOW 0x0200 /* DTR tx flow control */ |
94 | #define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data | 94 | #define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data |
@@ -96,34 +96,34 @@ | |||
96 | #define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */ | 96 | #define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */ |
97 | #define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */ | 97 | #define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */ |
98 | 98 | ||
99 | #define RX_SPARE 0x0001 /* SPARE */ | 99 | #define RX_SPARE 0x0001 /* SPARE */ |
100 | #define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */ | 100 | #define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */ |
101 | #define RX_ICRNL 0x0008 /* ICRNL mode */ | 101 | #define RX_ICRNL 0x0008 /* ICRNL mode */ |
102 | #define RX_INLCR 0x0010 /* INLCR mode */ | 102 | #define RX_INLCR 0x0010 /* INLCR mode */ |
103 | #define RX_IGNCR 0x0020 /* IGNCR mode */ | 103 | #define RX_IGNCR 0x0020 /* IGNCR mode */ |
104 | #define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */ | 104 | #define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */ |
105 | #define RX_IXOFF 0x0080 /* IXOFF enabled */ | 105 | #define RX_IXOFF 0x0080 /* IXOFF enabled */ |
106 | #define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */ | 106 | #define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */ |
107 | #define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */ | 107 | #define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */ |
108 | #define RX_BUFFERED 0x0400 /* Try and pass on complete packets */ | 108 | #define RX_BUFFERED 0x0400 /* Try and pass on complete packets */ |
109 | 109 | ||
110 | #define PORT_ISOPEN 0x0001 /* Port open? */ | 110 | #define PORT_ISOPEN 0x0001 /* Port open? */ |
111 | #define PORT_HUPCL 0x0002 /* Hangup on close? */ | 111 | #define PORT_HUPCL 0x0002 /* Hangup on close? */ |
112 | #define PORT_MOPENPEND 0x0004 /* Modem open pending */ | 112 | #define PORT_MOPENPEND 0x0004 /* Modem open pending */ |
113 | #define PORT_ISPARALLEL 0x0008 /* Parallel port */ | 113 | #define PORT_ISPARALLEL 0x0008 /* Parallel port */ |
114 | #define PORT_BREAK 0x0010 /* Port on break */ | 114 | #define PORT_BREAK 0x0010 /* Port on break */ |
115 | #define PORT_STATUSPEND 0x0020 /* Status packet pending */ | 115 | #define PORT_STATUSPEND 0x0020 /* Status packet pending */ |
116 | #define PORT_BREAKPEND 0x0040 /* Break packet pending */ | 116 | #define PORT_BREAKPEND 0x0040 /* Break packet pending */ |
117 | #define PORT_MODEMPEND 0x0080 /* Modem status packet pending */ | 117 | #define PORT_MODEMPEND 0x0080 /* Modem status packet pending */ |
118 | #define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel | 118 | #define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel |
119 | port */ | 119 | port */ |
120 | #define PORT_FULLMODEM 0x0200 /* Full modem signals */ | 120 | #define PORT_FULLMODEM 0x0200 /* Full modem signals */ |
121 | #define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */ | 121 | #define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */ |
122 | #define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */ | 122 | #define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */ |
123 | 123 | ||
124 | #define PORT_MODEMBITS 0x0600 /* Mask for modem fields */ | 124 | #define PORT_MODEMBITS 0x0600 /* Mask for modem fields */ |
125 | 125 | ||
126 | #define PORT_WCLOSE 0x0800 /* Waiting for close */ | 126 | #define PORT_WCLOSE 0x0800 /* Waiting for close */ |
127 | #define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */ | 127 | #define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */ |
128 | #define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */ | 128 | #define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */ |
129 | #define DUMPMODE 0x4000 /* Dump RTA mem */ | 129 | #define DUMPMODE 0x4000 /* Dump RTA mem */ |
@@ -155,139 +155,128 @@ | |||
155 | #define rx_end u4.s1.rx_end_ptr_ptr | 155 | #define rx_end u4.s1.rx_end_ptr_ptr |
156 | #define rx_remove u4.s1.rx_remove_ptr_ptr | 156 | #define rx_remove u4.s1.rx_remove_ptr_ptr |
157 | #endif | 157 | #endif |
158 | typedef struct PHB PHB ; | 158 | typedef struct PHB PHB; |
159 | struct PHB { | 159 | struct PHB { |
160 | #ifdef RTA | 160 | #ifdef RTA |
161 | ushort port; | 161 | ushort port; |
162 | #endif | 162 | #endif |
163 | #ifdef INKERNEL | 163 | #ifdef INKERNEL |
164 | WORD source; | 164 | WORD source; |
165 | #else | 165 | #else |
166 | union | 166 | union { |
167 | { | 167 | ushort source; /* Complete source */ |
168 | ushort source; /* Complete source */ | 168 | struct { |
169 | struct | 169 | unsigned char unit; /* Source unit */ |
170 | { | 170 | unsigned char port; /* Source port */ |
171 | unsigned char unit; /* Source unit */ | 171 | } s2; |
172 | unsigned char port; /* Source port */ | 172 | } u2; |
173 | } s2; | ||
174 | } u2; | ||
175 | #endif | 173 | #endif |
176 | WORD handshake ; | 174 | WORD handshake; |
177 | WORD status ; | 175 | WORD status; |
178 | NUMBER timeout ; /* Maximum of 1.9 seconds */ | 176 | NUMBER timeout; /* Maximum of 1.9 seconds */ |
179 | WORD link ; /* Send down this link */ | 177 | WORD link; /* Send down this link */ |
180 | #ifdef INKERNEL | 178 | #ifdef INKERNEL |
181 | WORD destination; | 179 | WORD destination; |
182 | #else | 180 | #else |
183 | union | 181 | union { |
184 | { | 182 | ushort destination; /* Complete destination */ |
185 | ushort destination; /* Complete destination */ | 183 | struct { |
186 | struct | 184 | unsigned char unit; /* Destination unit */ |
187 | { | 185 | unsigned char port; /* Destination port */ |
188 | unsigned char unit; /* Destination unit */ | 186 | } s1; |
189 | unsigned char port; /* Destination port */ | 187 | } u1; |
190 | } s1; | ||
191 | } u1; | ||
192 | #endif | 188 | #endif |
193 | #ifdef RTA | 189 | #ifdef RTA |
194 | ushort tx_pkts_added; | 190 | ushort tx_pkts_added; |
195 | ushort tx_pkts_removed; | 191 | ushort tx_pkts_removed; |
196 | Q_BUF_ptr tx_q_start ; /* Start of the Q list chain */ | 192 | Q_BUF_ptr tx_q_start; /* Start of the Q list chain */ |
197 | short num_tx_q_bufs ; /* Number of Q buffers in the chain */ | 193 | short num_tx_q_bufs; /* Number of Q buffers in the chain */ |
198 | PKT_ptr_ptr tx_add ; /* Add a new Packet here */ | 194 | PKT_ptr_ptr tx_add; /* Add a new Packet here */ |
199 | Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */ | 195 | Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */ |
200 | PKT_ptr_ptr tx_add_st_qbb ; /* Pointer to start of the Q's buf */ | 196 | PKT_ptr_ptr tx_add_st_qbb; /* Pointer to start of the Q's buf */ |
201 | PKT_ptr_ptr tx_add_end_qbb ; /* Pointer to the end of the Q's buf */ | 197 | PKT_ptr_ptr tx_add_end_qbb; /* Pointer to the end of the Q's buf */ |
202 | PKT_ptr_ptr tx_remove ; /* Remove a Packet here */ | 198 | PKT_ptr_ptr tx_remove; /* Remove a Packet here */ |
203 | Q_BUF_ptr tx_remove_qb ; /* Pointer to the remove Q buf */ | 199 | Q_BUF_ptr tx_remove_qb; /* Pointer to the remove Q buf */ |
204 | PKT_ptr_ptr tx_remove_st_qbb ; /* Pointer to the start of the Q buf */ | 200 | PKT_ptr_ptr tx_remove_st_qbb; /* Pointer to the start of the Q buf */ |
205 | PKT_ptr_ptr tx_remove_end_qbb ; /* Pointer to the end of the Q buf */ | 201 | PKT_ptr_ptr tx_remove_end_qbb; /* Pointer to the end of the Q buf */ |
206 | #endif | 202 | #endif |
207 | #ifdef INKERNEL | 203 | #ifdef INKERNEL |
208 | PKT_ptr_ptr tx_start ; | 204 | PKT_ptr_ptr tx_start; |
209 | PKT_ptr_ptr tx_end ; | 205 | PKT_ptr_ptr tx_end; |
210 | PKT_ptr_ptr tx_add ; | 206 | PKT_ptr_ptr tx_add; |
211 | PKT_ptr_ptr tx_remove ; | 207 | PKT_ptr_ptr tx_remove; |
212 | #endif | 208 | #endif |
213 | #ifdef HOST | 209 | #ifdef HOST |
214 | union | 210 | union { |
215 | { | 211 | struct { |
216 | struct | 212 | PKT_ptr_ptr tx_start_ptr_ptr; |
217 | { | 213 | PKT_ptr_ptr tx_end_ptr_ptr; |
218 | PKT_ptr_ptr tx_start_ptr_ptr; | 214 | PKT_ptr_ptr tx_add_ptr_ptr; |
219 | PKT_ptr_ptr tx_end_ptr_ptr; | 215 | PKT_ptr_ptr tx_remove_ptr_ptr; |
220 | PKT_ptr_ptr tx_add_ptr_ptr; | 216 | } s1; |
221 | PKT_ptr_ptr tx_remove_ptr_ptr; | 217 | struct { |
222 | } s1; | 218 | ushort *tx_start_ptr; |
223 | struct | 219 | ushort *tx_end_ptr; |
224 | { | 220 | ushort *tx_add_ptr; |
225 | ushort * tx_start_ptr; | 221 | ushort *tx_remove_ptr; |
226 | ushort * tx_end_ptr; | 222 | } s2; |
227 | ushort * tx_add_ptr; | 223 | } u3; |
228 | ushort * tx_remove_ptr; | ||
229 | } s2; | ||
230 | } u3; | ||
231 | #endif | 224 | #endif |
232 | 225 | ||
233 | #ifdef RTA | 226 | #ifdef RTA |
234 | ushort rx_pkts_added; | 227 | ushort rx_pkts_added; |
235 | ushort rx_pkts_removed; | 228 | ushort rx_pkts_removed; |
236 | Q_BUF_ptr rx_q_start ; /* Start of the Q list chain */ | 229 | Q_BUF_ptr rx_q_start; /* Start of the Q list chain */ |
237 | short num_rx_q_bufs ; /* Number of Q buffers in the chain */ | 230 | short num_rx_q_bufs; /* Number of Q buffers in the chain */ |
238 | PKT_ptr_ptr rx_add ; /* Add a new Packet here */ | 231 | PKT_ptr_ptr rx_add; /* Add a new Packet here */ |
239 | Q_BUF_ptr rx_add_qb ; /* Pointer to the add Q buf */ | 232 | Q_BUF_ptr rx_add_qb; /* Pointer to the add Q buf */ |
240 | PKT_ptr_ptr rx_add_st_qbb ; /* Pointer to start of the Q's buf */ | 233 | PKT_ptr_ptr rx_add_st_qbb; /* Pointer to start of the Q's buf */ |
241 | PKT_ptr_ptr rx_add_end_qbb ; /* Pointer to the end of the Q's buf */ | 234 | PKT_ptr_ptr rx_add_end_qbb; /* Pointer to the end of the Q's buf */ |
242 | PKT_ptr_ptr rx_remove ; /* Remove a Packet here */ | 235 | PKT_ptr_ptr rx_remove; /* Remove a Packet here */ |
243 | Q_BUF_ptr rx_remove_qb ; /* Pointer to the remove Q buf */ | 236 | Q_BUF_ptr rx_remove_qb; /* Pointer to the remove Q buf */ |
244 | PKT_ptr_ptr rx_remove_st_qbb ; /* Pointer to the start of the Q buf */ | 237 | PKT_ptr_ptr rx_remove_st_qbb; /* Pointer to the start of the Q buf */ |
245 | PKT_ptr_ptr rx_remove_end_qbb ; /* Pointer to the end of the Q buf */ | 238 | PKT_ptr_ptr rx_remove_end_qbb; /* Pointer to the end of the Q buf */ |
246 | #endif | 239 | #endif |
247 | #ifdef INKERNEL | 240 | #ifdef INKERNEL |
248 | PKT_ptr_ptr rx_start ; | 241 | PKT_ptr_ptr rx_start; |
249 | PKT_ptr_ptr rx_end ; | 242 | PKT_ptr_ptr rx_end; |
250 | PKT_ptr_ptr rx_add ; | 243 | PKT_ptr_ptr rx_add; |
251 | PKT_ptr_ptr rx_remove ; | 244 | PKT_ptr_ptr rx_remove; |
252 | #endif | 245 | #endif |
253 | #ifdef HOST | 246 | #ifdef HOST |
254 | union | 247 | union { |
255 | { | 248 | struct { |
256 | struct | 249 | PKT_ptr_ptr rx_start_ptr_ptr; |
257 | { | 250 | PKT_ptr_ptr rx_end_ptr_ptr; |
258 | PKT_ptr_ptr rx_start_ptr_ptr; | 251 | PKT_ptr_ptr rx_add_ptr_ptr; |
259 | PKT_ptr_ptr rx_end_ptr_ptr; | 252 | PKT_ptr_ptr rx_remove_ptr_ptr; |
260 | PKT_ptr_ptr rx_add_ptr_ptr; | 253 | } s1; |
261 | PKT_ptr_ptr rx_remove_ptr_ptr; | 254 | struct { |
262 | } s1; | 255 | ushort *rx_start_ptr; |
263 | struct | 256 | ushort *rx_end_ptr; |
264 | { | 257 | ushort *rx_add_ptr; |
265 | ushort * rx_start_ptr; | 258 | ushort *rx_remove_ptr; |
266 | ushort * rx_end_ptr; | 259 | } s2; |
267 | ushort * rx_add_ptr; | 260 | } u4; |
268 | ushort * rx_remove_ptr; | ||
269 | } s2; | ||
270 | } u4; | ||
271 | #endif | 261 | #endif |
272 | 262 | ||
273 | #ifdef RTA /* some fields for the remotes */ | 263 | #ifdef RTA /* some fields for the remotes */ |
274 | ushort flush_count; /* Count of write flushes */ | 264 | ushort flush_count; /* Count of write flushes */ |
275 | ushort txmode; /* Modes for tx */ | 265 | ushort txmode; /* Modes for tx */ |
276 | ushort rxmode; /* Modes for rx */ | 266 | ushort rxmode; /* Modes for rx */ |
277 | ushort portmode; /* Generic modes */ | 267 | ushort portmode; /* Generic modes */ |
278 | ushort column; /* TAB3 column count */ | 268 | ushort column; /* TAB3 column count */ |
279 | ushort tx_subscript; /* (TX) Subscript into data field */ | 269 | ushort tx_subscript; /* (TX) Subscript into data field */ |
280 | ushort rx_subscript; /* (RX) Subscript into data field */ | 270 | ushort rx_subscript; /* (RX) Subscript into data field */ |
281 | PKT_ptr rx_incomplete; /* Hold an incomplete packet here */ | 271 | PKT_ptr rx_incomplete; /* Hold an incomplete packet here */ |
282 | ushort modem_bits; /* Modem bits to mask */ | 272 | ushort modem_bits; /* Modem bits to mask */ |
283 | ushort lastModem; /* Modem control lines. */ | 273 | ushort lastModem; /* Modem control lines. */ |
284 | ushort addr; /* Address for sub commands */ | 274 | ushort addr; /* Address for sub commands */ |
285 | ushort MonitorTstate; /* TRUE if monitoring tstop */ | 275 | ushort MonitorTstate; /* TRUE if monitoring tstop */ |
286 | #endif | 276 | #endif |
287 | 277 | ||
288 | } ; | 278 | }; |
289 | 279 | ||
290 | #endif | 280 | #endif |
291 | 281 | ||
292 | /*********** end of file ***********/ | 282 | /*********** end of file ***********/ |
293 | |||
diff --git a/drivers/char/rio/pkt.h b/drivers/char/rio/pkt.h index 66bb2ff0f694..882fd429ac2e 100644 --- a/drivers/char/rio/pkt.h +++ b/drivers/char/rio/pkt.h | |||
@@ -69,52 +69,44 @@ | |||
69 | #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8) | 69 | #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8) |
70 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) | 70 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) |
71 | 71 | ||
72 | struct PKT { | 72 | struct PKT { |
73 | #ifdef INKERNEL | 73 | #ifdef INKERNEL |
74 | BYTE dest_unit ; /* Destination Unit Id */ | 74 | BYTE dest_unit; /* Destination Unit Id */ |
75 | BYTE dest_port ; /* Destination POrt */ | 75 | BYTE dest_port; /* Destination POrt */ |
76 | BYTE src_unit ; /* Source Unit Id */ | 76 | BYTE src_unit; /* Source Unit Id */ |
77 | BYTE src_port ; /* Source POrt */ | 77 | BYTE src_port; /* Source POrt */ |
78 | #else | 78 | #else |
79 | union | 79 | union { |
80 | { | 80 | ushort destination; /* Complete destination */ |
81 | ushort destination; /* Complete destination */ | 81 | struct { |
82 | struct | 82 | unsigned char unit; /* Destination unit */ |
83 | { | 83 | unsigned char port; /* Destination port */ |
84 | unsigned char unit; /* Destination unit */ | 84 | } s1; |
85 | unsigned char port; /* Destination port */ | 85 | } u1; |
86 | } s1; | 86 | union { |
87 | } u1; | 87 | ushort source; /* Complete source */ |
88 | union | 88 | struct { |
89 | { | 89 | unsigned char unit; /* Source unit */ |
90 | ushort source; /* Complete source */ | 90 | unsigned char port; /* Source port */ |
91 | struct | 91 | } s2; |
92 | { | 92 | } u2; |
93 | unsigned char unit; /* Source unit */ | ||
94 | unsigned char port; /* Source port */ | ||
95 | } s2; | ||
96 | } u2; | ||
97 | #endif | 93 | #endif |
98 | #ifdef INKERNEL | 94 | #ifdef INKERNEL |
99 | BYTE len ; | 95 | BYTE len; |
100 | BYTE control; | 96 | BYTE control; |
101 | #else | 97 | #else |
102 | union | 98 | union { |
103 | { | 99 | ushort control; |
104 | ushort control; | 100 | struct { |
105 | struct | 101 | unsigned char len; |
106 | { | 102 | unsigned char control; |
107 | unsigned char len; | 103 | } s3; |
108 | unsigned char control; | 104 | } u3; |
109 | } s3; | ||
110 | } u3; | ||
111 | #endif | 105 | #endif |
112 | BYTE data[PKT_MAX_DATA_LEN] ; | 106 | BYTE data[PKT_MAX_DATA_LEN]; |
113 | /* Actual data :-) */ | 107 | /* Actual data :-) */ |
114 | WORD csum ; /* C-SUM */ | 108 | WORD csum; /* C-SUM */ |
115 | } ; | 109 | }; |
116 | #endif | 110 | #endif |
117 | 111 | ||
118 | /*********** end of file ***********/ | 112 | /*********** end of file ***********/ |
119 | |||
120 | |||
diff --git a/drivers/char/rio/poll.h b/drivers/char/rio/poll.h index d9b8e983e175..9616ee4c6cd5 100644 --- a/drivers/char/rio/poll.h +++ b/drivers/char/rio/poll.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS_LABELS | 41 | #ifdef SCCS_LABELS |
42 | static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ; | 42 | static char *_rio_poll_h_sccs = "@(#)poll.h 1.2"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
@@ -54,23 +54,20 @@ static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ; | |||
54 | #define POLL_PERIOD (int) SECOND | 54 | #define POLL_PERIOD (int) SECOND |
55 | 55 | ||
56 | /* The various poll commands */ | 56 | /* The various poll commands */ |
57 | #define POLL_POLL 0 /* We are connected and happy.. */ | 57 | #define POLL_POLL 0 /* We are connected and happy.. */ |
58 | #define POLL_INTRO 1 /* Introduction packet */ | 58 | #define POLL_INTRO 1 /* Introduction packet */ |
59 | #define POLL_TOPOLOGY 2 /* Topology update */ | 59 | #define POLL_TOPOLOGY 2 /* Topology update */ |
60 | #define POLL_ASSIGN 3 /* ID assign */ | 60 | #define POLL_ASSIGN 3 /* ID assign */ |
61 | #define POLL_FOAD 4 /* F*** Off And Die */ | 61 | #define POLL_FOAD 4 /* F*** Off And Die */ |
62 | #define POLL_LMD 5 /* Let Me Die */ | 62 | #define POLL_LMD 5 /* Let Me Die */ |
63 | #define POLL_DYB 6 /* Die You Ba***** */ | 63 | #define POLL_DYB 6 /* Die You Ba***** */ |
64 | 64 | ||
65 | /* The way data fields are split up for POLL packets */ | 65 | /* The way data fields are split up for POLL packets */ |
66 | #define POLL_HOST_SERIAL 2 /* Host who booted me */ | 66 | #define POLL_HOST_SERIAL 2 /* Host who booted me */ |
67 | #define POLL_MY_SERIAL 6 /* My serial number */ | 67 | #define POLL_MY_SERIAL 6 /* My serial number */ |
68 | #define POLL_YOUR_ID 1 /* Your ID number */ | 68 | #define POLL_YOUR_ID 1 /* Your ID number */ |
69 | #define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */ | 69 | #define POLL_TOPOLOGY_FIELDS 2 /* Topology maps */ |
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | /*********** end of file ***********/ | 73 | /*********** end of file ***********/ |
74 | |||
75 | |||
76 | |||
diff --git a/drivers/char/rio/port.h b/drivers/char/rio/port.h index 8506af06aa9f..c99b1e70fdc8 100644 --- a/drivers/char/rio/port.h +++ b/drivers/char/rio/port.h | |||
@@ -46,96 +46,94 @@ static char *_port_h_sccs_ = "@(#)port.h 1.3"; | |||
46 | */ | 46 | */ |
47 | 47 | ||
48 | #ifdef STATS | 48 | #ifdef STATS |
49 | struct RIOStats | 49 | struct RIOStats { |
50 | { | ||
51 | /* | 50 | /* |
52 | ** interrupt statistics | 51 | ** interrupt statistics |
53 | */ | 52 | */ |
54 | uint BreakIntCnt; | 53 | uint BreakIntCnt; |
55 | uint ModemOffCnt; | 54 | uint ModemOffCnt; |
56 | uint ModemOnCnt; | 55 | uint ModemOnCnt; |
57 | uint RxIntCnt; | 56 | uint RxIntCnt; |
58 | uint TxIntCnt; | 57 | uint TxIntCnt; |
59 | /* | 58 | /* |
60 | ** throughput statistics | 59 | ** throughput statistics |
61 | */ | 60 | */ |
62 | uint RxCharCnt; | 61 | uint RxCharCnt; |
63 | uint RxPktCnt; | 62 | uint RxPktCnt; |
64 | uint RxSaveCnt; | 63 | uint RxSaveCnt; |
65 | uint TxCharCnt; | 64 | uint TxCharCnt; |
66 | uint TxPktCnt; | 65 | uint TxPktCnt; |
67 | /* | 66 | /* |
68 | ** driver entry statistics | 67 | ** driver entry statistics |
69 | */ | 68 | */ |
70 | uint CloseCnt; | 69 | uint CloseCnt; |
71 | uint IoctlCnt; | 70 | uint IoctlCnt; |
72 | uint OpenCnt; | 71 | uint OpenCnt; |
73 | uint ReadCnt; | 72 | uint ReadCnt; |
74 | uint WriteCnt; | 73 | uint WriteCnt; |
75 | /* | 74 | /* |
76 | ** proc statistics | 75 | ** proc statistics |
77 | */ | 76 | */ |
78 | uint BlockCnt; | 77 | uint BlockCnt; |
79 | uint OutputCnt; | 78 | uint OutputCnt; |
80 | uint ResumeCnt; | 79 | uint ResumeCnt; |
81 | uint RflushCnt; | 80 | uint RflushCnt; |
82 | uint SuspendCnt; | 81 | uint SuspendCnt; |
83 | uint TbreakCnt; | 82 | uint TbreakCnt; |
84 | uint TimeoutCnt; | 83 | uint TimeoutCnt; |
85 | uint UnblockCnt; | 84 | uint UnblockCnt; |
86 | uint WflushCnt; | 85 | uint WflushCnt; |
87 | uint WFBodgeCnt; | 86 | uint WFBodgeCnt; |
88 | }; | 87 | }; |
89 | #endif | 88 | #endif |
90 | 89 | ||
91 | /* | 90 | /* |
92 | ** Port data structure | 91 | ** Port data structure |
93 | */ | 92 | */ |
94 | struct Port | 93 | struct Port { |
95 | { | 94 | struct gs_port gs; |
96 | struct gs_port gs; | 95 | int PortNum; /* RIO port no., 0-511 */ |
97 | int PortNum; /* RIO port no., 0-511 */ | 96 | struct Host *HostP; |
98 | struct Host *HostP; | 97 | volatile caddr_t Caddr; |
99 | volatile caddr_t Caddr; | 98 | ushort HostPort; /* Port number on host card */ |
100 | ushort HostPort; /* Port number on host card */ | 99 | uchar RupNum; /* Number of RUP for port */ |
101 | uchar RupNum; /* Number of RUP for port */ | 100 | uchar ID2; /* Second ID of RTA for port */ |
102 | uchar ID2; /* Second ID of RTA for port */ | 101 | ulong State; /* FLAGS for open & xopen */ |
103 | ulong State; /* FLAGS for open & xopen */ | 102 | #define RIO_LOPEN 0x00001 /* Local open */ |
104 | #define RIO_LOPEN 0x00001 /* Local open */ | 103 | #define RIO_MOPEN 0x00002 /* Modem open */ |
105 | #define RIO_MOPEN 0x00002 /* Modem open */ | 104 | #define RIO_WOPEN 0x00004 /* Waiting for open */ |
106 | #define RIO_WOPEN 0x00004 /* Waiting for open */ | 105 | #define RIO_CLOSING 0x00008 /* The port is being close */ |
107 | #define RIO_CLOSING 0x00008 /* The port is being close */ | 106 | #define RIO_XPBUSY 0x00010 /* Transparent printer busy */ |
108 | #define RIO_XPBUSY 0x00010 /* Transparent printer busy */ | 107 | #define RIO_BREAKING 0x00020 /* Break in progress */ |
109 | #define RIO_BREAKING 0x00020 /* Break in progress */ | 108 | #define RIO_DIRECT 0x00040 /* Doing Direct output */ |
110 | #define RIO_DIRECT 0x00040 /* Doing Direct output */ | 109 | #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ |
111 | #define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ | 110 | #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ |
112 | #define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ | 111 | #define RIO_CARR_ON 0x00200 /* Stream has carrier present */ |
113 | #define RIO_CARR_ON 0x00200 /* Stream has carrier present */ | 112 | #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ |
114 | #define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ | 113 | #define RIO_RBLK 0x00800 /* Stream is read-blocked */ |
115 | #define RIO_RBLK 0x00800 /* Stream is read-blocked */ | 114 | #define RIO_BUSY 0x01000 /* Stream is BUSY for write */ |
116 | #define RIO_BUSY 0x01000 /* Stream is BUSY for write */ | 115 | #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ |
117 | #define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ | 116 | #define RIO_TXSTOP 0x04000 /* Stream output is stopped */ |
118 | #define RIO_TXSTOP 0x04000 /* Stream output is stopped */ | 117 | #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ |
119 | #define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ | 118 | #define RIO_DYNOROD 0x10000 /* Drain failed */ |
120 | #define RIO_DYNOROD 0x10000 /* Drain failed */ | 119 | #define RIO_DELETED 0x20000 /* RTA has been deleted */ |
121 | #define RIO_DELETED 0x20000 /* RTA has been deleted */ | 120 | #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ |
122 | #define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ | ||
123 | #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */ | 121 | #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */ |
124 | #define RIO_CAN_COOK 0x200000 /* This line can do cooking */ | 122 | #define RIO_CAN_COOK 0x200000 /* This line can do cooking */ |
125 | #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */ | 123 | #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */ |
126 | #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */ | 124 | #define RIO_TRIAD_BLOCK 0x800000 /* Next read will block */ |
127 | #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */ | 125 | #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */ |
128 | #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */ | 126 | #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */ |
129 | 127 | ||
130 | ulong Config; /* FLAGS for NOREAD.... */ | 128 | ulong Config; /* FLAGS for NOREAD.... */ |
131 | #define RIO_NOREAD 0x0001 /* Are not allowed to read port */ | 129 | #define RIO_NOREAD 0x0001 /* Are not allowed to read port */ |
132 | #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ | 130 | #define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ |
133 | #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ | 131 | #define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ |
134 | #define RIO_NOMASK 0x0007 /* All not allowed things */ | 132 | #define RIO_NOMASK 0x0007 /* All not allowed things */ |
135 | #define RIO_IXANY 0x0008 /* Port is allowed ixany */ | 133 | #define RIO_IXANY 0x0008 /* Port is allowed ixany */ |
136 | #define RIO_MODEM 0x0010 /* Stream is a modem device */ | 134 | #define RIO_MODEM 0x0010 /* Stream is a modem device */ |
137 | #define RIO_IXON 0x0020 /* Port is allowed ixon */ | 135 | #define RIO_IXON 0x0020 /* Port is allowed ixon */ |
138 | #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ | 136 | #define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ |
139 | #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */ | 137 | #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */ |
140 | #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */ | 138 | #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */ |
141 | 139 | ||
@@ -144,92 +142,90 @@ struct Port | |||
144 | ** As LynxOS does not appear to support Hardware Flow Control ..... | 142 | ** As LynxOS does not appear to support Hardware Flow Control ..... |
145 | ** Define our own flow control flags in 'Config'. | 143 | ** Define our own flow control flags in 'Config'. |
146 | */ | 144 | */ |
147 | #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ | 145 | #define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ |
148 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ | 146 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ |
149 | 147 | ||
150 | 148 | ||
151 | struct PHB *PhbP; /* pointer to PHB for port */ | 149 | struct PHB *PhbP; /* pointer to PHB for port */ |
152 | WORD *TxAdd; /* Add packets here */ | 150 | WORD *TxAdd; /* Add packets here */ |
153 | WORD *TxStart; /* Start of add array */ | 151 | WORD *TxStart; /* Start of add array */ |
154 | WORD *TxEnd; /* End of add array */ | 152 | WORD *TxEnd; /* End of add array */ |
155 | WORD *RxRemove; /* Remove packets here */ | 153 | WORD *RxRemove; /* Remove packets here */ |
156 | WORD *RxStart; /* Start of remove array */ | 154 | WORD *RxStart; /* Start of remove array */ |
157 | WORD *RxEnd; /* End of remove array */ | 155 | WORD *RxEnd; /* End of remove array */ |
158 | uint RtaUniqueNum; /* Unique number of RTA */ | 156 | uint RtaUniqueNum; /* Unique number of RTA */ |
159 | ushort PortState; /* status of port */ | 157 | ushort PortState; /* status of port */ |
160 | ushort ModemState; /* status of modem lines */ | 158 | ushort ModemState; /* status of modem lines */ |
161 | ulong ModemLines; /* Modem bits sent to RTA */ | 159 | ulong ModemLines; /* Modem bits sent to RTA */ |
162 | uchar CookMode; /* who expands CR/LF? */ | 160 | uchar CookMode; /* who expands CR/LF? */ |
163 | uchar ParamSem; /* Prevent write during param */ | 161 | uchar ParamSem; /* Prevent write during param */ |
164 | uchar Mapped; /* if port mapped onto host */ | 162 | uchar Mapped; /* if port mapped onto host */ |
165 | uchar SecondBlock; /* if port belongs to 2nd block | 163 | uchar SecondBlock; /* if port belongs to 2nd block |
166 | of 16 port RTA */ | 164 | of 16 port RTA */ |
167 | uchar InUse; /* how many pre-emptive cmds */ | 165 | uchar InUse; /* how many pre-emptive cmds */ |
168 | uchar Lock; /* if params locked */ | 166 | uchar Lock; /* if params locked */ |
169 | uchar Store; /* if params stored across closes */ | 167 | uchar Store; /* if params stored across closes */ |
170 | uchar FirstOpen; /* TRUE if first time port opened */ | 168 | uchar FirstOpen; /* TRUE if first time port opened */ |
171 | uchar FlushCmdBodge; /* if doing a (non)flush */ | 169 | uchar FlushCmdBodge; /* if doing a (non)flush */ |
172 | uchar MagicFlags; /* require intr processing */ | 170 | uchar MagicFlags; /* require intr processing */ |
173 | #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ | 171 | #define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ |
174 | #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ | 172 | #define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ |
175 | #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ | 173 | #define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ |
176 | uchar WflushFlag; /* 1 How many WFLUSHs active */ | 174 | uchar WflushFlag; /* 1 How many WFLUSHs active */ |
177 | /* | 175 | /* |
178 | ** Transparent print stuff | 176 | ** Transparent print stuff |
179 | */ | 177 | */ |
180 | struct Xprint | 178 | struct Xprint { |
181 | { | ||
182 | #ifndef MAX_XP_CTRL_LEN | 179 | #ifndef MAX_XP_CTRL_LEN |
183 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ | 180 | #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ |
184 | #endif | 181 | #endif |
185 | uint XpCps; | 182 | uint XpCps; |
186 | char XpOn[MAX_XP_CTRL_LEN]; | 183 | char XpOn[MAX_XP_CTRL_LEN]; |
187 | char XpOff[MAX_XP_CTRL_LEN]; | 184 | char XpOff[MAX_XP_CTRL_LEN]; |
188 | ushort XpLen; /* strlen(XpOn)+strlen(XpOff) */ | 185 | ushort XpLen; /* strlen(XpOn)+strlen(XpOff) */ |
189 | uchar XpActive; | 186 | uchar XpActive; |
190 | uchar XpLastTickOk; /* TRUE if we can process */ | 187 | uchar XpLastTickOk; /* TRUE if we can process */ |
191 | #define XP_OPEN 00001 | 188 | #define XP_OPEN 00001 |
192 | #define XP_RUNABLE 00002 | 189 | #define XP_RUNABLE 00002 |
193 | struct ttystatics *XttyP; | 190 | struct ttystatics *XttyP; |
194 | } Xprint; | 191 | } Xprint; |
195 | #ifdef VPIX | 192 | #ifdef VPIX |
196 | v86_t *StashP; | 193 | v86_t *StashP; |
197 | uint IntMask; | 194 | uint IntMask; |
198 | struct termss VpixSs; | 195 | struct termss VpixSs; |
199 | uchar ModemStatusReg; /* Modem status register */ | 196 | uchar ModemStatusReg; /* Modem status register */ |
200 | #endif | 197 | #endif |
201 | uchar RxDataStart; | 198 | uchar RxDataStart; |
202 | uchar Cor2Copy; /* copy of COR2 */ | 199 | uchar Cor2Copy; /* copy of COR2 */ |
203 | char *Name; /* points to the Rta's name */ | 200 | char *Name; /* points to the Rta's name */ |
204 | #ifdef STATS | 201 | #ifdef STATS |
205 | struct RIOStats Stat; /* ports statistics */ | 202 | struct RIOStats Stat; /* ports statistics */ |
206 | #endif | 203 | #endif |
207 | char *TxRingBuffer; | 204 | char *TxRingBuffer; |
208 | ushort TxBufferIn; /* New data arrives here */ | 205 | ushort TxBufferIn; /* New data arrives here */ |
209 | ushort TxBufferOut; /* Intr removes data here */ | 206 | ushort TxBufferOut; /* Intr removes data here */ |
210 | ushort OldTxBufferOut; /* Indicates if draining */ | 207 | ushort OldTxBufferOut; /* Indicates if draining */ |
211 | int TimeoutId; /* Timeout ID */ | 208 | int TimeoutId; /* Timeout ID */ |
212 | uint Debug; | 209 | uint Debug; |
213 | uchar WaitUntilBooted; /* True if open should block */ | 210 | uchar WaitUntilBooted; /* True if open should block */ |
214 | uint statsGather; /* True if gathering stats */ | 211 | uint statsGather; /* True if gathering stats */ |
215 | ulong txchars; /* Chars transmitted */ | 212 | ulong txchars; /* Chars transmitted */ |
216 | ulong rxchars; /* Chars received */ | 213 | ulong rxchars; /* Chars received */ |
217 | ulong opens; /* port open count */ | 214 | ulong opens; /* port open count */ |
218 | ulong closes; /* port close count */ | 215 | ulong closes; /* port close count */ |
219 | ulong ioctls; /* ioctl count */ | 216 | ulong ioctls; /* ioctl count */ |
220 | uchar LastRxTgl; /* Last state of rx toggle bit */ | 217 | uchar LastRxTgl; /* Last state of rx toggle bit */ |
221 | spinlock_t portSem; /* Lock using this sem */ | 218 | spinlock_t portSem; /* Lock using this sem */ |
222 | int MonitorTstate; /* Monitoring ? */ | 219 | int MonitorTstate; /* Monitoring ? */ |
223 | int timeout_id; /* For calling 100 ms delays */ | 220 | int timeout_id; /* For calling 100 ms delays */ |
224 | int timeout_sem;/* For calling 100 ms delays */ | 221 | int timeout_sem; /* For calling 100 ms delays */ |
225 | int firstOpen; /* First time open ? */ | 222 | int firstOpen; /* First time open ? */ |
226 | char * p; /* save the global struc here .. */ | 223 | char *p; /* save the global struc here .. */ |
227 | }; | 224 | }; |
228 | 225 | ||
229 | struct ModuleInfo | 226 | struct ModuleInfo { |
230 | { | 227 | char *Name; |
231 | char *Name; | 228 | uint Flags[4]; /* one per port on a module */ |
232 | uint Flags[4]; /* one per port on a module */ | ||
233 | }; | 229 | }; |
234 | #endif | 230 | #endif |
235 | 231 | ||
@@ -238,8 +234,8 @@ struct ModuleInfo | |||
238 | ** runs into problems with differing struct sizes between driver and config. | 234 | ** runs into problems with differing struct sizes between driver and config. |
239 | */ | 235 | */ |
240 | struct PortParams { | 236 | struct PortParams { |
241 | uint Port; | 237 | uint Port; |
242 | ulong Config; | 238 | ulong Config; |
243 | ulong State; | 239 | ulong State; |
244 | struct ttystatics *TtyP; | 240 | struct ttystatics *TtyP; |
245 | }; | 241 | }; |
diff --git a/drivers/char/rio/proto.h b/drivers/char/rio/proto.h index ddff0ef84e3a..f9a3376333e5 100644 --- a/drivers/char/rio/proto.h +++ b/drivers/char/rio/proto.h | |||
@@ -23,15 +23,15 @@ | |||
23 | /* | 23 | /* |
24 | ** boot.c | 24 | ** boot.c |
25 | */ | 25 | */ |
26 | void init_boot( char *p, short stage); | 26 | void init_boot(char *p, short stage); |
27 | 27 | ||
28 | /* | 28 | /* |
29 | ** disconct.c | 29 | ** disconct.c |
30 | */ | 30 | */ |
31 | void kill_boot ( LPB *link ); | 31 | void kill_boot(LPB * link); |
32 | void disconnected( LPB *link ); | 32 | void disconnected(LPB * link); |
33 | short boot_3( LPB *link, PKT *pkt ); | 33 | short boot_3(LPB * link, PKT * pkt); |
34 | short send_3_pkt( LPB *link, PKT *pkt); | 34 | short send_3_pkt(LPB * link, PKT * pkt); |
35 | 35 | ||
36 | /* | 36 | /* |
37 | ** error.c | 37 | ** error.c |
@@ -41,116 +41,116 @@ void du_error(void); | |||
41 | /* | 41 | /* |
42 | ** formpkt.c | 42 | ** formpkt.c |
43 | */ | 43 | */ |
44 | ushort sum_it( PKT *pkt ) ; | 44 | ushort sum_it(PKT * pkt); |
45 | void form_rup_pkt( RUP *form_rup, PKT *pkt ); | 45 | void form_rup_pkt(RUP * form_rup, PKT * pkt); |
46 | void form_poll_pkt ( int type, LPB *link, int node ); | 46 | void form_poll_pkt(int type, LPB * link, int node); |
47 | void form_route_pkt ( int type, PKT *pkt, LPB *link ); | 47 | void form_route_pkt(int type, PKT * pkt, LPB * link); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | ** idle.c | 50 | ** idle.c |
51 | */ | 51 | */ |
52 | void idle( Process *idle_p ); | 52 | void idle(Process * idle_p); |
53 | 53 | ||
54 | /* | 54 | /* |
55 | ** init.c | 55 | ** init.c |
56 | */ | 56 | */ |
57 | void general_init(void); | 57 | void general_init(void); |
58 | void mem_halt( int error); | 58 | void mem_halt(int error); |
59 | 59 | ||
60 | /* | 60 | /* |
61 | ** linkinit.c | 61 | ** linkinit.c |
62 | */ | 62 | */ |
63 | void initlink( u_short number, LPB *link); | 63 | void initlink(u_short number, LPB * link); |
64 | void runlink( LPB *link); | 64 | void runlink(LPB * link); |
65 | 65 | ||
66 | /* | 66 | /* |
67 | ** list.c | 67 | ** list.c |
68 | */ | 68 | */ |
69 | PKT *get_free_start(void); | 69 | PKT *get_free_start(void); |
70 | void put_free_start( PKT *pkt); | 70 | void put_free_start(PKT * pkt); |
71 | 71 | ||
72 | #ifdef HOST | 72 | #ifdef HOST |
73 | int can_remove_transmit ( PKT **pkt, PKT *pointer ); | 73 | int can_remove_transmit(PKT ** pkt, PKT * pointer); |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #ifdef RTA | 76 | #ifdef RTA |
77 | int spl7 ( void ); | 77 | int spl7(void); |
78 | int spl0 ( void ); | 78 | int spl0(void); |
79 | Q_BUF *get_free_q( void ); | 79 | Q_BUF *get_free_q(void); |
80 | PKT *get_free_end(void); | 80 | PKT *get_free_end(void); |
81 | int add_end( PKT *pkt, PHB *phb, int type); | 81 | int add_end(PKT * pkt, PHB * phb, int type); |
82 | unsigned short free_packets( PHB *phb, int type); | 82 | unsigned short free_packets(PHB * phb, int type); |
83 | int can_remove_start( PKT **pkt, PHB *phb, int type); | 83 | int can_remove_start(PKT ** pkt, PHB * phb, int type); |
84 | int can_add_start( PHB *phb, int type); | 84 | int can_add_start(PHB * phb, int type); |
85 | int can_add_end( PHB *phb, int type); | 85 | int can_add_end(PHB * phb, int type); |
86 | void put_free_end( PKT *pkt); | 86 | void put_free_end(PKT * pkt); |
87 | int remove_start( PKT **pkt, PHB *phb, int type); | 87 | int remove_start(PKT ** pkt, PHB * phb, int type); |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | /* | 90 | /* |
91 | ** Lrt.c | 91 | ** Lrt.c |
92 | */ | 92 | */ |
93 | void lrt( Process *lrt_p, LPB *link ); | 93 | void lrt(Process * lrt_p, LPB * link); |
94 | 94 | ||
95 | #ifdef RTA | 95 | #ifdef RTA |
96 | void set_led_red ( LPB *link ); | 96 | void set_led_red(LPB * link); |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | /* | 99 | /* |
100 | ** ltt.c | 100 | ** ltt.c |
101 | */ | 101 | */ |
102 | void ltt( Process *ltt_p, LPB *link, PHB *phb_ptr[] ); | 102 | void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]); |
103 | void send_poll ( LPB *link ); | 103 | void send_poll(LPB * link); |
104 | void request_id ( LPB *link ); | 104 | void request_id(LPB * link); |
105 | void send_topology_update ( LPB *link ); | 105 | void send_topology_update(LPB * link); |
106 | void send_topology ( LPB *link ); | 106 | void send_topology(LPB * link); |
107 | void supply_id ( LPB *link ); | 107 | void supply_id(LPB * link); |
108 | 108 | ||
109 | #ifdef RTA | 109 | #ifdef RTA |
110 | void redirect_queue ( LPB *link, ushort flush ); | 110 | void redirect_queue(LPB * link, ushort flush); |
111 | int obtain_rup ( int rup_number, PKT **pkt_address, LPB *link ); | 111 | int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link); |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | #ifdef TESTING_PERF | 114 | #ifdef TESTING_PERF |
115 | int consume_cpu( void ); | 115 | int consume_cpu(void); |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | /* | 118 | /* |
119 | ** lttwake.c | 119 | ** lttwake.c |
120 | */ | 120 | */ |
121 | #ifdef HOST | 121 | #ifdef HOST |
122 | void ltt_wakeup( Process *ltt_wakeup_p ); | 122 | void ltt_wakeup(Process * ltt_wakeup_p); |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | /* | 125 | /* |
126 | ** mapgen.c | 126 | ** mapgen.c |
127 | */ | 127 | */ |
128 | void generate_id_map( short mapping, ROUTE_STR route[] ); | 128 | void generate_id_map(short mapping, ROUTE_STR route[]); |
129 | void gen_map( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl ); | 129 | void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); |
130 | void adjust_ttl( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); | 130 | void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl); |
131 | void init_sys_map(void); | 131 | void init_sys_map(void); |
132 | 132 | ||
133 | /* | 133 | /* |
134 | ** mmu.c | 134 | ** mmu.c |
135 | */ | 135 | */ |
136 | char *rio_malloc( unsigned int amount); | 136 | char *rio_malloc(unsigned int amount); |
137 | char *rio_calloc( unsigned int num, unsigned int size); | 137 | char *rio_calloc(unsigned int num, unsigned int size); |
138 | ERROR rio_mmu_init( uint total_mem ); | 138 | ERROR rio_mmu_init(uint total_mem); |
139 | 139 | ||
140 | /* | 140 | /* |
141 | ** partn.c | 141 | ** partn.c |
142 | */ | 142 | */ |
143 | void partition_tx( struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit); | 143 | void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit); |
144 | 144 | ||
145 | /* | 145 | /* |
146 | ** poll.c | 146 | ** poll.c |
147 | */ | 147 | */ |
148 | void tx_poll( Process *tx_poll_p); | 148 | void tx_poll(Process * tx_poll_p); |
149 | 149 | ||
150 | /* | 150 | /* |
151 | ** process.c | 151 | ** process.c |
152 | */ | 152 | */ |
153 | int get_proc_space( Process **pd, int **pws, int wssize); | 153 | int get_proc_space(Process ** pd, int **pws, int wssize); |
154 | 154 | ||
155 | /* | 155 | /* |
156 | ** readrom.c | 156 | ** readrom.c |
@@ -160,85 +160,85 @@ void read_serial_number(char *buf); | |||
160 | /* | 160 | /* |
161 | ** rio.c | 161 | ** rio.c |
162 | */ | 162 | */ |
163 | int main( void ); | 163 | int main(void); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | ** route.c | 166 | ** route.c |
167 | */ | 167 | */ |
168 | void route_update ( PKT *pkt, LPB *link); | 168 | void route_update(PKT * pkt, LPB * link); |
169 | 169 | ||
170 | /* | 170 | /* |
171 | ** rtainit.c | 171 | ** rtainit.c |
172 | */ | 172 | */ |
173 | #if defined(RTA) | 173 | #if defined(RTA) |
174 | void rta_init(ushort RtaType); | 174 | void rta_init(ushort RtaType); |
175 | #endif /* defined(RTA) */ | 175 | #endif /* defined(RTA) */ |
176 | 176 | ||
177 | /* | 177 | /* |
178 | ** rupboot.c | 178 | ** rupboot.c |
179 | */ | 179 | */ |
180 | void rup_boot( PKT *pkt, RUP *this_rup, LPB *link); | 180 | void rup_boot(PKT * pkt, RUP * this_rup, LPB * link); |
181 | 181 | ||
182 | #ifdef RTA | 182 | #ifdef RTA |
183 | void kill_your_neighbour( int link_to_kill ); | 183 | void kill_your_neighbour(int link_to_kill); |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | /* | 186 | /* |
187 | ** rupcmd.c | 187 | ** rupcmd.c |
188 | */ | 188 | */ |
189 | void rup_command( PKT *pkt, struct RUP *this_rup, LPB *link); | 189 | void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link); |
190 | 190 | ||
191 | /* | 191 | /* |
192 | ** ruperr.c | 192 | ** ruperr.c |
193 | */ | 193 | */ |
194 | void rup_error( PKT *pkt, RUP *this_rup, LPB *link ); | 194 | void rup_error(PKT * pkt, RUP * this_rup, LPB * link); |
195 | void illegal_cmd( PKT *src_pkt ); | 195 | void illegal_cmd(PKT * src_pkt); |
196 | 196 | ||
197 | /* | 197 | /* |
198 | ** ruppoll.c | 198 | ** ruppoll.c |
199 | */ | 199 | */ |
200 | void rup_poll( PKT *pkt, RUP *this_rup, LPB *link ); | 200 | void rup_poll(PKT * pkt, RUP * this_rup, LPB * link); |
201 | 201 | ||
202 | /* | 202 | /* |
203 | ** ruppower.c | 203 | ** ruppower.c |
204 | */ | 204 | */ |
205 | void rup_power( PKT *pkt, RUP *this_rup, LPB *link ); | 205 | void rup_power(PKT * pkt, RUP * this_rup, LPB * link); |
206 | 206 | ||
207 | /* | 207 | /* |
208 | ** ruprm.c | 208 | ** ruprm.c |
209 | */ | 209 | */ |
210 | void rup_route_map( PKT *pkt, RUP *this_rup, LPB *link); | 210 | void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link); |
211 | 211 | ||
212 | /* | 212 | /* |
213 | ** rupstat.c | 213 | ** rupstat.c |
214 | */ | 214 | */ |
215 | void rup_status( PKT *pkt, RUP *this_rup, LPB *link); | 215 | void rup_status(PKT * pkt, RUP * this_rup, LPB * link); |
216 | 216 | ||
217 | /* | 217 | /* |
218 | ** rupsync.c | 218 | ** rupsync.c |
219 | */ | 219 | */ |
220 | void rup_sync( PKT *pkt); | 220 | void rup_sync(PKT * pkt); |
221 | 221 | ||
222 | /* | 222 | /* |
223 | ** rxpkt.c | 223 | ** rxpkt.c |
224 | */ | 224 | */ |
225 | ERROR rx_pkt( PKT_ptr_ptr pkt_address, LPB *link); | 225 | ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link); |
226 | 226 | ||
227 | /* | 227 | /* |
228 | ** sendsts.c | 228 | ** sendsts.c |
229 | */ | 229 | */ |
230 | void send_status( PKT *requesting_pkt, RUP *this_rup); | 230 | void send_status(PKT * requesting_pkt, RUP * this_rup); |
231 | 231 | ||
232 | /* | 232 | /* |
233 | ** serial.c | 233 | ** serial.c |
234 | */ | 234 | */ |
235 | void assign_serial ( char *ser_in, char *ser_out); | 235 | void assign_serial(char *ser_in, char *ser_out); |
236 | int cmp_serial ( char *ser_1, char *ser_2); | 236 | int cmp_serial(char *ser_1, char *ser_2); |
237 | 237 | ||
238 | /* | 238 | /* |
239 | ** txpkt.c | 239 | ** txpkt.c |
240 | */ | 240 | */ |
241 | ERROR tx_pkt( PKT *pkt, LPB *link); | 241 | ERROR tx_pkt(PKT * pkt, LPB * link); |
242 | short send_sync( LPB *link); | 242 | short send_sync(LPB * link); |
243 | 243 | ||
244 | #endif /* _prototypes_h */ | 244 | #endif /* _prototypes_h */ |
diff --git a/drivers/char/rio/protsts.h b/drivers/char/rio/protsts.h index 848111ac9380..69fc4bc34153 100644 --- a/drivers/char/rio/protsts.h +++ b/drivers/char/rio/protsts.h | |||
@@ -115,5 +115,3 @@ | |||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /*********** end of file ***********/ | 117 | /*********** end of file ***********/ |
118 | |||
119 | |||
diff --git a/drivers/char/rio/qbuf.h b/drivers/char/rio/qbuf.h index 1fce02f8fcfc..acd9e8e5307d 100644 --- a/drivers/char/rio/qbuf.h +++ b/drivers/char/rio/qbuf.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #ifndef lint | 41 | #ifndef lint |
42 | #ifdef SCCS_LABELS | 42 | #ifdef SCCS_LABELS |
43 | static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ; | 43 | static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1"; |
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
@@ -52,16 +52,15 @@ static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ; | |||
52 | #define PKTS_PER_BUFFER (220 / PKT_LENGTH) | 52 | #define PKTS_PER_BUFFER (220 / PKT_LENGTH) |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | typedef struct Q_BUF Q_BUF ; | 55 | typedef struct Q_BUF Q_BUF; |
56 | struct Q_BUF { | 56 | struct Q_BUF { |
57 | Q_BUF_ptr next ; | 57 | Q_BUF_ptr next; |
58 | Q_BUF_ptr prev ; | 58 | Q_BUF_ptr prev; |
59 | PKT_ptr buf[PKTS_PER_BUFFER] ; | 59 | PKT_ptr buf[PKTS_PER_BUFFER]; |
60 | } ; | 60 | }; |
61 | 61 | ||
62 | 62 | ||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | 65 | ||
66 | /*********** end of file ***********/ | 66 | /*********** end of file ***********/ |
67 | |||
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index 13a9931958b1..7f45e1ab5332 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h | |||
@@ -72,8 +72,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
72 | #define RIO_HOSTS 4 /* number of hosts that can be found */ | 72 | #define RIO_HOSTS 4 /* number of hosts that can be found */ |
73 | #define PORTS_PER_HOST 128 /* number of ports per host */ | 73 | #define PORTS_PER_HOST 128 /* number of ports per host */ |
74 | #define LINKS_PER_UNIT 4 /* number of links from a host */ | 74 | #define LINKS_PER_UNIT 4 /* number of links from a host */ |
75 | #define RIO_PORTS (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */ | 75 | #define RIO_PORTS (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */ |
76 | #define RTAS_PER_HOST (MAX_RUP) /* number of RTAs per host */ | 76 | #define RTAS_PER_HOST (MAX_RUP) /* number of RTAs per host */ |
77 | #define PORTS_PER_RTA (PORTS_PER_HOST/RTAS_PER_HOST) /* ports on a rta */ | 77 | #define PORTS_PER_RTA (PORTS_PER_HOST/RTAS_PER_HOST) /* ports on a rta */ |
78 | #define PORTS_PER_MODULE 4 /* number of ports on a plug-in module */ | 78 | #define PORTS_PER_MODULE 4 /* number of ports on a plug-in module */ |
79 | /* number of modules on an RTA */ | 79 | /* number of modules on an RTA */ |
@@ -216,10 +216,9 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
216 | #define RIO_PRI (PZERO+10) | 216 | #define RIO_PRI (PZERO+10) |
217 | #define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ | 217 | #define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ |
218 | 218 | ||
219 | typedef struct DbInf | 219 | typedef struct DbInf { |
220 | { | 220 | uint Flag; |
221 | uint Flag; | 221 | char Name[8]; |
222 | char Name[8]; | ||
223 | } DbInf; | 222 | } DbInf; |
224 | 223 | ||
225 | #ifndef TRUE | 224 | #ifndef TRUE |
@@ -251,7 +250,7 @@ typedef struct DbInf | |||
251 | *((uint *)PK) = PP->PacketInfo; \ | 250 | *((uint *)PK) = PP->PacketInfo; \ |
252 | } | 251 | } |
253 | 252 | ||
254 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ | 253 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ |
255 | /* prevent a really stupid race condition. */ | 254 | /* prevent a really stupid race condition. */ |
256 | 255 | ||
257 | #define NOT_INITIALISED 0 | 256 | #define NOT_INITIALISED 0 |
@@ -291,4 +290,4 @@ typedef struct DbInf | |||
291 | #define DIST_LINESW_OUTPUT 0x40 | 290 | #define DIST_LINESW_OUTPUT 0x40 |
292 | #define DIST_LINESW_MDMINT 0x80 | 291 | #define DIST_LINESW_MDMINT 0x80 |
293 | 292 | ||
294 | #endif /* __rio_h__ */ | 293 | #endif /* __rio_h__ */ |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 7085a38532b3..8825bd61b7d0 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -33,7 +33,7 @@ | |||
33 | * */ | 33 | * */ |
34 | 34 | ||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/config.h> | 36 | #include <linux/config.h> |
37 | #include <linux/kdev_t.h> | 37 | #include <linux/kdev_t.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
@@ -112,7 +112,7 @@ more than 512 ports.... */ | |||
112 | #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000 | 112 | #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000 |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | #ifndef RIO_WINDOW_LEN | 115 | #ifndef RIO_WINDOW_LEN |
116 | #define RIO_WINDOW_LEN 0x10000 | 116 | #define RIO_WINDOW_LEN 0x10000 |
117 | #endif | 117 | #endif |
118 | 118 | ||
@@ -140,34 +140,51 @@ more than 512 ports.... */ | |||
140 | */ | 140 | */ |
141 | #define RIO_REPORT_FIFO | 141 | #define RIO_REPORT_FIFO |
142 | #define RIO_REPORT_OVERRUN | 142 | #define RIO_REPORT_OVERRUN |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | 145 | ||
146 | /* These constants are derived from SCO Source */ | 146 | /* These constants are derived from SCO Source */ |
147 | static struct Conf | 147 | static struct Conf |
148 | RIOConf = | 148 | RIOConf = { |
149 | { | 149 | /* locator */ "RIO Config here", |
150 | /* locator */ "RIO Config here", | 150 | /* startuptime */ HZ * 2, |
151 | /* startuptime */ HZ*2, /* how long to wait for card to run */ | 151 | /* how long to wait for card to run */ |
152 | /* slowcook */ 0, /* TRUE -> always use line disc. */ | 152 | /* slowcook */ 0, |
153 | /* intrpolltime */ 1, /* The frequency of OUR polls */ | 153 | /* TRUE -> always use line disc. */ |
154 | /* breakinterval */ 25, /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/ | 154 | /* intrpolltime */ 1, |
155 | /* timer */ 10, /* mS */ | 155 | /* The frequency of OUR polls */ |
156 | /* RtaLoadBase */ 0x7000, | 156 | /* breakinterval */ 25, |
157 | /* HostLoadBase */ 0x7C00, | 157 | /* x10 mS XXX: units seem to be 1ms not 10! -- REW */ |
158 | /* XpHz */ 5, /* number of Xprint hits per second */ | 158 | /* timer */ 10, |
159 | /* XpCps */ 120, /* Xprint characters per second */ | 159 | /* mS */ |
160 | /* XpOn */ "\033d#", /* start Xprint for a wyse 60 */ | 160 | /* RtaLoadBase */ 0x7000, |
161 | /* XpOff */ "\024", /* end Xprint for a wyse 60 */ | 161 | /* HostLoadBase */ 0x7C00, |
162 | /* MaxXpCps */ 2000, /* highest Xprint speed */ | 162 | /* XpHz */ 5, |
163 | /* MinXpCps */ 10, /* slowest Xprint speed */ | 163 | /* number of Xprint hits per second */ |
164 | /* SpinCmds */ 1, /* non-zero for mega fast boots */ | 164 | /* XpCps */ 120, |
165 | /* First Addr */ 0x0A0000, /* First address to look at */ | 165 | /* Xprint characters per second */ |
166 | /* Last Addr */ 0xFF0000, /* Last address looked at */ | 166 | /* XpOn */ "\033d#", |
167 | /* BufferSize */ 1024, /* Bytes per port of buffering */ | 167 | /* start Xprint for a wyse 60 */ |
168 | /* LowWater */ 256, /* how much data left before wakeup */ | 168 | /* XpOff */ "\024", |
169 | /* LineLength */ 80, /* how wide is the console? */ | 169 | /* end Xprint for a wyse 60 */ |
170 | /* CmdTimeout */ HZ, /* how long a close command may take */ | 170 | /* MaxXpCps */ 2000, |
171 | /* highest Xprint speed */ | ||
172 | /* MinXpCps */ 10, | ||
173 | /* slowest Xprint speed */ | ||
174 | /* SpinCmds */ 1, | ||
175 | /* non-zero for mega fast boots */ | ||
176 | /* First Addr */ 0x0A0000, | ||
177 | /* First address to look at */ | ||
178 | /* Last Addr */ 0xFF0000, | ||
179 | /* Last address looked at */ | ||
180 | /* BufferSize */ 1024, | ||
181 | /* Bytes per port of buffering */ | ||
182 | /* LowWater */ 256, | ||
183 | /* how much data left before wakeup */ | ||
184 | /* LineLength */ 80, | ||
185 | /* how wide is the console? */ | ||
186 | /* CmdTimeout */ HZ, | ||
187 | /* how long a close command may take */ | ||
171 | }; | 188 | }; |
172 | 189 | ||
173 | 190 | ||
@@ -175,21 +192,20 @@ RIOConf = | |||
175 | 192 | ||
176 | /* Function prototypes */ | 193 | /* Function prototypes */ |
177 | 194 | ||
178 | static void rio_disable_tx_interrupts (void * ptr); | 195 | static void rio_disable_tx_interrupts(void *ptr); |
179 | static void rio_enable_tx_interrupts (void * ptr); | 196 | static void rio_enable_tx_interrupts(void *ptr); |
180 | static void rio_disable_rx_interrupts (void * ptr); | 197 | static void rio_disable_rx_interrupts(void *ptr); |
181 | static void rio_enable_rx_interrupts (void * ptr); | 198 | static void rio_enable_rx_interrupts(void *ptr); |
182 | static int rio_get_CD (void * ptr); | 199 | static int rio_get_CD(void *ptr); |
183 | static void rio_shutdown_port (void * ptr); | 200 | static void rio_shutdown_port(void *ptr); |
184 | static int rio_set_real_termios (void *ptr); | 201 | static int rio_set_real_termios(void *ptr); |
185 | static void rio_hungup (void *ptr); | 202 | static void rio_hungup(void *ptr); |
186 | static void rio_close (void *ptr); | 203 | static void rio_close(void *ptr); |
187 | static int rio_chars_in_buffer (void * ptr); | 204 | static int rio_chars_in_buffer(void *ptr); |
188 | static int rio_fw_ioctl (struct inode *inode, struct file *filp, | 205 | static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); |
189 | unsigned int cmd, unsigned long arg); | ||
190 | static int rio_init_drivers(void); | 206 | static int rio_init_drivers(void); |
191 | 207 | ||
192 | static void my_hd (void *addr, int len); | 208 | static void my_hd(void *addr, int len); |
193 | 209 | ||
194 | static struct tty_driver *rio_driver, *rio_driver2; | 210 | static struct tty_driver *rio_driver, *rio_driver2; |
195 | 211 | ||
@@ -209,7 +225,7 @@ static int rio_poll = 1; | |||
209 | 225 | ||
210 | /* These are the only open spaces in my computer. Yours may have more | 226 | /* These are the only open spaces in my computer. Yours may have more |
211 | or less.... */ | 227 | or less.... */ |
212 | static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; | 228 | static int rio_probe_addrs[] = { 0xc0000, 0xd0000, 0xe0000 }; |
213 | 229 | ||
214 | #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) | 230 | #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) |
215 | 231 | ||
@@ -227,17 +243,17 @@ module_param(rio_debug, int, 0644); | |||
227 | module_param(rio_irqmask, long, 0); | 243 | module_param(rio_irqmask, long, 0); |
228 | 244 | ||
229 | static struct real_driver rio_real_driver = { | 245 | static struct real_driver rio_real_driver = { |
230 | rio_disable_tx_interrupts, | 246 | rio_disable_tx_interrupts, |
231 | rio_enable_tx_interrupts, | 247 | rio_enable_tx_interrupts, |
232 | rio_disable_rx_interrupts, | 248 | rio_disable_rx_interrupts, |
233 | rio_enable_rx_interrupts, | 249 | rio_enable_rx_interrupts, |
234 | rio_get_CD, | 250 | rio_get_CD, |
235 | rio_shutdown_port, | 251 | rio_shutdown_port, |
236 | rio_set_real_termios, | 252 | rio_set_real_termios, |
237 | rio_chars_in_buffer, | 253 | rio_chars_in_buffer, |
238 | rio_close, | 254 | rio_close, |
239 | rio_hungup, | 255 | rio_hungup, |
240 | NULL | 256 | NULL |
241 | }; | 257 | }; |
242 | 258 | ||
243 | /* | 259 | /* |
@@ -246,8 +262,8 @@ static struct real_driver rio_real_driver = { | |||
246 | */ | 262 | */ |
247 | 263 | ||
248 | static struct file_operations rio_fw_fops = { | 264 | static struct file_operations rio_fw_fops = { |
249 | .owner = THIS_MODULE, | 265 | .owner = THIS_MODULE, |
250 | .ioctl = rio_fw_ioctl, | 266 | .ioctl = rio_fw_ioctl, |
251 | }; | 267 | }; |
252 | 268 | ||
253 | static struct miscdevice rio_fw_device = { | 269 | static struct miscdevice rio_fw_device = { |
@@ -262,25 +278,22 @@ static struct miscdevice rio_fw_device = { | |||
262 | 278 | ||
263 | /* This doesn't work. Who's paranoid around here? Not me! */ | 279 | /* This doesn't work. Who's paranoid around here? Not me! */ |
264 | 280 | ||
265 | static inline int rio_paranoia_check(struct rio_port const * port, | 281 | static inline int rio_paranoia_check(struct rio_port const *port, char *name, const char *routine) |
266 | char *name, const char *routine) | ||
267 | { | 282 | { |
268 | 283 | ||
269 | static const char *badmagic = | 284 | static const char *badmagic = KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n"; |
270 | KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n"; | 285 | static const char *badinfo = KERN_ERR "rio: Warning: null rio port for device %s in %s\n"; |
271 | static const char *badinfo = | 286 | |
272 | KERN_ERR "rio: Warning: null rio port for device %s in %s\n"; | 287 | if (!port) { |
273 | 288 | printk(badinfo, name, routine); | |
274 | if (!port) { | 289 | return 1; |
275 | printk (badinfo, name, routine); | 290 | } |
276 | return 1; | 291 | if (port->magic != RIO_MAGIC) { |
277 | } | 292 | printk(badmagic, name, routine); |
278 | if (port->magic != RIO_MAGIC) { | 293 | return 1; |
279 | printk (badmagic, name, routine); | 294 | } |
280 | return 1; | 295 | |
281 | } | 296 | return 0; |
282 | |||
283 | return 0; | ||
284 | } | 297 | } |
285 | #else | 298 | #else |
286 | #define rio_paranoia_check(a,b,c) 0 | 299 | #define rio_paranoia_check(a,b,c) 0 |
@@ -288,53 +301,53 @@ static inline int rio_paranoia_check(struct rio_port const * port, | |||
288 | 301 | ||
289 | 302 | ||
290 | #ifdef DEBUG | 303 | #ifdef DEBUG |
291 | static void my_hd (void *ad, int len) | 304 | static void my_hd(void *ad, int len) |
292 | { | 305 | { |
293 | int i, j, ch; | 306 | int i, j, ch; |
294 | unsigned char *addr = ad; | 307 | unsigned char *addr = ad; |
295 | 308 | ||
296 | for (i=0;i<len;i+=16) { | 309 | for (i = 0; i < len; i += 16) { |
297 | rio_dprintk (RIO_DEBUG_PARAM, "%08x ", (int) addr+i); | 310 | rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i); |
298 | for (j=0;j<16;j++) { | 311 | for (j = 0; j < 16; j++) { |
299 | rio_dprintk (RIO_DEBUG_PARAM, "%02x %s", addr[j+i], (j==7)?" ":""); | 312 | rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); |
300 | } | 313 | } |
301 | for (j=0;j<16;j++) { | 314 | for (j = 0; j < 16; j++) { |
302 | ch = addr[j+i]; | 315 | ch = addr[j + i]; |
303 | rio_dprintk (RIO_DEBUG_PARAM, "%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch)); | 316 | rio_dprintk(RIO_DEBUG_PARAM, "%c", (ch < 0x20) ? '.' : ((ch > 0x7f) ? '.' : ch)); |
304 | } | 317 | } |
305 | rio_dprintk (RIO_DEBUG_PARAM, "\n"); | 318 | rio_dprintk(RIO_DEBUG_PARAM, "\n"); |
306 | } | 319 | } |
307 | } | 320 | } |
308 | #else | 321 | #else |
309 | #define my_hd(ad,len) do{/* nothing*/ } while (0) | 322 | #define my_hd(ad,len) do{/* nothing*/ } while (0) |
310 | #endif | 323 | #endif |
311 | 324 | ||
312 | 325 | ||
313 | /* Delay a number of jiffies, allowing a signal to interrupt */ | 326 | /* Delay a number of jiffies, allowing a signal to interrupt */ |
314 | int RIODelay (struct Port *PortP, int njiffies) | 327 | int RIODelay(struct Port *PortP, int njiffies) |
315 | { | 328 | { |
316 | func_enter (); | 329 | func_enter(); |
317 | 330 | ||
318 | rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); | 331 | rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); |
319 | msleep_interruptible(jiffies_to_msecs(njiffies)); | 332 | msleep_interruptible(jiffies_to_msecs(njiffies)); |
320 | func_exit(); | 333 | func_exit(); |
321 | 334 | ||
322 | if (signal_pending(current)) | 335 | if (signal_pending(current)) |
323 | return RIO_FAIL; | 336 | return RIO_FAIL; |
324 | else | 337 | else |
325 | return !RIO_FAIL; | 338 | return !RIO_FAIL; |
326 | } | 339 | } |
327 | 340 | ||
328 | 341 | ||
329 | /* Delay a number of jiffies, disallowing a signal to interrupt */ | 342 | /* Delay a number of jiffies, disallowing a signal to interrupt */ |
330 | int RIODelay_ni (struct Port *PortP, int njiffies) | 343 | int RIODelay_ni(struct Port *PortP, int njiffies) |
331 | { | 344 | { |
332 | func_enter (); | 345 | func_enter(); |
333 | 346 | ||
334 | rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); | 347 | rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); |
335 | msleep(jiffies_to_msecs(njiffies)); | 348 | msleep(jiffies_to_msecs(njiffies)); |
336 | func_exit(); | 349 | func_exit(); |
337 | return !RIO_FAIL; | 350 | return !RIO_FAIL; |
338 | } | 351 | } |
339 | 352 | ||
340 | 353 | ||
@@ -350,126 +363,121 @@ int rio_ismodem(struct tty_struct *tty) | |||
350 | } | 363 | } |
351 | 364 | ||
352 | 365 | ||
353 | static int rio_set_real_termios (void *ptr) | 366 | static int rio_set_real_termios(void *ptr) |
354 | { | 367 | { |
355 | int rv, modem; | 368 | int rv, modem; |
356 | struct tty_struct *tty; | 369 | struct tty_struct *tty; |
357 | func_enter(); | 370 | func_enter(); |
358 | 371 | ||
359 | tty = ((struct Port *)ptr)->gs.tty; | 372 | tty = ((struct Port *) ptr)->gs.tty; |
360 | 373 | ||
361 | modem = rio_ismodem(tty); | 374 | modem = rio_ismodem(tty); |
362 | 375 | ||
363 | rv = RIOParam( (struct Port *) ptr, CONFIG, modem, 1); | 376 | rv = RIOParam((struct Port *) ptr, CONFIG, modem, 1); |
364 | 377 | ||
365 | func_exit (); | 378 | func_exit(); |
366 | 379 | ||
367 | return rv; | 380 | return rv; |
368 | } | 381 | } |
369 | 382 | ||
370 | 383 | ||
371 | static void rio_reset_interrupt (struct Host *HostP) | 384 | static void rio_reset_interrupt(struct Host *HostP) |
372 | { | 385 | { |
373 | func_enter(); | 386 | func_enter(); |
374 | 387 | ||
375 | switch( HostP->Type ) { | 388 | switch (HostP->Type) { |
376 | case RIO_AT: | 389 | case RIO_AT: |
377 | case RIO_MCA: | 390 | case RIO_MCA: |
378 | case RIO_PCI: | 391 | case RIO_PCI: |
379 | WBYTE(HostP->ResetInt , 0xff); | 392 | WBYTE(HostP->ResetInt, 0xff); |
380 | } | 393 | } |
381 | 394 | ||
382 | func_exit(); | 395 | func_exit(); |
383 | } | 396 | } |
384 | 397 | ||
385 | 398 | ||
386 | static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs) | 399 | static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) |
387 | { | 400 | { |
388 | struct Host *HostP; | 401 | struct Host *HostP; |
389 | func_enter (); | 402 | func_enter(); |
390 | 403 | ||
391 | HostP = (struct Host*)ptr; /* &p->RIOHosts[(long)ptr]; */ | 404 | HostP = (struct Host *) ptr; /* &p->RIOHosts[(long)ptr]; */ |
392 | rio_dprintk (RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", | 405 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec); |
393 | irq, HostP->Ivec); | ||
394 | 406 | ||
395 | /* AAargh! The order in which to do these things is essential and | 407 | /* AAargh! The order in which to do these things is essential and |
396 | not trivial. | 408 | not trivial. |
397 | |||
398 | - Rate limit goes before "recursive". Otherwise a series of | ||
399 | recursive calls will hang the machine in the interrupt routine. | ||
400 | 409 | ||
401 | - hardware twiddling goes before "recursive". Otherwise when we | 410 | - Rate limit goes before "recursive". Otherwise a series of |
402 | poll the card, and a recursive interrupt happens, we won't | 411 | recursive calls will hang the machine in the interrupt routine. |
403 | ack the card, so it might keep on interrupting us. (especially | ||
404 | level sensitive interrupt systems like PCI). | ||
405 | 412 | ||
406 | - Rate limit goes before hardware twiddling. Otherwise we won't | 413 | - hardware twiddling goes before "recursive". Otherwise when we |
407 | catch a card that has gone bonkers. | 414 | poll the card, and a recursive interrupt happens, we won't |
415 | ack the card, so it might keep on interrupting us. (especially | ||
416 | level sensitive interrupt systems like PCI). | ||
408 | 417 | ||
409 | - The "initialized" test goes after the hardware twiddling. Otherwise | 418 | - Rate limit goes before hardware twiddling. Otherwise we won't |
410 | the card will stick us in the interrupt routine again. | 419 | catch a card that has gone bonkers. |
411 | 420 | ||
412 | - The initialized test goes before recursive. | 421 | - The "initialized" test goes after the hardware twiddling. Otherwise |
413 | */ | 422 | the card will stick us in the interrupt routine again. |
423 | |||
424 | - The initialized test goes before recursive. | ||
425 | */ | ||
414 | 426 | ||
415 | 427 | ||
416 | 428 | ||
417 | #ifdef IRQ_RATE_LIMIT | 429 | #ifdef IRQ_RATE_LIMIT |
418 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the | 430 | /* Aaargh! I'm ashamed. This costs more lines-of-code than the |
419 | actual interrupt routine!. (Well, used to when I wrote that comment) */ | 431 | actual interrupt routine!. (Well, used to when I wrote that comment) */ |
420 | { | 432 | { |
421 | static int lastjif; | 433 | static int lastjif; |
422 | static int nintr=0; | 434 | static int nintr = 0; |
423 | 435 | ||
424 | if (lastjif == jiffies) { | 436 | if (lastjif == jiffies) { |
425 | if (++nintr > IRQ_RATE_LIMIT) { | 437 | if (++nintr > IRQ_RATE_LIMIT) { |
426 | free_irq (HostP->Ivec, ptr); | 438 | free_irq(HostP->Ivec, ptr); |
427 | printk (KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", | 439 | printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec); |
428 | HostP->Ivec); | 440 | } |
429 | } | 441 | } else { |
430 | } else { | 442 | lastjif = jiffies; |
431 | lastjif = jiffies; | 443 | nintr = 0; |
432 | nintr = 0; | 444 | } |
433 | } | 445 | } |
434 | } | ||
435 | #endif | 446 | #endif |
436 | rio_dprintk (RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); | 447 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); |
437 | if (HostP->Ivec == irq) { | 448 | if (HostP->Ivec == irq) { |
438 | /* Tell the card we've noticed the interrupt. */ | 449 | /* Tell the card we've noticed the interrupt. */ |
439 | rio_reset_interrupt (HostP); | 450 | rio_reset_interrupt(HostP); |
440 | } | 451 | } |
441 | 452 | ||
442 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) | 453 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) |
443 | return IRQ_HANDLED; | 454 | return IRQ_HANDLED; |
444 | 455 | ||
445 | if (test_and_set_bit (RIO_BOARD_INTR_LOCK, &HostP->locks)) { | 456 | if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { |
446 | printk (KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", | 457 | printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec); |
447 | (int) ptr, HostP->Ivec); | 458 | return IRQ_HANDLED; |
448 | return IRQ_HANDLED; | 459 | } |
449 | } | 460 | |
450 | 461 | RIOServiceHost(p, HostP, irq); | |
451 | RIOServiceHost(p, HostP, irq); | 462 | |
452 | 463 | rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type); | |
453 | rio_dprintk ( RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", | 464 | |
454 | (int) ptr, HostP->Type); | 465 | clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); |
455 | 466 | rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); | |
456 | clear_bit (RIO_BOARD_INTR_LOCK, &HostP->locks); | 467 | func_exit(); |
457 | rio_dprintk (RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", | 468 | return IRQ_HANDLED; |
458 | irq, HostP->Ivec); | ||
459 | func_exit (); | ||
460 | return IRQ_HANDLED; | ||
461 | } | 469 | } |
462 | 470 | ||
463 | 471 | ||
464 | static void rio_pollfunc (unsigned long data) | 472 | static void rio_pollfunc(unsigned long data) |
465 | { | 473 | { |
466 | func_enter (); | 474 | func_enter(); |
467 | 475 | ||
468 | rio_interrupt (0, &p->RIOHosts[data], NULL); | 476 | rio_interrupt(0, &p->RIOHosts[data], NULL); |
469 | p->RIOHosts[data].timer.expires = jiffies + rio_poll; | 477 | p->RIOHosts[data].timer.expires = jiffies + rio_poll; |
470 | add_timer (&p->RIOHosts[data].timer); | 478 | add_timer(&p->RIOHosts[data].timer); |
471 | 479 | ||
472 | func_exit (); | 480 | func_exit(); |
473 | } | 481 | } |
474 | 482 | ||
475 | 483 | ||
@@ -481,106 +489,106 @@ static void rio_pollfunc (unsigned long data) | |||
481 | /* Ehhm. I don't know how to fiddle with interrupts on the Specialix | 489 | /* Ehhm. I don't know how to fiddle with interrupts on the Specialix |
482 | cards. .... Hmm. Ok I figured it out. You don't. -- REW */ | 490 | cards. .... Hmm. Ok I figured it out. You don't. -- REW */ |
483 | 491 | ||
484 | static void rio_disable_tx_interrupts (void * ptr) | 492 | static void rio_disable_tx_interrupts(void *ptr) |
485 | { | 493 | { |
486 | func_enter(); | 494 | func_enter(); |
487 | 495 | ||
488 | /* port->gs.flags &= ~GS_TX_INTEN; */ | 496 | /* port->gs.flags &= ~GS_TX_INTEN; */ |
489 | 497 | ||
490 | func_exit(); | 498 | func_exit(); |
491 | } | 499 | } |
492 | 500 | ||
493 | 501 | ||
494 | static void rio_enable_tx_interrupts (void * ptr) | 502 | static void rio_enable_tx_interrupts(void *ptr) |
495 | { | 503 | { |
496 | struct Port *PortP = ptr; | 504 | struct Port *PortP = ptr; |
497 | /* int hn; */ | 505 | /* int hn; */ |
498 | 506 | ||
499 | func_enter(); | 507 | func_enter(); |
500 | 508 | ||
501 | /* hn = PortP->HostP - p->RIOHosts; | 509 | /* hn = PortP->HostP - p->RIOHosts; |
502 | 510 | ||
503 | rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn); | 511 | rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn); |
504 | rio_interrupt (-1,(void *) hn, NULL); */ | 512 | rio_interrupt (-1,(void *) hn, NULL); */ |
505 | 513 | ||
506 | RIOTxEnable((char *) PortP); | 514 | RIOTxEnable((char *) PortP); |
507 | 515 | ||
508 | /* | 516 | /* |
509 | * In general we cannot count on "tx empty" interrupts, although | 517 | * In general we cannot count on "tx empty" interrupts, although |
510 | * the interrupt routine seems to be able to tell the difference. | 518 | * the interrupt routine seems to be able to tell the difference. |
511 | */ | 519 | */ |
512 | PortP->gs.flags &= ~GS_TX_INTEN; | 520 | PortP->gs.flags &= ~GS_TX_INTEN; |
513 | 521 | ||
514 | func_exit(); | 522 | func_exit(); |
515 | } | 523 | } |
516 | 524 | ||
517 | 525 | ||
518 | static void rio_disable_rx_interrupts (void * ptr) | 526 | static void rio_disable_rx_interrupts(void *ptr) |
519 | { | 527 | { |
520 | func_enter(); | 528 | func_enter(); |
521 | func_exit(); | 529 | func_exit(); |
522 | } | 530 | } |
523 | 531 | ||
524 | static void rio_enable_rx_interrupts (void * ptr) | 532 | static void rio_enable_rx_interrupts(void *ptr) |
525 | { | 533 | { |
526 | /* struct rio_port *port = ptr; */ | 534 | /* struct rio_port *port = ptr; */ |
527 | func_enter(); | 535 | func_enter(); |
528 | func_exit(); | 536 | func_exit(); |
529 | } | 537 | } |
530 | 538 | ||
531 | 539 | ||
532 | /* Jeez. Isn't this simple? */ | 540 | /* Jeez. Isn't this simple? */ |
533 | static int rio_get_CD (void * ptr) | 541 | static int rio_get_CD(void *ptr) |
534 | { | 542 | { |
535 | struct Port *PortP = ptr; | 543 | struct Port *PortP = ptr; |
536 | int rv; | 544 | int rv; |
545 | |||
546 | func_enter(); | ||
547 | rv = (PortP->ModemState & MSVR1_CD) != 0; | ||
537 | 548 | ||
538 | func_enter(); | 549 | rio_dprintk(RIO_DEBUG_INIT, "Getting CD status: %d\n", rv); |
539 | rv = (PortP->ModemState & MSVR1_CD) != 0; | ||
540 | 550 | ||
541 | rio_dprintk (RIO_DEBUG_INIT, "Getting CD status: %d\n", rv); | 551 | func_exit(); |
542 | 552 | return rv; | |
543 | func_exit(); | ||
544 | return rv; | ||
545 | } | 553 | } |
546 | 554 | ||
547 | 555 | ||
548 | /* Jeez. Isn't this simple? Actually, we can sync with the actual port | 556 | /* Jeez. Isn't this simple? Actually, we can sync with the actual port |
549 | by just pushing stuff into the queue going to the port... */ | 557 | by just pushing stuff into the queue going to the port... */ |
550 | static int rio_chars_in_buffer (void * ptr) | 558 | static int rio_chars_in_buffer(void *ptr) |
551 | { | 559 | { |
552 | func_enter(); | 560 | func_enter(); |
553 | 561 | ||
554 | func_exit(); | 562 | func_exit(); |
555 | return 0; | 563 | return 0; |
556 | } | 564 | } |
557 | 565 | ||
558 | 566 | ||
559 | /* Nothing special here... */ | 567 | /* Nothing special here... */ |
560 | static void rio_shutdown_port (void * ptr) | 568 | static void rio_shutdown_port(void *ptr) |
561 | { | 569 | { |
562 | struct Port *PortP; | 570 | struct Port *PortP; |
563 | 571 | ||
564 | func_enter(); | 572 | func_enter(); |
565 | 573 | ||
566 | PortP = (struct Port *)ptr; | 574 | PortP = (struct Port *) ptr; |
567 | PortP->gs.tty = NULL; | 575 | PortP->gs.tty = NULL; |
568 | #if 0 | 576 | #if 0 |
569 | port->gs.flags &= ~ GS_ACTIVE; | 577 | port->gs.flags &= ~GS_ACTIVE; |
570 | if (!port->gs.tty) { | 578 | if (!port->gs.tty) { |
571 | rio_dprintk (RIO_DBUG_TTY, "No tty.\n"); | 579 | rio_dprintk(RIO_DBUG_TTY, "No tty.\n"); |
572 | return; | 580 | return; |
573 | } | 581 | } |
574 | if (!port->gs.tty->termios) { | 582 | if (!port->gs.tty->termios) { |
575 | rio_dprintk (RIO_DEBUG_TTY, "No termios.\n"); | 583 | rio_dprintk(RIO_DEBUG_TTY, "No termios.\n"); |
576 | return; | 584 | return; |
577 | } | 585 | } |
578 | if (port->gs.tty->termios->c_cflag & HUPCL) { | 586 | if (port->gs.tty->termios->c_cflag & HUPCL) { |
579 | rio_setsignals (port, 0, 0); | 587 | rio_setsignals(port, 0, 0); |
580 | } | 588 | } |
581 | #endif | 589 | #endif |
582 | 590 | ||
583 | func_exit(); | 591 | func_exit(); |
584 | } | 592 | } |
585 | 593 | ||
586 | 594 | ||
@@ -591,16 +599,16 @@ static void rio_shutdown_port (void * ptr) | |||
591 | running minicom on a serial port that is driven by a modularized | 599 | running minicom on a serial port that is driven by a modularized |
592 | driver. Have the modem hangup. Then remove the driver module. Then | 600 | driver. Have the modem hangup. Then remove the driver module. Then |
593 | exit minicom. I expect an "oops". -- REW */ | 601 | exit minicom. I expect an "oops". -- REW */ |
594 | static void rio_hungup (void *ptr) | 602 | static void rio_hungup(void *ptr) |
595 | { | 603 | { |
596 | struct Port *PortP; | 604 | struct Port *PortP; |
605 | |||
606 | func_enter(); | ||
597 | 607 | ||
598 | func_enter(); | 608 | PortP = (struct Port *) ptr; |
599 | 609 | PortP->gs.tty = NULL; | |
600 | PortP = (struct Port *)ptr; | ||
601 | PortP->gs.tty = NULL; | ||
602 | 610 | ||
603 | func_exit (); | 611 | func_exit(); |
604 | } | 612 | } |
605 | 613 | ||
606 | 614 | ||
@@ -608,146 +616,135 @@ static void rio_hungup (void *ptr) | |||
608 | this. | 616 | this. |
609 | rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;} | 617 | rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;} |
610 | */ | 618 | */ |
611 | static void rio_close (void *ptr) | 619 | static void rio_close(void *ptr) |
612 | { | 620 | { |
613 | struct Port *PortP; | 621 | struct Port *PortP; |
614 | 622 | ||
615 | func_enter (); | 623 | func_enter(); |
616 | 624 | ||
617 | PortP = (struct Port *)ptr; | 625 | PortP = (struct Port *) ptr; |
618 | 626 | ||
619 | riotclose (ptr); | 627 | riotclose(ptr); |
620 | 628 | ||
621 | if(PortP->gs.count) { | 629 | if (PortP->gs.count) { |
622 | printk (KERN_ERR "WARNING port count:%d\n", PortP->gs.count); | 630 | printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); |
623 | PortP->gs.count = 0; | 631 | PortP->gs.count = 0; |
624 | } | 632 | } |
625 | 633 | ||
626 | PortP->gs.tty = NULL; | 634 | PortP->gs.tty = NULL; |
627 | func_exit (); | 635 | func_exit(); |
628 | } | 636 | } |
629 | 637 | ||
630 | 638 | ||
631 | 639 | ||
632 | static int rio_fw_ioctl (struct inode *inode, struct file *filp, | 640 | static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) |
633 | unsigned int cmd, unsigned long arg) | ||
634 | { | 641 | { |
635 | int rc = 0; | 642 | int rc = 0; |
636 | func_enter(); | 643 | func_enter(); |
637 | 644 | ||
638 | /* The "dev" argument isn't used. */ | 645 | /* The "dev" argument isn't used. */ |
639 | rc = riocontrol (p, 0, cmd, (void *)arg, capable(CAP_SYS_ADMIN)); | 646 | rc = riocontrol(p, 0, cmd, (void *) arg, capable(CAP_SYS_ADMIN)); |
640 | 647 | ||
641 | func_exit (); | 648 | func_exit(); |
642 | return rc; | 649 | return rc; |
643 | } | 650 | } |
644 | 651 | ||
645 | extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, | 652 | extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); |
646 | int command, int len, int arg); | ||
647 | 653 | ||
648 | static int rio_ioctl (struct tty_struct * tty, struct file * filp, | 654 | static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg) |
649 | unsigned int cmd, unsigned long arg) | ||
650 | { | 655 | { |
651 | int rc; | 656 | int rc; |
652 | struct Port *PortP; | 657 | struct Port *PortP; |
653 | int ival; | 658 | int ival; |
654 | 659 | ||
655 | func_enter(); | 660 | func_enter(); |
656 | 661 | ||
657 | PortP = (struct Port *)tty->driver_data; | 662 | PortP = (struct Port *) tty->driver_data; |
658 | 663 | ||
659 | rc = 0; | 664 | rc = 0; |
660 | switch (cmd) { | 665 | switch (cmd) { |
661 | #if 0 | 666 | #if 0 |
662 | case TIOCGSOFTCAR: | 667 | case TIOCGSOFTCAR: |
663 | rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), | 668 | rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg); |
664 | (unsigned int *) arg); | 669 | break; |
665 | break; | ||
666 | #endif | 670 | #endif |
667 | case TIOCSSOFTCAR: | 671 | case TIOCSSOFTCAR: |
668 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 672 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
669 | tty->termios->c_cflag = | 673 | tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); |
670 | (tty->termios->c_cflag & ~CLOCAL) | | 674 | } |
671 | (ival ? CLOCAL : 0); | 675 | break; |
672 | } | 676 | case TIOCGSERIAL: |
673 | break; | 677 | rc = -EFAULT; |
674 | case TIOCGSERIAL: | 678 | if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct))) |
675 | rc = -EFAULT; | 679 | rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg); |
676 | if (access_ok(VERIFY_WRITE, (void *) arg, | 680 | break; |
677 | sizeof(struct serial_struct))) | 681 | case TCSBRK: |
678 | rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg); | 682 | if (PortP->State & RIO_DELETED) { |
679 | break; | 683 | rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); |
680 | case TCSBRK: | 684 | rc = -EIO; |
681 | if ( PortP->State & RIO_DELETED ) { | 685 | } else { |
682 | rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); | 686 | if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) { |
683 | rc = -EIO; | 687 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); |
684 | } else { | 688 | rc = -EIO; |
685 | if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) { | 689 | } |
686 | rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | 690 | } |
687 | rc = -EIO; | 691 | break; |
688 | } | 692 | case TCSBRKP: |
689 | } | 693 | if (PortP->State & RIO_DELETED) { |
690 | break; | 694 | rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); |
691 | case TCSBRKP: | 695 | rc = -EIO; |
692 | if ( PortP->State & RIO_DELETED ) { | 696 | } else { |
693 | rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n"); | 697 | int l; |
694 | rc = -EIO; | 698 | l = arg ? arg * 100 : 250; |
695 | } else { | 699 | if (l > 255) |
696 | int l; | 700 | l = 255; |
697 | l = arg?arg*100:250; | 701 | if (RIOShortCommand(p, PortP, SBREAK, 2, arg ? arg * 100 : 250) == RIO_FAIL) { |
698 | if (l > 255) l = 255; | 702 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); |
699 | if (RIOShortCommand(p, PortP, SBREAK, 2, arg?arg*100:250) == RIO_FAIL) { | 703 | rc = -EIO; |
700 | rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | 704 | } |
701 | rc = -EIO; | 705 | } |
702 | } | 706 | break; |
703 | } | 707 | case TIOCSSERIAL: |
704 | break; | 708 | rc = -EFAULT; |
705 | case TIOCSSERIAL: | 709 | if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) |
706 | rc = -EFAULT; | 710 | rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); |
707 | if (access_ok(VERIFY_READ, (void *) arg, | 711 | break; |
708 | sizeof(struct serial_struct))) | ||
709 | rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); | ||
710 | break; | ||
711 | #if 0 | 712 | #if 0 |
712 | /* | 713 | /* |
713 | * note: these IOCTLs no longer reach here. Use | 714 | * note: these IOCTLs no longer reach here. Use |
714 | * tiocmset/tiocmget driver methods instead. The | 715 | * tiocmset/tiocmget driver methods instead. The |
715 | * #if 0 disablement predates this comment. | 716 | * #if 0 disablement predates this comment. |
716 | */ | 717 | */ |
717 | case TIOCMGET: | 718 | case TIOCMGET: |
718 | rc = -EFAULT; | 719 | rc = -EFAULT; |
719 | if (access_ok(VERIFY_WRITE, (void *) arg, | 720 | if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) { |
720 | sizeof(unsigned int))) { | 721 | rc = 0; |
721 | rc = 0; | 722 | ival = rio_getsignals(port); |
722 | ival = rio_getsignals(port); | 723 | put_user(ival, (unsigned int *) arg); |
723 | put_user(ival, (unsigned int *) arg); | 724 | } |
724 | } | 725 | break; |
725 | break; | 726 | case TIOCMBIS: |
726 | case TIOCMBIS: | 727 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
727 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 728 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1)); |
728 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), | 729 | } |
729 | ((ival & TIOCM_RTS) ? 1 : -1)); | 730 | break; |
730 | } | 731 | case TIOCMBIC: |
731 | break; | 732 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
732 | case TIOCMBIC: | 733 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1)); |
733 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 734 | } |
734 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), | 735 | break; |
735 | ((ival & TIOCM_RTS) ? 0 : -1)); | 736 | case TIOCMSET: |
736 | } | 737 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { |
737 | break; | 738 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0)); |
738 | case TIOCMSET: | 739 | } |
739 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 740 | break; |
740 | rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), | ||
741 | ((ival & TIOCM_RTS) ? 1 : 0)); | ||
742 | } | ||
743 | break; | ||
744 | #endif | 741 | #endif |
745 | default: | 742 | default: |
746 | rc = -ENOIOCTLCMD; | 743 | rc = -ENOIOCTLCMD; |
747 | break; | 744 | break; |
748 | } | 745 | } |
749 | func_exit(); | 746 | func_exit(); |
750 | return rc; | 747 | return rc; |
751 | } | 748 | } |
752 | 749 | ||
753 | 750 | ||
@@ -767,37 +764,37 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp, | |||
767 | * flow control scheme is in use for that port. -- Simon Allen | 764 | * flow control scheme is in use for that port. -- Simon Allen |
768 | */ | 765 | */ |
769 | 766 | ||
770 | static void rio_throttle (struct tty_struct * tty) | 767 | static void rio_throttle(struct tty_struct *tty) |
771 | { | 768 | { |
772 | struct Port *port = (struct Port *)tty->driver_data; | 769 | struct Port *port = (struct Port *) tty->driver_data; |
773 | 770 | ||
774 | func_enter(); | 771 | func_enter(); |
775 | /* If the port is using any type of input flow | 772 | /* If the port is using any type of input flow |
776 | * control then throttle the port. | 773 | * control then throttle the port. |
777 | */ | 774 | */ |
778 | 775 | ||
779 | if((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty)) ) { | 776 | if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { |
780 | port->State |= RIO_THROTTLE_RX; | 777 | port->State |= RIO_THROTTLE_RX; |
781 | } | 778 | } |
782 | 779 | ||
783 | func_exit(); | 780 | func_exit(); |
784 | } | 781 | } |
785 | 782 | ||
786 | 783 | ||
787 | static void rio_unthrottle (struct tty_struct * tty) | 784 | static void rio_unthrottle(struct tty_struct *tty) |
788 | { | 785 | { |
789 | struct Port *port = (struct Port *)tty->driver_data; | 786 | struct Port *port = (struct Port *) tty->driver_data; |
790 | 787 | ||
791 | func_enter(); | 788 | func_enter(); |
792 | /* Always unthrottle even if flow control is not enabled on | 789 | /* Always unthrottle even if flow control is not enabled on |
793 | * this port in case we disabled flow control while the port | 790 | * this port in case we disabled flow control while the port |
794 | * was throttled | 791 | * was throttled |
795 | */ | 792 | */ |
796 | 793 | ||
797 | port->State &= ~RIO_THROTTLE_RX; | 794 | port->State &= ~RIO_THROTTLE_RX; |
798 | 795 | ||
799 | func_exit(); | 796 | func_exit(); |
800 | return; | 797 | return; |
801 | } | 798 | } |
802 | 799 | ||
803 | 800 | ||
@@ -809,35 +806,34 @@ static void rio_unthrottle (struct tty_struct * tty) | |||
809 | * ********************************************************************** */ | 806 | * ********************************************************************** */ |
810 | 807 | ||
811 | 808 | ||
812 | static struct vpd_prom *get_VPD_PROM (struct Host *hp) | 809 | static struct vpd_prom *get_VPD_PROM(struct Host *hp) |
813 | { | 810 | { |
814 | static struct vpd_prom vpdp; | 811 | static struct vpd_prom vpdp; |
815 | char *p; | 812 | char *p; |
816 | int i; | 813 | int i; |
814 | |||
815 | func_enter(); | ||
816 | rio_dprintk(RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", hp->Caddr + RIO_VPD_ROM); | ||
817 | 817 | ||
818 | func_enter(); | 818 | p = (char *) &vpdp; |
819 | rio_dprintk (RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", | 819 | for (i = 0; i < sizeof(struct vpd_prom); i++) |
820 | hp->Caddr + RIO_VPD_ROM); | 820 | *p++ = readb(hp->Caddr + RIO_VPD_ROM + i * 2); |
821 | /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */ | ||
821 | 822 | ||
822 | p = (char *) &vpdp; | 823 | /* Terminate the identifier string. |
823 | for (i=0;i< sizeof (struct vpd_prom);i++) | 824 | *** requires one extra byte in struct vpd_prom *** */ |
824 | *p++ = readb (hp->Caddr+RIO_VPD_ROM + i*2); | 825 | *p++ = 0; |
825 | /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */ | ||
826 | 826 | ||
827 | /* Terminate the identifier string. | 827 | if (rio_debug & RIO_DEBUG_PROBE) |
828 | *** requires one extra byte in struct vpd_prom *** */ | 828 | my_hd((char *) &vpdp, 0x20); |
829 | *p++=0; | ||
830 | 829 | ||
831 | if (rio_debug & RIO_DEBUG_PROBE) | 830 | func_exit(); |
832 | my_hd ((char *)&vpdp, 0x20); | ||
833 | |||
834 | func_exit(); | ||
835 | 831 | ||
836 | return &vpdp; | 832 | return &vpdp; |
837 | } | 833 | } |
838 | 834 | ||
839 | static struct tty_operations rio_ops = { | 835 | static struct tty_operations rio_ops = { |
840 | .open = riotopen, | 836 | .open = riotopen, |
841 | .close = gs_close, | 837 | .close = gs_close, |
842 | .write = gs_write, | 838 | .write = gs_write, |
843 | .put_char = gs_put_char, | 839 | .put_char = gs_put_char, |
@@ -889,7 +885,7 @@ static int rio_init_drivers(void) | |||
889 | rio_driver2->flags = TTY_DRIVER_REAL_RAW; | 885 | rio_driver2->flags = TTY_DRIVER_REAL_RAW; |
890 | tty_set_operations(rio_driver2, &rio_ops); | 886 | tty_set_operations(rio_driver2, &rio_ops); |
891 | 887 | ||
892 | rio_dprintk (RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios); | 888 | rio_dprintk(RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios); |
893 | 889 | ||
894 | if ((error = tty_register_driver(rio_driver))) | 890 | if ((error = tty_register_driver(rio_driver))) |
895 | goto out2; | 891 | goto out2; |
@@ -897,116 +893,111 @@ static int rio_init_drivers(void) | |||
897 | goto out3; | 893 | goto out3; |
898 | func_exit(); | 894 | func_exit(); |
899 | return 0; | 895 | return 0; |
900 | out3: | 896 | out3: |
901 | tty_unregister_driver(rio_driver); | 897 | tty_unregister_driver(rio_driver); |
902 | out2: | 898 | out2: |
903 | put_tty_driver(rio_driver2); | 899 | put_tty_driver(rio_driver2); |
904 | out1: | 900 | out1: |
905 | put_tty_driver(rio_driver); | 901 | put_tty_driver(rio_driver); |
906 | out: | 902 | out: |
907 | printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", | 903 | printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", error); |
908 | error); | ||
909 | return 1; | 904 | return 1; |
910 | } | 905 | } |
911 | 906 | ||
912 | 907 | ||
913 | static void * ckmalloc (int size) | 908 | static void *ckmalloc(int size) |
914 | { | 909 | { |
915 | void *p; | 910 | void *p; |
916 | 911 | ||
917 | p = kmalloc(size, GFP_KERNEL); | 912 | p = kmalloc(size, GFP_KERNEL); |
918 | if (p) | 913 | if (p) |
919 | memset(p, 0, size); | 914 | memset(p, 0, size); |
920 | return p; | 915 | return p; |
921 | } | 916 | } |
922 | 917 | ||
923 | 918 | ||
924 | 919 | ||
925 | static int rio_init_datastructures (void) | 920 | static int rio_init_datastructures(void) |
926 | { | 921 | { |
927 | int i; | 922 | int i; |
928 | struct Port *port; | 923 | struct Port *port; |
929 | func_enter(); | 924 | func_enter(); |
930 | 925 | ||
931 | /* Many drivers statically allocate the maximum number of ports | 926 | /* Many drivers statically allocate the maximum number of ports |
932 | There is no reason not to allocate them dynamically. Is there? -- REW */ | 927 | There is no reason not to allocate them dynamically. Is there? -- REW */ |
933 | /* However, the RIO driver allows users to configure their first | 928 | /* However, the RIO driver allows users to configure their first |
934 | RTA as the ports numbered 504-511. We therefore need to allocate | 929 | RTA as the ports numbered 504-511. We therefore need to allocate |
935 | the whole range. :-( -- REW */ | 930 | the whole range. :-( -- REW */ |
936 | 931 | ||
937 | #define RI_SZ sizeof(struct rio_info) | 932 | #define RI_SZ sizeof(struct rio_info) |
938 | #define HOST_SZ sizeof(struct Host) | 933 | #define HOST_SZ sizeof(struct Host) |
939 | #define PORT_SZ sizeof(struct Port *) | 934 | #define PORT_SZ sizeof(struct Port *) |
940 | #define TMIO_SZ sizeof(struct termios *) | 935 | #define TMIO_SZ sizeof(struct termios *) |
941 | rio_dprintk (RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", | 936 | rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); |
942 | RI_SZ, | 937 | |
943 | RIO_HOSTS * HOST_SZ, | 938 | if (!(p = ckmalloc(RI_SZ))) |
944 | RIO_PORTS * PORT_SZ, | 939 | goto free0; |
945 | RIO_PORTS * TMIO_SZ, | 940 | if (!(p->RIOHosts = ckmalloc(RIO_HOSTS * HOST_SZ))) |
946 | RIO_PORTS * TMIO_SZ); | 941 | goto free1; |
947 | 942 | if (!(p->RIOPortp = ckmalloc(RIO_PORTS * PORT_SZ))) | |
948 | if (!(p = ckmalloc ( RI_SZ))) goto free0; | 943 | goto free2; |
949 | if (!(p->RIOHosts = ckmalloc (RIO_HOSTS * HOST_SZ))) goto free1; | 944 | p->RIOConf = RIOConf; |
950 | if (!(p->RIOPortp = ckmalloc (RIO_PORTS * PORT_SZ))) goto free2; | 945 | rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp); |
951 | p->RIOConf = RIOConf; | ||
952 | rio_dprintk (RIO_DEBUG_INIT, "Got : %p %p %p\n", | ||
953 | p, p->RIOHosts, p->RIOPortp); | ||
954 | 946 | ||
955 | #if 1 | 947 | #if 1 |
956 | for (i = 0; i < RIO_PORTS; i++) { | 948 | for (i = 0; i < RIO_PORTS; i++) { |
957 | port = p->RIOPortp[i] = ckmalloc (sizeof (struct Port)); | 949 | port = p->RIOPortp[i] = ckmalloc(sizeof(struct Port)); |
958 | if (!port) { | 950 | if (!port) { |
959 | goto free6; | 951 | goto free6; |
960 | } | 952 | } |
961 | rio_dprintk (RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); | 953 | rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); |
962 | port->PortNum = i; | 954 | port->PortNum = i; |
963 | port->gs.magic = RIO_MAGIC; | 955 | port->gs.magic = RIO_MAGIC; |
964 | port->gs.close_delay = HZ/2; | 956 | port->gs.close_delay = HZ / 2; |
965 | port->gs.closing_wait = 30 * HZ; | 957 | port->gs.closing_wait = 30 * HZ; |
966 | port->gs.rd = &rio_real_driver; | 958 | port->gs.rd = &rio_real_driver; |
967 | spin_lock_init(&port->portSem); | 959 | spin_lock_init(&port->portSem); |
968 | /* | 960 | /* |
969 | * Initializing wait queue | 961 | * Initializing wait queue |
970 | */ | 962 | */ |
971 | init_waitqueue_head(&port->gs.open_wait); | 963 | init_waitqueue_head(&port->gs.open_wait); |
972 | init_waitqueue_head(&port->gs.close_wait); | 964 | init_waitqueue_head(&port->gs.close_wait); |
973 | } | 965 | } |
974 | #else | 966 | #else |
975 | /* We could postpone initializing them to when they are configured. */ | 967 | /* We could postpone initializing them to when they are configured. */ |
976 | #endif | 968 | #endif |
977 | 969 | ||
978 | 970 | ||
979 | |||
980 | if (rio_debug & RIO_DEBUG_INIT) { | ||
981 | my_hd (&rio_real_driver, sizeof (rio_real_driver)); | ||
982 | } | ||
983 | 971 | ||
984 | 972 | if (rio_debug & RIO_DEBUG_INIT) { | |
985 | func_exit(); | 973 | my_hd(&rio_real_driver, sizeof(rio_real_driver)); |
986 | return 0; | 974 | } |
975 | |||
987 | 976 | ||
988 | free6:for (i--;i>=0;i--) | 977 | func_exit(); |
989 | kfree (p->RIOPortp[i]); | 978 | return 0; |
979 | |||
980 | free6:for (i--; i >= 0; i--) | ||
981 | kfree(p->RIOPortp[i]); | ||
990 | /*free5: | 982 | /*free5: |
991 | free4: | 983 | free4: |
992 | free3:*/kfree (p->RIOPortp); | 984 | free3:*/ kfree(p->RIOPortp); |
993 | free2:kfree (p->RIOHosts); | 985 | free2:kfree(p->RIOHosts); |
994 | free1: | 986 | free1: |
995 | rio_dprintk (RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", | 987 | rio_dprintk(RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", p, p->RIOHosts, p->RIOPortp); |
996 | p, p->RIOHosts, p->RIOPortp); | 988 | kfree(p); |
997 | kfree(p); | 989 | free0: |
998 | free0: | 990 | return -ENOMEM; |
999 | return -ENOMEM; | ||
1000 | } | 991 | } |
1001 | 992 | ||
1002 | static void __exit rio_release_drivers(void) | 993 | static void __exit rio_release_drivers(void) |
1003 | { | 994 | { |
1004 | func_enter(); | 995 | func_enter(); |
1005 | tty_unregister_driver(rio_driver2); | 996 | tty_unregister_driver(rio_driver2); |
1006 | tty_unregister_driver(rio_driver); | 997 | tty_unregister_driver(rio_driver); |
1007 | put_tty_driver(rio_driver2); | 998 | put_tty_driver(rio_driver2); |
1008 | put_tty_driver(rio_driver); | 999 | put_tty_driver(rio_driver); |
1009 | func_exit(); | 1000 | func_exit(); |
1010 | } | 1001 | } |
1011 | 1002 | ||
1012 | 1003 | ||
@@ -1017,7 +1008,7 @@ static void __exit rio_release_drivers(void) | |||
1017 | There is another bit besides Bit 17. Turning that bit off | 1008 | There is another bit besides Bit 17. Turning that bit off |
1018 | (on boards shipped with the fix in the eeprom) results in a | 1009 | (on boards shipped with the fix in the eeprom) results in a |
1019 | hang on the next access to the card. | 1010 | hang on the next access to the card. |
1020 | */ | 1011 | */ |
1021 | 1012 | ||
1022 | /******************************************************** | 1013 | /******************************************************** |
1023 | * Setting bit 17 in the CNTRL register of the PLX 9050 * | 1014 | * Setting bit 17 in the CNTRL register of the PLX 9050 * |
@@ -1030,319 +1021,293 @@ static void __exit rio_release_drivers(void) | |||
1030 | EEprom. As the bit is read/write for the CPU, we can fix it here, | 1021 | EEprom. As the bit is read/write for the CPU, we can fix it here, |
1031 | if we detect that it isn't set correctly. -- REW */ | 1022 | if we detect that it isn't set correctly. -- REW */ |
1032 | 1023 | ||
1033 | static void fix_rio_pci (struct pci_dev *pdev) | 1024 | static void fix_rio_pci(struct pci_dev *pdev) |
1034 | { | 1025 | { |
1035 | unsigned int hwbase; | 1026 | unsigned int hwbase; |
1036 | unsigned long rebase; | 1027 | unsigned long rebase; |
1037 | unsigned int t; | 1028 | unsigned int t; |
1038 | 1029 | ||
1039 | #define CNTRL_REG_OFFSET 0x50 | 1030 | #define CNTRL_REG_OFFSET 0x50 |
1040 | #define CNTRL_REG_GOODVALUE 0x18260000 | 1031 | #define CNTRL_REG_GOODVALUE 0x18260000 |
1041 | 1032 | ||
1042 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); | 1033 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); |
1043 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; | 1034 | hwbase &= PCI_BASE_ADDRESS_MEM_MASK; |
1044 | rebase = (ulong) ioremap(hwbase, 0x80); | 1035 | rebase = (ulong) ioremap(hwbase, 0x80); |
1045 | t = readl (rebase + CNTRL_REG_OFFSET); | 1036 | t = readl(rebase + CNTRL_REG_OFFSET); |
1046 | if (t != CNTRL_REG_GOODVALUE) { | 1037 | if (t != CNTRL_REG_GOODVALUE) { |
1047 | printk (KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", | 1038 | printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); |
1048 | t, CNTRL_REG_GOODVALUE); | 1039 | writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); |
1049 | writel (CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); | 1040 | } |
1050 | } | 1041 | iounmap((char *) rebase); |
1051 | iounmap((char*) rebase); | ||
1052 | } | 1042 | } |
1053 | #endif | 1043 | #endif |
1054 | 1044 | ||
1055 | 1045 | ||
1056 | static int __init rio_init(void) | 1046 | static int __init rio_init(void) |
1057 | { | 1047 | { |
1058 | int found = 0; | 1048 | int found = 0; |
1059 | int i; | 1049 | int i; |
1060 | struct Host *hp; | 1050 | struct Host *hp; |
1061 | int retval; | 1051 | int retval; |
1062 | struct vpd_prom *vpdp; | 1052 | struct vpd_prom *vpdp; |
1063 | int okboard; | 1053 | int okboard; |
1064 | 1054 | ||
1065 | #ifdef CONFIG_PCI | 1055 | #ifdef CONFIG_PCI |
1066 | struct pci_dev *pdev = NULL; | 1056 | struct pci_dev *pdev = NULL; |
1067 | unsigned int tint; | 1057 | unsigned int tint; |
1068 | unsigned short tshort; | 1058 | unsigned short tshort; |
1069 | #endif | 1059 | #endif |
1070 | 1060 | ||
1071 | func_enter(); | 1061 | func_enter(); |
1072 | rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", | 1062 | rio_dprintk(RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_debug); |
1073 | rio_debug); | 1063 | |
1074 | 1064 | if (abs((long) (&rio_debug) - rio_debug) < 0x10000) { | |
1075 | if (abs ((long) (&rio_debug) - rio_debug) < 0x10000) { | 1065 | printk(KERN_WARNING "rio: rio_debug is an address, instead of a value. " "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug); |
1076 | printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. " | 1066 | rio_debug = -1; |
1077 | "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug); | 1067 | } |
1078 | rio_debug=-1; | 1068 | |
1079 | } | 1069 | if (misc_register(&rio_fw_device) < 0) { |
1080 | 1070 | printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); | |
1081 | if (misc_register(&rio_fw_device) < 0) { | 1071 | return -EIO; |
1082 | printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n"); | 1072 | } |
1083 | return -EIO; | 1073 | |
1084 | } | 1074 | retval = rio_init_datastructures(); |
1085 | 1075 | if (retval < 0) { | |
1086 | retval = rio_init_datastructures (); | 1076 | misc_deregister(&rio_fw_device); |
1087 | if (retval < 0) { | 1077 | return retval; |
1088 | misc_deregister(&rio_fw_device); | 1078 | } |
1089 | return retval; | ||
1090 | } | ||
1091 | |||
1092 | #ifdef CONFIG_PCI | 1079 | #ifdef CONFIG_PCI |
1093 | /* First look for the JET devices: */ | 1080 | /* First look for the JET devices: */ |
1094 | while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, | 1081 | while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) { |
1095 | PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, | 1082 | if (pci_enable_device(pdev)) |
1096 | pdev))) { | 1083 | continue; |
1097 | if (pci_enable_device(pdev)) continue; | 1084 | |
1098 | 1085 | /* Specialix has a whole bunch of cards with | |
1099 | /* Specialix has a whole bunch of cards with | 1086 | 0x2000 as the device ID. They say its because |
1100 | 0x2000 as the device ID. They say its because | 1087 | the standard requires it. Stupid standard. */ |
1101 | the standard requires it. Stupid standard. */ | 1088 | /* It seems that reading a word doesn't work reliably on 2.0. |
1102 | /* It seems that reading a word doesn't work reliably on 2.0. | 1089 | Also, reading a non-aligned dword doesn't work. So we read the |
1103 | Also, reading a non-aligned dword doesn't work. So we read the | 1090 | whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) |
1104 | whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) | 1091 | ourselves */ |
1105 | ourselves */ | 1092 | /* I don't know why the define doesn't work, constant 0x2c does --REW */ |
1106 | /* I don't know why the define doesn't work, constant 0x2c does --REW */ | 1093 | pci_read_config_dword(pdev, 0x2c, &tint); |
1107 | pci_read_config_dword (pdev, 0x2c, &tint); | 1094 | tshort = (tint >> 16) & 0xffff; |
1108 | tshort = (tint >> 16) & 0xffff; | 1095 | rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); |
1109 | rio_dprintk (RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); | 1096 | if (tshort != 0x0100) { |
1110 | if (tshort != 0x0100) { | 1097 | rio_dprintk(RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", tshort); |
1111 | rio_dprintk (RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", | 1098 | continue; |
1112 | tshort); | 1099 | } |
1113 | continue; | 1100 | rio_dprintk(RIO_DEBUG_PROBE, "cp1\n"); |
1114 | } | 1101 | |
1115 | rio_dprintk (RIO_DEBUG_PROBE, "cp1\n"); | 1102 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); |
1116 | 1103 | ||
1117 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); | 1104 | hp = &p->RIOHosts[p->RIONumHosts]; |
1118 | 1105 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; | |
1119 | hp = &p->RIOHosts[p->RIONumHosts]; | 1106 | hp->Ivec = pdev->irq; |
1120 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; | 1107 | if (((1 << hp->Ivec) & rio_irqmask) == 0) |
1121 | hp->Ivec = pdev->irq; | 1108 | hp->Ivec = 0; |
1122 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | 1109 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1123 | hp->Ivec = 0; | 1110 | hp->CardP = (struct DpRam *) hp->Caddr; |
1124 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1111 | hp->Type = RIO_PCI; |
1125 | hp->CardP = (struct DpRam *) hp->Caddr; | 1112 | hp->Copy = rio_pcicopy; |
1126 | hp->Type = RIO_PCI; | 1113 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
1127 | hp->Copy = rio_pcicopy; | 1114 | spin_lock_init(&hp->HostLock); |
1128 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1115 | rio_reset_interrupt(hp); |
1129 | spin_lock_init(&hp->HostLock); | 1116 | rio_start_card_running(hp); |
1130 | rio_reset_interrupt (hp); | 1117 | |
1131 | rio_start_card_running (hp); | 1118 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); |
1132 | 1119 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { | |
1133 | rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", | 1120 | rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); |
1134 | (void *)p->RIOHosts[p->RIONumHosts].PaddrP, | 1121 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); |
1135 | p->RIOHosts[p->RIONumHosts].Caddr); | 1122 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
1136 | if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP, | 1123 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | |
1137 | p->RIOHosts[p->RIONumHosts].Caddr, | 1124 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1138 | RIO_PCI, 0 ) == RIO_SUCCESS) { | 1125 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1139 | rio_dprintk (RIO_DEBUG_INIT, "Done RIOBoardTest\n"); | 1126 | |
1140 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | 1127 | fix_rio_pci(pdev); |
1141 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 1128 | p->RIOLastPCISearch = RIO_SUCCESS; |
1142 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)| | 1129 | p->RIONumHosts++; |
1143 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)| | 1130 | found++; |
1144 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)| | 1131 | } else { |
1145 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24); | 1132 | iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr)); |
1146 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", | 1133 | } |
1147 | p->RIOHosts[p->RIONumHosts].UniqueNum); | 1134 | } |
1148 | 1135 | ||
1149 | fix_rio_pci (pdev); | 1136 | /* Then look for the older PCI card.... : */ |
1150 | p->RIOLastPCISearch = RIO_SUCCESS; | 1137 | |
1151 | p->RIONumHosts++; | 1138 | /* These older PCI cards have problems (only byte-mode access is |
1152 | found++; | 1139 | supported), which makes them a bit awkward to support. |
1153 | } else { | 1140 | They also have problems sharing interrupts. Be careful. |
1154 | iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); | 1141 | (The driver now refuses to share interrupts for these |
1155 | } | 1142 | cards. This should be sufficient). |
1156 | } | 1143 | */ |
1157 | 1144 | ||
1158 | /* Then look for the older PCI card.... : */ | 1145 | /* Then look for the older RIO/PCI devices: */ |
1159 | 1146 | while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) { | |
1160 | /* These older PCI cards have problems (only byte-mode access is | 1147 | if (pci_enable_device(pdev)) |
1161 | supported), which makes them a bit awkward to support. | 1148 | continue; |
1162 | They also have problems sharing interrupts. Be careful. | ||
1163 | (The driver now refuses to share interrupts for these | ||
1164 | cards. This should be sufficient). | ||
1165 | */ | ||
1166 | |||
1167 | /* Then look for the older RIO/PCI devices: */ | ||
1168 | while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX, | ||
1169 | PCI_DEVICE_ID_SPECIALIX_RIO, | ||
1170 | pdev))) { | ||
1171 | if (pci_enable_device(pdev)) continue; | ||
1172 | 1149 | ||
1173 | #ifdef CONFIG_RIO_OLDPCI | 1150 | #ifdef CONFIG_RIO_OLDPCI |
1174 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); | 1151 | pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); |
1175 | 1152 | ||
1176 | hp = &p->RIOHosts[p->RIONumHosts]; | 1153 | hp = &p->RIOHosts[p->RIONumHosts]; |
1177 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; | 1154 | hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; |
1178 | hp->Ivec = pdev->irq; | 1155 | hp->Ivec = pdev->irq; |
1179 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | 1156 | if (((1 << hp->Ivec) & rio_irqmask) == 0) |
1180 | hp->Ivec = 0; | 1157 | hp->Ivec = 0; |
1181 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ | 1158 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ |
1182 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1159 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1183 | hp->CardP = (struct DpRam *) hp->Caddr; | 1160 | hp->CardP = (struct DpRam *) hp->Caddr; |
1184 | hp->Type = RIO_PCI; | 1161 | hp->Type = RIO_PCI; |
1185 | hp->Copy = rio_pcicopy; | 1162 | hp->Copy = rio_pcicopy; |
1186 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1163 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
1187 | spin_lock_init(&hp->HostLock); | 1164 | spin_lock_init(&hp->HostLock); |
1188 | 1165 | ||
1189 | rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); | 1166 | rio_dprintk(RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec); |
1190 | rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); | 1167 | rio_dprintk(RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode); |
1191 | 1168 | ||
1192 | rio_reset_interrupt (hp); | 1169 | rio_reset_interrupt(hp); |
1193 | rio_start_card_running (hp); | 1170 | rio_start_card_running(hp); |
1194 | rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", | 1171 | rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); |
1195 | (void *)p->RIOHosts[p->RIONumHosts].PaddrP, | 1172 | if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { |
1196 | p->RIOHosts[p->RIONumHosts].Caddr); | 1173 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); |
1197 | if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP, | 1174 | p->RIOHosts[p->RIONumHosts].UniqueNum = |
1198 | p->RIOHosts[p->RIONumHosts].Caddr, | 1175 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | |
1199 | RIO_PCI, 0 ) == RIO_SUCCESS) { | 1176 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1200 | WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); | 1177 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1201 | p->RIOHosts[p->RIONumHosts].UniqueNum = | 1178 | |
1202 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)| | 1179 | p->RIOLastPCISearch = RIO_SUCCESS; |
1203 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)| | 1180 | p->RIONumHosts++; |
1204 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)| | 1181 | found++; |
1205 | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24); | 1182 | } else { |
1206 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", | 1183 | iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr)); |
1207 | p->RIOHosts[p->RIONumHosts].UniqueNum); | 1184 | } |
1208 | |||
1209 | p->RIOLastPCISearch = RIO_SUCCESS; | ||
1210 | p->RIONumHosts++; | ||
1211 | found++; | ||
1212 | } else { | ||
1213 | iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); | ||
1214 | } | ||
1215 | #else | 1185 | #else |
1216 | printk (KERN_ERR "Found an older RIO PCI card, but the driver is not " | 1186 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); |
1217 | "compiled to support it.\n"); | ||
1218 | #endif | 1187 | #endif |
1219 | } | 1188 | } |
1220 | #endif /* PCI */ | 1189 | #endif /* PCI */ |
1221 | 1190 | ||
1222 | /* Now probe for ISA cards... */ | 1191 | /* Now probe for ISA cards... */ |
1223 | for (i=0;i<NR_RIO_ADDRS;i++) { | 1192 | for (i = 0; i < NR_RIO_ADDRS; i++) { |
1224 | hp = &p->RIOHosts[p->RIONumHosts]; | 1193 | hp = &p->RIOHosts[p->RIONumHosts]; |
1225 | hp->PaddrP = rio_probe_addrs[i]; | 1194 | hp->PaddrP = rio_probe_addrs[i]; |
1226 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ | 1195 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ |
1227 | hp->Ivec = 0; | 1196 | hp->Ivec = 0; |
1228 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1197 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1229 | hp->CardP = (struct DpRam *) hp->Caddr; | 1198 | hp->CardP = (struct DpRam *) hp->Caddr; |
1230 | hp->Type = RIO_AT; | 1199 | hp->Type = RIO_AT; |
1231 | hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL | 1200 | hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL |
1232 | * -- YES! this is now a normal copy. Only the | 1201 | * -- YES! this is now a normal copy. Only the |
1233 | * old PCI card uses the special PCI copy. | 1202 | * old PCI card uses the special PCI copy. |
1234 | * Moreover, the ISA card will work with the | 1203 | * Moreover, the ISA card will work with the |
1235 | * special PCI copy anyway. -- REW */ | 1204 | * special PCI copy anyway. -- REW */ |
1236 | hp->Mode = 0; | 1205 | hp->Mode = 0; |
1237 | spin_lock_init(&hp->HostLock); | 1206 | spin_lock_init(&hp->HostLock); |
1238 | 1207 | ||
1239 | vpdp = get_VPD_PROM (hp); | 1208 | vpdp = get_VPD_PROM(hp); |
1240 | rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n"); | 1209 | rio_dprintk(RIO_DEBUG_PROBE, "Got VPD ROM\n"); |
1241 | okboard = 0; | 1210 | okboard = 0; |
1242 | if ((strncmp (vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || | 1211 | if ((strncmp(vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) { |
1243 | (strncmp (vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || | 1212 | /* Board is present... */ |
1244 | (strncmp (vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) { | 1213 | if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) { |
1245 | /* Board is present... */ | 1214 | /* ... and feeling fine!!!! */ |
1246 | if (RIOBoardTest (hp->PaddrP, | 1215 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1247 | hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) { | 1216 | if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { |
1248 | /* ... and feeling fine!!!! */ | 1217 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", p->RIONumHosts, p->RIOHosts[p->RIONumHosts - 1].UniqueNum); |
1249 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", | 1218 | okboard++; |
1250 | p->RIOHosts[p->RIONumHosts].UniqueNum); | 1219 | found++; |
1251 | if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { | 1220 | } |
1252 | rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", | 1221 | } |
1253 | p->RIONumHosts, | 1222 | |
1254 | p->RIOHosts[p->RIONumHosts-1].UniqueNum); | 1223 | if (!okboard) |
1255 | okboard++; | 1224 | iounmap((char *) (hp->Caddr)); |
1256 | found++; | 1225 | } |
1257 | } | 1226 | } |
1258 | } | 1227 | |
1259 | 1228 | ||
1260 | if (!okboard) | 1229 | for (i = 0; i < p->RIONumHosts; i++) { |
1261 | iounmap ((char*) (hp->Caddr)); | 1230 | hp = &p->RIOHosts[i]; |
1262 | } | 1231 | if (hp->Ivec) { |
1263 | } | 1232 | int mode = SA_SHIRQ; |
1264 | 1233 | if (hp->Ivec & 0x8000) { | |
1265 | 1234 | mode = 0; | |
1266 | for (i=0;i<p->RIONumHosts;i++) { | 1235 | hp->Ivec &= 0x7fff; |
1267 | hp = &p->RIOHosts[i]; | 1236 | } |
1268 | if (hp->Ivec) { | 1237 | rio_dprintk(RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp, hp->Ivec, hp->Mode); |
1269 | int mode = SA_SHIRQ; | 1238 | retval = request_irq(hp->Ivec, rio_interrupt, mode, "rio", hp); |
1270 | if (hp->Ivec & 0x8000) {mode = 0; hp->Ivec &= 0x7fff;} | 1239 | rio_dprintk(RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval); |
1271 | rio_dprintk (RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp,hp->Ivec, hp->Mode); | 1240 | if (retval) { |
1272 | retval = request_irq (hp->Ivec, rio_interrupt, mode, "rio", hp); | 1241 | printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec); |
1273 | rio_dprintk (RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval); | 1242 | hp->Ivec = 0; |
1274 | if (retval) { | 1243 | } |
1275 | printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec); | 1244 | rio_dprintk(RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec); |
1276 | hp->Ivec = 0; | 1245 | if (hp->Ivec != 0) { |
1277 | } | 1246 | rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); |
1278 | rio_dprintk (RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec); | 1247 | hp->Mode |= RIO_PCI_INT_ENABLE; |
1279 | if (hp->Ivec != 0){ | 1248 | } else |
1280 | rio_dprintk (RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); | 1249 | hp->Mode &= !RIO_PCI_INT_ENABLE; |
1281 | hp->Mode |= RIO_PCI_INT_ENABLE; | 1250 | rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); |
1282 | } else | 1251 | rio_start_card_running(hp); |
1283 | hp->Mode &= !RIO_PCI_INT_ENABLE; | 1252 | } |
1284 | rio_dprintk (RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode); | 1253 | /* Init the timer "always" to make sure that it can safely be |
1285 | rio_start_card_running (hp); | 1254 | deleted when we unload... */ |
1286 | } | 1255 | |
1287 | /* Init the timer "always" to make sure that it can safely be | 1256 | init_timer(&hp->timer); |
1288 | deleted when we unload... */ | 1257 | if (!hp->Ivec) { |
1289 | 1258 | rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll); | |
1290 | init_timer (&hp->timer); | 1259 | hp->timer.data = i; |
1291 | if (!hp->Ivec) { | 1260 | hp->timer.function = rio_pollfunc; |
1292 | rio_dprintk (RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", | 1261 | hp->timer.expires = jiffies + rio_poll; |
1293 | rio_poll); | 1262 | add_timer(&hp->timer); |
1294 | hp->timer.data = i; | 1263 | } |
1295 | hp->timer.function = rio_pollfunc; | 1264 | } |
1296 | hp->timer.expires = jiffies + rio_poll; | 1265 | |
1297 | add_timer (&hp->timer); | 1266 | if (found) { |
1298 | } | 1267 | rio_dprintk(RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); |
1299 | } | 1268 | rio_init_drivers(); |
1300 | 1269 | } else { | |
1301 | if (found) { | 1270 | /* deregister the misc device we created earlier */ |
1302 | rio_dprintk (RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found); | 1271 | misc_deregister(&rio_fw_device); |
1303 | rio_init_drivers (); | 1272 | } |
1304 | } else { | 1273 | |
1305 | /* deregister the misc device we created earlier */ | 1274 | func_exit(); |
1306 | misc_deregister(&rio_fw_device); | 1275 | return found ? 0 : -EIO; |
1307 | } | ||
1308 | |||
1309 | func_exit(); | ||
1310 | return found?0:-EIO; | ||
1311 | } | 1276 | } |
1312 | 1277 | ||
1313 | 1278 | ||
1314 | static void __exit rio_exit (void) | 1279 | static void __exit rio_exit(void) |
1315 | { | 1280 | { |
1316 | int i; | 1281 | int i; |
1317 | struct Host *hp; | 1282 | struct Host *hp; |
1318 | 1283 | ||
1319 | func_enter(); | 1284 | func_enter(); |
1320 | 1285 | ||
1321 | for (i=0,hp=p->RIOHosts;i<p->RIONumHosts;i++, hp++) { | 1286 | for (i = 0, hp = p->RIOHosts; i < p->RIONumHosts; i++, hp++) { |
1322 | RIOHostReset (hp->Type, hp->CardP, hp->Slot); | 1287 | RIOHostReset(hp->Type, hp->CardP, hp->Slot); |
1323 | if (hp->Ivec) { | 1288 | if (hp->Ivec) { |
1324 | free_irq (hp->Ivec, hp); | 1289 | free_irq(hp->Ivec, hp); |
1325 | rio_dprintk (RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); | 1290 | rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec); |
1326 | } | 1291 | } |
1327 | /* It is safe/allowed to del_timer a non-active timer */ | 1292 | /* It is safe/allowed to del_timer a non-active timer */ |
1328 | del_timer (&hp->timer); | 1293 | del_timer(&hp->timer); |
1329 | } | 1294 | } |
1330 | 1295 | ||
1331 | if (misc_deregister(&rio_fw_device) < 0) { | 1296 | if (misc_deregister(&rio_fw_device) < 0) { |
1332 | printk (KERN_INFO "rio: couldn't deregister control-device\n"); | 1297 | printk(KERN_INFO "rio: couldn't deregister control-device\n"); |
1333 | } | 1298 | } |
1334 | 1299 | ||
1335 | 1300 | ||
1336 | rio_dprintk (RIO_DEBUG_CLEANUP, "Cleaning up drivers\n"); | 1301 | rio_dprintk(RIO_DEBUG_CLEANUP, "Cleaning up drivers\n"); |
1337 | 1302 | ||
1338 | rio_release_drivers (); | 1303 | rio_release_drivers(); |
1339 | 1304 | ||
1340 | /* Release dynamically allocated memory */ | 1305 | /* Release dynamically allocated memory */ |
1341 | kfree (p->RIOPortp); | 1306 | kfree(p->RIOPortp); |
1342 | kfree (p->RIOHosts); | 1307 | kfree(p->RIOHosts); |
1343 | kfree (p); | 1308 | kfree(p); |
1344 | 1309 | ||
1345 | func_exit(); | 1310 | func_exit(); |
1346 | } | 1311 | } |
1347 | 1312 | ||
1348 | module_init(rio_init); | 1313 | module_init(rio_init); |
@@ -1368,4 +1333,3 @@ module_exit(rio_exit); | |||
1368 | * tab-width: 8 | 1333 | * tab-width: 8 |
1369 | * End: | 1334 | * End: |
1370 | */ | 1335 | */ |
1371 | |||
diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h index 1fba19d5b66a..4ce77fb1fae5 100644 --- a/drivers/char/rio/rio_linux.h +++ b/drivers/char/rio/rio_linux.h | |||
@@ -37,15 +37,15 @@ | |||
37 | 37 | ||
38 | 38 | ||
39 | struct vpd_prom { | 39 | struct vpd_prom { |
40 | unsigned short id; | 40 | unsigned short id; |
41 | char hwrev; | 41 | char hwrev; |
42 | char hwass; | 42 | char hwass; |
43 | int uniqid; | 43 | int uniqid; |
44 | char myear; | 44 | char myear; |
45 | char mweek; | 45 | char mweek; |
46 | char hw_feature[5]; | 46 | char hw_feature[5]; |
47 | char oem_id; | 47 | char oem_id; |
48 | char identifier[16]; | 48 | char identifier[16]; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | 51 | ||
@@ -75,13 +75,13 @@ struct vpd_prom { | |||
75 | (L_ISIG(tty))) | 75 | (L_ISIG(tty))) |
76 | 76 | ||
77 | 77 | ||
78 | #endif /* __KERNEL__ */ | 78 | #endif /* __KERNEL__ */ |
79 | 79 | ||
80 | 80 | ||
81 | #define RIO_BOARD_INTR_LOCK 1 | 81 | #define RIO_BOARD_INTR_LOCK 1 |
82 | 82 | ||
83 | 83 | ||
84 | #ifndef RIOCTL_MISC_MINOR | 84 | #ifndef RIOCTL_MISC_MINOR |
85 | /* Allow others to gather this into "major.h" or something like that */ | 85 | /* Allow others to gather this into "major.h" or something like that */ |
86 | #define RIOCTL_MISC_MINOR 169 | 86 | #define RIOCTL_MISC_MINOR 169 |
87 | #endif | 87 | #endif |
@@ -121,39 +121,39 @@ struct vpd_prom { | |||
121 | spin_unlock_irqrestore(sem, flags) | 121 | spin_unlock_irqrestore(sem, flags) |
122 | 122 | ||
123 | #define rio_spin_lock(sem) \ | 123 | #define rio_spin_lock(sem) \ |
124 | spin_lock(sem) | 124 | spin_lock(sem) |
125 | 125 | ||
126 | #define rio_spin_unlock(sem) \ | 126 | #define rio_spin_unlock(sem) \ |
127 | spin_unlock(sem) | 127 | spin_unlock(sem) |
128 | 128 | ||
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | #ifdef CONFIG_RIO_OLDPCI | 133 | #ifdef CONFIG_RIO_OLDPCI |
134 | static inline void *rio_memcpy_toio (void *dummy, void *dest, void *source, int n) | 134 | static inline void *rio_memcpy_toio(void *dummy, void *dest, void *source, int n) |
135 | { | 135 | { |
136 | char *dst = dest; | 136 | char *dst = dest; |
137 | char *src = source; | 137 | char *src = source; |
138 | 138 | ||
139 | while (n--) { | 139 | while (n--) { |
140 | writeb (*src++, dst++); | 140 | writeb(*src++, dst++); |
141 | (void) readb (dummy); | 141 | (void) readb(dummy); |
142 | } | 142 | } |
143 | 143 | ||
144 | return dest; | 144 | return dest; |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | static inline void *rio_memcpy_fromio (void *dest, void *source, int n) | 148 | static inline void *rio_memcpy_fromio(void *dest, void *source, int n) |
149 | { | 149 | { |
150 | char *dst = dest; | 150 | char *dst = dest; |
151 | char *src = source; | 151 | char *src = source; |
152 | 152 | ||
153 | while (n--) | 153 | while (n--) |
154 | *dst++ = readb (src++); | 154 | *dst++ = readb(src++); |
155 | 155 | ||
156 | return dest; | 156 | return dest; |
157 | } | 157 | } |
158 | 158 | ||
159 | #else | 159 | #else |
@@ -179,9 +179,8 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n) | |||
179 | #define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __FUNCTION__) | 179 | #define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit %s\n", __FUNCTION__) |
180 | #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line) | 180 | #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line) |
181 | #else | 181 | #else |
182 | #define rio_dprintk(f, str...) /* nothing */ | 182 | #define rio_dprintk(f, str...) /* nothing */ |
183 | #define func_enter() | 183 | #define func_enter() |
184 | #define func_exit() | 184 | #define func_exit() |
185 | #define func_enter2() | 185 | #define func_enter2() |
186 | #endif | 186 | #endif |
187 | |||
diff --git a/drivers/char/rio/rioboard.h b/drivers/char/rio/rioboard.h index cc6ac6a98f65..822c071a693b 100644 --- a/drivers/char/rio/rioboard.h +++ b/drivers/char/rio/rioboard.h | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ | 38 | #ifndef _rioboard_h /* If RIOBOARD.H not already defined */ |
39 | #define _rioboard_h 1 | 39 | #define _rioboard_h 1 |
40 | 40 | ||
41 | /***************************************************************************** | 41 | /***************************************************************************** |
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | /* Hardware Registers... */ | 47 | /* Hardware Registers... */ |
48 | 48 | ||
49 | #define RIO_REG_BASE 0x7C00 /* Base of control registers */ | 49 | #define RIO_REG_BASE 0x7C00 /* Base of control registers */ |
50 | 50 | ||
51 | #define RIO_CONFIG RIO_REG_BASE + 0x0000 /* WRITE: Configuration Register */ | 51 | #define RIO_CONFIG RIO_REG_BASE + 0x0000 /* WRITE: Configuration Register */ |
52 | #define RIO_INTSET RIO_REG_BASE + 0x0080 /* WRITE: Interrupt Set */ | 52 | #define RIO_INTSET RIO_REG_BASE + 0x0080 /* WRITE: Interrupt Set */ |
@@ -58,30 +58,30 @@ | |||
58 | #define RIO_RESETSTAT RIO_REG_BASE + 0x0100 /* READ: Reset Status (Jet boards only) */ | 58 | #define RIO_RESETSTAT RIO_REG_BASE + 0x0100 /* READ: Reset Status (Jet boards only) */ |
59 | 59 | ||
60 | /* RIO_VPD_ROM definitions... */ | 60 | /* RIO_VPD_ROM definitions... */ |
61 | #define VPD_SLX_ID1 0x00 /* READ: Specialix Identifier #1 */ | 61 | #define VPD_SLX_ID1 0x00 /* READ: Specialix Identifier #1 */ |
62 | #define VPD_SLX_ID2 0x01 /* READ: Specialix Identifier #2 */ | 62 | #define VPD_SLX_ID2 0x01 /* READ: Specialix Identifier #2 */ |
63 | #define VPD_HW_REV 0x02 /* READ: Hardware Revision */ | 63 | #define VPD_HW_REV 0x02 /* READ: Hardware Revision */ |
64 | #define VPD_HW_ASSEM 0x03 /* READ: Hardware Assembly Level */ | 64 | #define VPD_HW_ASSEM 0x03 /* READ: Hardware Assembly Level */ |
65 | #define VPD_UNIQUEID4 0x04 /* READ: Unique Identifier #4 */ | 65 | #define VPD_UNIQUEID4 0x04 /* READ: Unique Identifier #4 */ |
66 | #define VPD_UNIQUEID3 0x05 /* READ: Unique Identifier #3 */ | 66 | #define VPD_UNIQUEID3 0x05 /* READ: Unique Identifier #3 */ |
67 | #define VPD_UNIQUEID2 0x06 /* READ: Unique Identifier #2 */ | 67 | #define VPD_UNIQUEID2 0x06 /* READ: Unique Identifier #2 */ |
68 | #define VPD_UNIQUEID1 0x07 /* READ: Unique Identifier #1 */ | 68 | #define VPD_UNIQUEID1 0x07 /* READ: Unique Identifier #1 */ |
69 | #define VPD_MANU_YEAR 0x08 /* READ: Year Of Manufacture (0 = 1970) */ | 69 | #define VPD_MANU_YEAR 0x08 /* READ: Year Of Manufacture (0 = 1970) */ |
70 | #define VPD_MANU_WEEK 0x09 /* READ: Week Of Manufacture (0 = week 1 Jan) */ | 70 | #define VPD_MANU_WEEK 0x09 /* READ: Week Of Manufacture (0 = week 1 Jan) */ |
71 | #define VPD_HWFEATURE1 0x0A /* READ: Hardware Feature Byte 1 */ | 71 | #define VPD_HWFEATURE1 0x0A /* READ: Hardware Feature Byte 1 */ |
72 | #define VPD_HWFEATURE2 0x0B /* READ: Hardware Feature Byte 2 */ | 72 | #define VPD_HWFEATURE2 0x0B /* READ: Hardware Feature Byte 2 */ |
73 | #define VPD_HWFEATURE3 0x0C /* READ: Hardware Feature Byte 3 */ | 73 | #define VPD_HWFEATURE3 0x0C /* READ: Hardware Feature Byte 3 */ |
74 | #define VPD_HWFEATURE4 0x0D /* READ: Hardware Feature Byte 4 */ | 74 | #define VPD_HWFEATURE4 0x0D /* READ: Hardware Feature Byte 4 */ |
75 | #define VPD_HWFEATURE5 0x0E /* READ: Hardware Feature Byte 5 */ | 75 | #define VPD_HWFEATURE5 0x0E /* READ: Hardware Feature Byte 5 */ |
76 | #define VPD_OEMID 0x0F /* READ: OEM Identifier */ | 76 | #define VPD_OEMID 0x0F /* READ: OEM Identifier */ |
77 | #define VPD_IDENT 0x10 /* READ: Identifier string (16 bytes) */ | 77 | #define VPD_IDENT 0x10 /* READ: Identifier string (16 bytes) */ |
78 | #define VPD_IDENT_LEN 0x10 | 78 | #define VPD_IDENT_LEN 0x10 |
79 | 79 | ||
80 | /* VPD ROM Definitions... */ | 80 | /* VPD ROM Definitions... */ |
81 | #define SLX_ID1 0x4D | 81 | #define SLX_ID1 0x4D |
82 | #define SLX_ID2 0x98 | 82 | #define SLX_ID2 0x98 |
83 | 83 | ||
84 | #define PRODUCT_ID(a) ((a>>4)&0xF) /* Use to obtain Product ID from VPD_UNIQUEID1 */ | 84 | #define PRODUCT_ID(a) ((a>>4)&0xF) /* Use to obtain Product ID from VPD_UNIQUEID1 */ |
85 | 85 | ||
86 | #define ID_SX_ISA 0x2 | 86 | #define ID_SX_ISA 0x2 |
87 | #define ID_RIO_EISA 0x3 | 87 | #define ID_RIO_EISA 0x3 |
@@ -101,7 +101,7 @@ | |||
101 | 101 | ||
102 | /* Firmware load position... */ | 102 | /* Firmware load position... */ |
103 | 103 | ||
104 | #define FIRMWARELOADADDR 0x7C00 /* Firmware is loaded _before_ this address */ | 104 | #define FIRMWARELOADADDR 0x7C00 /* Firmware is loaded _before_ this address */ |
105 | 105 | ||
106 | /***************************************************************************** | 106 | /***************************************************************************** |
107 | ***************************** ***************************** | 107 | ***************************** ***************************** |
@@ -112,14 +112,14 @@ | |||
112 | /* Control Register Definitions... */ | 112 | /* Control Register Definitions... */ |
113 | #define RIO_ISA_IDENT "JBJGPGGHINSMJPJR" | 113 | #define RIO_ISA_IDENT "JBJGPGGHINSMJPJR" |
114 | 114 | ||
115 | #define RIO_ISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 115 | #define RIO_ISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
116 | #define RIO_ISA_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 116 | #define RIO_ISA_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
117 | #define RIO_ISA_CFG_IRQMASK 0x30 /* Interrupt mask */ | 117 | #define RIO_ISA_CFG_IRQMASK 0x30 /* Interrupt mask */ |
118 | #define RIO_ISA_CFG_IRQ12 0x10 /* Interrupt Level 12 */ | 118 | #define RIO_ISA_CFG_IRQ12 0x10 /* Interrupt Level 12 */ |
119 | #define RIO_ISA_CFG_IRQ11 0x20 /* Interrupt Level 11 */ | 119 | #define RIO_ISA_CFG_IRQ11 0x20 /* Interrupt Level 11 */ |
120 | #define RIO_ISA_CFG_IRQ9 0x30 /* Interrupt Level 9 */ | 120 | #define RIO_ISA_CFG_IRQ9 0x30 /* Interrupt Level 9 */ |
121 | #define RIO_ISA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 121 | #define RIO_ISA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
122 | #define RIO_ISA_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ | 122 | #define RIO_ISA_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ |
123 | 123 | ||
124 | /***************************************************************************** | 124 | /***************************************************************************** |
125 | ***************************** ***************************** | 125 | ***************************** ***************************** |
@@ -130,17 +130,17 @@ | |||
130 | /* Control Register Definitions... */ | 130 | /* Control Register Definitions... */ |
131 | #define RIO_ISA2_IDENT "JBJGPGGHINSMJPJR" | 131 | #define RIO_ISA2_IDENT "JBJGPGGHINSMJPJR" |
132 | 132 | ||
133 | #define RIO_ISA2_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 133 | #define RIO_ISA2_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
134 | #define RIO_ISA2_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 134 | #define RIO_ISA2_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
135 | #define RIO_ISA2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 135 | #define RIO_ISA2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
136 | #define RIO_ISA2_CFG_16BIT 0x08 /* 16bit mode, else 8bit */ | 136 | #define RIO_ISA2_CFG_16BIT 0x08 /* 16bit mode, else 8bit */ |
137 | #define RIO_ISA2_CFG_IRQMASK 0x30 /* Interrupt mask */ | 137 | #define RIO_ISA2_CFG_IRQMASK 0x30 /* Interrupt mask */ |
138 | #define RIO_ISA2_CFG_IRQ15 0x00 /* Interrupt Level 15 */ | 138 | #define RIO_ISA2_CFG_IRQ15 0x00 /* Interrupt Level 15 */ |
139 | #define RIO_ISA2_CFG_IRQ12 0x10 /* Interrupt Level 12 */ | 139 | #define RIO_ISA2_CFG_IRQ12 0x10 /* Interrupt Level 12 */ |
140 | #define RIO_ISA2_CFG_IRQ11 0x20 /* Interrupt Level 11 */ | 140 | #define RIO_ISA2_CFG_IRQ11 0x20 /* Interrupt Level 11 */ |
141 | #define RIO_ISA2_CFG_IRQ9 0x30 /* Interrupt Level 9 */ | 141 | #define RIO_ISA2_CFG_IRQ9 0x30 /* Interrupt Level 9 */ |
142 | #define RIO_ISA2_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 142 | #define RIO_ISA2_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
143 | #define RIO_ISA2_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ | 143 | #define RIO_ISA2_CFG_WAITSTATE0 0x80 /* 0 waitstates, else 1 */ |
144 | 144 | ||
145 | /***************************************************************************** | 145 | /***************************************************************************** |
146 | ***************************** ****************************** | 146 | ***************************** ****************************** |
@@ -151,14 +151,14 @@ | |||
151 | /* Control Register Definitions... */ | 151 | /* Control Register Definitions... */ |
152 | #define RIO_ISA3_IDENT "JET HOST BY KEV#" | 152 | #define RIO_ISA3_IDENT "JET HOST BY KEV#" |
153 | 153 | ||
154 | #define RIO_ISA3_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 154 | #define RIO_ISA3_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
155 | #define RIO_ISA3_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 155 | #define RIO_ISA3_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
156 | #define RIO_ISA32_CFG_IRQMASK 0xF30 /* Interrupt mask */ | 156 | #define RIO_ISA32_CFG_IRQMASK 0xF30 /* Interrupt mask */ |
157 | #define RIO_ISA3_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ | 157 | #define RIO_ISA3_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ |
158 | #define RIO_ISA3_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ | 158 | #define RIO_ISA3_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ |
159 | #define RIO_ISA3_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ | 159 | #define RIO_ISA3_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ |
160 | #define RIO_ISA3_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ | 160 | #define RIO_ISA3_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ |
161 | #define RIO_ISA3_CFG_IRQ9 0x90 /* Interrupt Level 9 */ | 161 | #define RIO_ISA3_CFG_IRQ9 0x90 /* Interrupt Level 9 */ |
162 | 162 | ||
163 | /***************************************************************************** | 163 | /***************************************************************************** |
164 | ********************************* ******************************** | 164 | ********************************* ******************************** |
@@ -169,9 +169,9 @@ | |||
169 | /* Control Register Definitions... */ | 169 | /* Control Register Definitions... */ |
170 | #define RIO_MCA_IDENT "JBJGPGGHINSMJPJR" | 170 | #define RIO_MCA_IDENT "JBJGPGGHINSMJPJR" |
171 | 171 | ||
172 | #define RIO_MCA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 172 | #define RIO_MCA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
173 | #define RIO_MCA_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 173 | #define RIO_MCA_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
174 | #define RIO_MCA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 174 | #define RIO_MCA_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
175 | 175 | ||
176 | /***************************************************************************** | 176 | /***************************************************************************** |
177 | ******************************** ******************************** | 177 | ******************************** ******************************** |
@@ -185,35 +185,35 @@ | |||
185 | #define EISA_PRODUCT_NUMBER 0xC82 | 185 | #define EISA_PRODUCT_NUMBER 0xC82 |
186 | #define EISA_REVISION_NUMBER 0xC83 | 186 | #define EISA_REVISION_NUMBER 0xC83 |
187 | #define EISA_CARD_ENABLE 0xC84 | 187 | #define EISA_CARD_ENABLE 0xC84 |
188 | #define EISA_VPD_UNIQUEID4 0xC88 /* READ: Unique Identifier #4 */ | 188 | #define EISA_VPD_UNIQUEID4 0xC88 /* READ: Unique Identifier #4 */ |
189 | #define EISA_VPD_UNIQUEID3 0xC8A /* READ: Unique Identifier #3 */ | 189 | #define EISA_VPD_UNIQUEID3 0xC8A /* READ: Unique Identifier #3 */ |
190 | #define EISA_VPD_UNIQUEID2 0xC90 /* READ: Unique Identifier #2 */ | 190 | #define EISA_VPD_UNIQUEID2 0xC90 /* READ: Unique Identifier #2 */ |
191 | #define EISA_VPD_UNIQUEID1 0xC92 /* READ: Unique Identifier #1 */ | 191 | #define EISA_VPD_UNIQUEID1 0xC92 /* READ: Unique Identifier #1 */ |
192 | #define EISA_VPD_MANU_YEAR 0xC98 /* READ: Year Of Manufacture (0 = 1970) */ | 192 | #define EISA_VPD_MANU_YEAR 0xC98 /* READ: Year Of Manufacture (0 = 1970) */ |
193 | #define EISA_VPD_MANU_WEEK 0xC9A /* READ: Week Of Manufacture (0 = week 1 Jan) */ | 193 | #define EISA_VPD_MANU_WEEK 0xC9A /* READ: Week Of Manufacture (0 = week 1 Jan) */ |
194 | #define EISA_MEM_ADDR_23_16 0xC00 | 194 | #define EISA_MEM_ADDR_23_16 0xC00 |
195 | #define EISA_MEM_ADDR_31_24 0xC01 | 195 | #define EISA_MEM_ADDR_31_24 0xC01 |
196 | #define EISA_RIO_CONFIG 0xC02 /* WRITE: Configuration Register */ | 196 | #define EISA_RIO_CONFIG 0xC02 /* WRITE: Configuration Register */ |
197 | #define EISA_RIO_INTSET 0xC03 /* WRITE: Interrupt Set */ | 197 | #define EISA_RIO_INTSET 0xC03 /* WRITE: Interrupt Set */ |
198 | #define EISA_RIO_INTRESET 0xC03 /* READ: Interrupt Reset */ | 198 | #define EISA_RIO_INTRESET 0xC03 /* READ: Interrupt Reset */ |
199 | 199 | ||
200 | /* Control Register Definitions... */ | 200 | /* Control Register Definitions... */ |
201 | #define RIO_EISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 201 | #define RIO_EISA_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
202 | #define RIO_EISA_CFG_LINK20 0x02 /* 20Mbps link, else 10Mbps */ | 202 | #define RIO_EISA_CFG_LINK20 0x02 /* 20Mbps link, else 10Mbps */ |
203 | #define RIO_EISA_CFG_BUSENABLE 0x04 /* Enable processor bus */ | 203 | #define RIO_EISA_CFG_BUSENABLE 0x04 /* Enable processor bus */ |
204 | #define RIO_EISA_CFG_PROCRUN 0x08 /* Processor running, else reset */ | 204 | #define RIO_EISA_CFG_PROCRUN 0x08 /* Processor running, else reset */ |
205 | #define RIO_EISA_CFG_IRQMASK 0xF0 /* Interrupt mask */ | 205 | #define RIO_EISA_CFG_IRQMASK 0xF0 /* Interrupt mask */ |
206 | #define RIO_EISA_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ | 206 | #define RIO_EISA_CFG_IRQ15 0xF0 /* Interrupt Level 15 */ |
207 | #define RIO_EISA_CFG_IRQ14 0xE0 /* Interrupt Level 14 */ | 207 | #define RIO_EISA_CFG_IRQ14 0xE0 /* Interrupt Level 14 */ |
208 | #define RIO_EISA_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ | 208 | #define RIO_EISA_CFG_IRQ12 0xC0 /* Interrupt Level 12 */ |
209 | #define RIO_EISA_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ | 209 | #define RIO_EISA_CFG_IRQ11 0xB0 /* Interrupt Level 11 */ |
210 | #define RIO_EISA_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ | 210 | #define RIO_EISA_CFG_IRQ10 0xA0 /* Interrupt Level 10 */ |
211 | #define RIO_EISA_CFG_IRQ9 0x90 /* Interrupt Level 9 */ | 211 | #define RIO_EISA_CFG_IRQ9 0x90 /* Interrupt Level 9 */ |
212 | #define RIO_EISA_CFG_IRQ7 0x70 /* Interrupt Level 7 */ | 212 | #define RIO_EISA_CFG_IRQ7 0x70 /* Interrupt Level 7 */ |
213 | #define RIO_EISA_CFG_IRQ6 0x60 /* Interrupt Level 6 */ | 213 | #define RIO_EISA_CFG_IRQ6 0x60 /* Interrupt Level 6 */ |
214 | #define RIO_EISA_CFG_IRQ5 0x50 /* Interrupt Level 5 */ | 214 | #define RIO_EISA_CFG_IRQ5 0x50 /* Interrupt Level 5 */ |
215 | #define RIO_EISA_CFG_IRQ4 0x40 /* Interrupt Level 4 */ | 215 | #define RIO_EISA_CFG_IRQ4 0x40 /* Interrupt Level 4 */ |
216 | #define RIO_EISA_CFG_IRQ3 0x30 /* Interrupt Level 3 */ | 216 | #define RIO_EISA_CFG_IRQ3 0x30 /* Interrupt Level 3 */ |
217 | 217 | ||
218 | /***************************************************************************** | 218 | /***************************************************************************** |
219 | ******************************** ******************************** | 219 | ******************************** ******************************** |
@@ -224,20 +224,20 @@ | |||
224 | /* Control Register Definitions... */ | 224 | /* Control Register Definitions... */ |
225 | #define RIO_SBUS_IDENT "JBPGK#\0\0\0\0\0\0\0\0\0\0" | 225 | #define RIO_SBUS_IDENT "JBPGK#\0\0\0\0\0\0\0\0\0\0" |
226 | 226 | ||
227 | #define RIO_SBUS_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 227 | #define RIO_SBUS_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
228 | #define RIO_SBUS_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 228 | #define RIO_SBUS_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
229 | #define RIO_SBUS_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 229 | #define RIO_SBUS_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
230 | #define RIO_SBUS_CFG_IRQMASK 0x38 /* Interrupt mask */ | 230 | #define RIO_SBUS_CFG_IRQMASK 0x38 /* Interrupt mask */ |
231 | #define RIO_SBUS_CFG_IRQNONE 0x00 /* No Interrupt */ | 231 | #define RIO_SBUS_CFG_IRQNONE 0x00 /* No Interrupt */ |
232 | #define RIO_SBUS_CFG_IRQ7 0x38 /* Interrupt Level 7 */ | 232 | #define RIO_SBUS_CFG_IRQ7 0x38 /* Interrupt Level 7 */ |
233 | #define RIO_SBUS_CFG_IRQ6 0x30 /* Interrupt Level 6 */ | 233 | #define RIO_SBUS_CFG_IRQ6 0x30 /* Interrupt Level 6 */ |
234 | #define RIO_SBUS_CFG_IRQ5 0x28 /* Interrupt Level 5 */ | 234 | #define RIO_SBUS_CFG_IRQ5 0x28 /* Interrupt Level 5 */ |
235 | #define RIO_SBUS_CFG_IRQ4 0x20 /* Interrupt Level 4 */ | 235 | #define RIO_SBUS_CFG_IRQ4 0x20 /* Interrupt Level 4 */ |
236 | #define RIO_SBUS_CFG_IRQ3 0x18 /* Interrupt Level 3 */ | 236 | #define RIO_SBUS_CFG_IRQ3 0x18 /* Interrupt Level 3 */ |
237 | #define RIO_SBUS_CFG_IRQ2 0x10 /* Interrupt Level 2 */ | 237 | #define RIO_SBUS_CFG_IRQ2 0x10 /* Interrupt Level 2 */ |
238 | #define RIO_SBUS_CFG_IRQ1 0x08 /* Interrupt Level 1 */ | 238 | #define RIO_SBUS_CFG_IRQ1 0x08 /* Interrupt Level 1 */ |
239 | #define RIO_SBUS_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 239 | #define RIO_SBUS_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
240 | #define RIO_SBUS_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ | 240 | #define RIO_SBUS_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ |
241 | 241 | ||
242 | /***************************************************************************** | 242 | /***************************************************************************** |
243 | ********************************* ******************************** | 243 | ********************************* ******************************** |
@@ -248,18 +248,18 @@ | |||
248 | /* Control Register Definitions... */ | 248 | /* Control Register Definitions... */ |
249 | #define RIO_PCI_IDENT "ECDDPGJGJHJRGSK#" | 249 | #define RIO_PCI_IDENT "ECDDPGJGJHJRGSK#" |
250 | 250 | ||
251 | #define RIO_PCI_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ | 251 | #define RIO_PCI_CFG_BOOTRAM 0x01 /* Boot from RAM, else Link */ |
252 | #define RIO_PCI_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 252 | #define RIO_PCI_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
253 | #define RIO_PCI_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 253 | #define RIO_PCI_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
254 | #define RIO_PCI_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ | 254 | #define RIO_PCI_CFG_LINK20 0x40 /* 20Mbps link, else 10Mbps */ |
255 | #define RIO_PCI_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ | 255 | #define RIO_PCI_CFG_PROC25 0x80 /* 25Mhz processor clock, else 20Mhz */ |
256 | 256 | ||
257 | /* PCI Definitions... */ | 257 | /* PCI Definitions... */ |
258 | #define SPX_VENDOR_ID 0x11CB /* Assigned by the PCI SIG */ | 258 | #define SPX_VENDOR_ID 0x11CB /* Assigned by the PCI SIG */ |
259 | #define SPX_DEVICE_ID 0x8000 /* RIO bridge boards */ | 259 | #define SPX_DEVICE_ID 0x8000 /* RIO bridge boards */ |
260 | #define SPX_PLXDEVICE_ID 0x2000 /* PLX bridge boards */ | 260 | #define SPX_PLXDEVICE_ID 0x2000 /* PLX bridge boards */ |
261 | #define SPX_SUB_VENDOR_ID SPX_VENDOR_ID /* Same as vendor id */ | 261 | #define SPX_SUB_VENDOR_ID SPX_VENDOR_ID /* Same as vendor id */ |
262 | #define RIO_SUB_SYS_ID 0x0800 /* RIO PCI board */ | 262 | #define RIO_SUB_SYS_ID 0x0800 /* RIO PCI board */ |
263 | 263 | ||
264 | /***************************************************************************** | 264 | /***************************************************************************** |
265 | ***************************** ****************************** | 265 | ***************************** ****************************** |
@@ -270,11 +270,11 @@ | |||
270 | /* Control Register Definitions... */ | 270 | /* Control Register Definitions... */ |
271 | #define RIO_PCI2_IDENT "JET HOST BY KEV#" | 271 | #define RIO_PCI2_IDENT "JET HOST BY KEV#" |
272 | 272 | ||
273 | #define RIO_PCI2_CFG_BUSENABLE 0x02 /* Enable processor bus */ | 273 | #define RIO_PCI2_CFG_BUSENABLE 0x02 /* Enable processor bus */ |
274 | #define RIO_PCI2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ | 274 | #define RIO_PCI2_CFG_INTENABLE 0x04 /* Interrupt enable, else disable */ |
275 | 275 | ||
276 | /* PCI Definitions... */ | 276 | /* PCI Definitions... */ |
277 | #define RIO2_SUB_SYS_ID 0x0100 /* RIO (Jet) PCI board */ | 277 | #define RIO2_SUB_SYS_ID 0x0100 /* RIO (Jet) PCI board */ |
278 | 278 | ||
279 | #endif /*_rioboard_h */ | 279 | #endif /*_rioboard_h */ |
280 | 280 | ||
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 533085ec6f1b..b97dd9fdb6ba 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -83,102 +83,98 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; | |||
83 | static struct IdentifyRta IdRta; | 83 | static struct IdentifyRta IdRta; |
84 | static struct KillNeighbour KillUnit; | 84 | static struct KillNeighbour KillUnit; |
85 | 85 | ||
86 | int | 86 | int RIOFoadRta(struct Host *HostP, struct Map *MapP) |
87 | RIOFoadRta(struct Host *HostP, struct Map *MapP) | ||
88 | { | 87 | { |
89 | struct CmdBlk *CmdBlkP; | 88 | struct CmdBlk *CmdBlkP; |
90 | 89 | ||
91 | rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA\n"); | 90 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n"); |
92 | 91 | ||
93 | CmdBlkP = RIOGetCmdBlk(); | 92 | CmdBlkP = RIOGetCmdBlk(); |
94 | 93 | ||
95 | if ( !CmdBlkP ) { | 94 | if (!CmdBlkP) { |
96 | rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); | 95 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); |
97 | return -ENXIO; | 96 | return -ENXIO; |
98 | } | 97 | } |
99 | 98 | ||
100 | CmdBlkP->Packet.dest_unit = MapP->ID; | 99 | CmdBlkP->Packet.dest_unit = MapP->ID; |
101 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 100 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
102 | CmdBlkP->Packet.src_unit = 0; | 101 | CmdBlkP->Packet.src_unit = 0; |
103 | CmdBlkP->Packet.src_port = BOOT_RUP; | 102 | CmdBlkP->Packet.src_port = BOOT_RUP; |
104 | CmdBlkP->Packet.len = 0x84; | 103 | CmdBlkP->Packet.len = 0x84; |
105 | CmdBlkP->Packet.data[0] = IFOAD; | 104 | CmdBlkP->Packet.data[0] = IFOAD; |
106 | CmdBlkP->Packet.data[1] = 0; | 105 | CmdBlkP->Packet.data[1] = 0; |
107 | CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; | 106 | CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF; |
108 | CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; | 107 | CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; |
109 | 108 | ||
110 | if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { | 109 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { |
111 | rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); | 110 | rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); |
112 | return -EIO; | 111 | return -EIO; |
113 | } | 112 | } |
114 | return 0; | 113 | return 0; |
115 | } | 114 | } |
116 | 115 | ||
117 | int | 116 | int RIOZombieRta(struct Host *HostP, struct Map *MapP) |
118 | RIOZombieRta(struct Host *HostP, struct Map *MapP) | ||
119 | { | 117 | { |
120 | struct CmdBlk *CmdBlkP; | 118 | struct CmdBlk *CmdBlkP; |
121 | 119 | ||
122 | rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA\n"); | 120 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n"); |
123 | 121 | ||
124 | CmdBlkP = RIOGetCmdBlk(); | 122 | CmdBlkP = RIOGetCmdBlk(); |
125 | 123 | ||
126 | if ( !CmdBlkP ) { | 124 | if (!CmdBlkP) { |
127 | rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); | 125 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); |
128 | return -ENXIO; | 126 | return -ENXIO; |
129 | } | 127 | } |
130 | 128 | ||
131 | CmdBlkP->Packet.dest_unit = MapP->ID; | 129 | CmdBlkP->Packet.dest_unit = MapP->ID; |
132 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 130 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
133 | CmdBlkP->Packet.src_unit = 0; | 131 | CmdBlkP->Packet.src_unit = 0; |
134 | CmdBlkP->Packet.src_port = BOOT_RUP; | 132 | CmdBlkP->Packet.src_port = BOOT_RUP; |
135 | CmdBlkP->Packet.len = 0x84; | 133 | CmdBlkP->Packet.len = 0x84; |
136 | CmdBlkP->Packet.data[0] = ZOMBIE; | 134 | CmdBlkP->Packet.data[0] = ZOMBIE; |
137 | CmdBlkP->Packet.data[1] = 0; | 135 | CmdBlkP->Packet.data[1] = 0; |
138 | CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; | 136 | CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF; |
139 | CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; | 137 | CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; |
140 | 138 | ||
141 | if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { | 139 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { |
142 | rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); | 140 | rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); |
143 | return -EIO; | 141 | return -EIO; |
144 | } | 142 | } |
145 | return 0; | 143 | return 0; |
146 | } | 144 | } |
147 | 145 | ||
148 | int | 146 | int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) |
149 | RIOCommandRta(struct rio_info *p, uint RtaUnique, | ||
150 | int (* func)(struct Host *HostP, struct Map *MapP)) | ||
151 | { | 147 | { |
152 | uint Host; | 148 | uint Host; |
153 | 149 | ||
154 | rio_dprintk (RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int)func); | 150 | rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func); |
155 | 151 | ||
156 | if ( !RtaUnique ) | 152 | if (!RtaUnique) |
157 | return(0); | 153 | return (0); |
158 | 154 | ||
159 | for ( Host = 0; Host < p->RIONumHosts; Host++ ) { | 155 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
160 | uint Rta; | 156 | uint Rta; |
161 | struct Host *HostP = &p->RIOHosts[Host]; | 157 | struct Host *HostP = &p->RIOHosts[Host]; |
162 | 158 | ||
163 | for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { | 159 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { |
164 | struct Map *MapP = &HostP->Mapping[Rta]; | 160 | struct Map *MapP = &HostP->Mapping[Rta]; |
165 | 161 | ||
166 | if ( MapP->RtaUniqueNum == RtaUnique ) { | 162 | if (MapP->RtaUniqueNum == RtaUnique) { |
167 | uint Link; | 163 | uint Link; |
168 | 164 | ||
169 | /* | 165 | /* |
170 | ** now, lets just check we have a route to it... | 166 | ** now, lets just check we have a route to it... |
171 | ** IF the routing stuff is working, then one of the | 167 | ** IF the routing stuff is working, then one of the |
172 | ** topology entries for this unit will have a legit | 168 | ** topology entries for this unit will have a legit |
173 | ** route *somewhere*. We care not where - if its got | 169 | ** route *somewhere*. We care not where - if its got |
174 | ** any connections, we can get to it. | 170 | ** any connections, we can get to it. |
175 | */ | 171 | */ |
176 | for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { | 172 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { |
177 | if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { | 173 | if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { |
178 | /* | 174 | /* |
179 | ** Its worth trying the operation... | 175 | ** Its worth trying the operation... |
180 | */ | 176 | */ |
181 | return (*func)( HostP, MapP ); | 177 | return (*func) (HostP, MapP); |
182 | } | 178 | } |
183 | } | 179 | } |
184 | } | 180 | } |
@@ -188,60 +184,59 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique, | |||
188 | } | 184 | } |
189 | 185 | ||
190 | 186 | ||
191 | int | 187 | int RIOIdentifyRta(struct rio_info *p, caddr_t arg) |
192 | RIOIdentifyRta(struct rio_info *p, caddr_t arg) | ||
193 | { | 188 | { |
194 | uint Host; | 189 | uint Host; |
195 | 190 | ||
196 | if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) { | 191 | if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) { |
197 | rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); | 192 | rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); |
198 | p->RIOError.Error = COPYIN_FAILED; | 193 | p->RIOError.Error = COPYIN_FAILED; |
199 | return -EFAULT; | 194 | return -EFAULT; |
200 | } | 195 | } |
201 | 196 | ||
202 | for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) { | 197 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
203 | uint Rta; | 198 | uint Rta; |
204 | struct Host *HostP = &p->RIOHosts[Host]; | 199 | struct Host *HostP = &p->RIOHosts[Host]; |
205 | 200 | ||
206 | for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) { | 201 | for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { |
207 | struct Map *MapP = &HostP->Mapping[Rta]; | 202 | struct Map *MapP = &HostP->Mapping[Rta]; |
208 | 203 | ||
209 | if ( MapP->RtaUniqueNum == IdRta.RtaUnique ) { | 204 | if (MapP->RtaUniqueNum == IdRta.RtaUnique) { |
210 | uint Link; | 205 | uint Link; |
211 | /* | 206 | /* |
212 | ** now, lets just check we have a route to it... | 207 | ** now, lets just check we have a route to it... |
213 | ** IF the routing stuff is working, then one of the | 208 | ** IF the routing stuff is working, then one of the |
214 | ** topology entries for this unit will have a legit | 209 | ** topology entries for this unit will have a legit |
215 | ** route *somewhere*. We care not where - if its got | 210 | ** route *somewhere*. We care not where - if its got |
216 | ** any connections, we can get to it. | 211 | ** any connections, we can get to it. |
217 | */ | 212 | */ |
218 | for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) { | 213 | for (Link = 0; Link < LINKS_PER_UNIT; Link++) { |
219 | if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) { | 214 | if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { |
220 | /* | 215 | /* |
221 | ** Its worth trying the operation... | 216 | ** Its worth trying the operation... |
222 | */ | 217 | */ |
223 | struct CmdBlk *CmdBlkP; | 218 | struct CmdBlk *CmdBlkP; |
224 | 219 | ||
225 | rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA\n"); | 220 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n"); |
226 | 221 | ||
227 | CmdBlkP = RIOGetCmdBlk(); | 222 | CmdBlkP = RIOGetCmdBlk(); |
228 | 223 | ||
229 | if ( !CmdBlkP ) { | 224 | if (!CmdBlkP) { |
230 | rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); | 225 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); |
231 | return -ENXIO; | 226 | return -ENXIO; |
232 | } | 227 | } |
233 | 228 | ||
234 | CmdBlkP->Packet.dest_unit = MapP->ID; | 229 | CmdBlkP->Packet.dest_unit = MapP->ID; |
235 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 230 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
236 | CmdBlkP->Packet.src_unit = 0; | 231 | CmdBlkP->Packet.src_unit = 0; |
237 | CmdBlkP->Packet.src_port = BOOT_RUP; | 232 | CmdBlkP->Packet.src_port = BOOT_RUP; |
238 | CmdBlkP->Packet.len = 0x84; | 233 | CmdBlkP->Packet.len = 0x84; |
239 | CmdBlkP->Packet.data[0] = IDENTIFY; | 234 | CmdBlkP->Packet.data[0] = IDENTIFY; |
240 | CmdBlkP->Packet.data[1] = 0; | 235 | CmdBlkP->Packet.data[1] = 0; |
241 | CmdBlkP->Packet.data[2] = IdRta.ID; | 236 | CmdBlkP->Packet.data[2] = IdRta.ID; |
242 | 237 | ||
243 | if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { | 238 | if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) { |
244 | rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); | 239 | rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); |
245 | return -EIO; | 240 | return -EIO; |
246 | } | 241 | } |
247 | return 0; | 242 | return 0; |
@@ -249,114 +244,110 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg) | |||
249 | } | 244 | } |
250 | } | 245 | } |
251 | } | 246 | } |
252 | } | 247 | } |
253 | return -ENOENT; | 248 | return -ENOENT; |
254 | } | 249 | } |
255 | 250 | ||
256 | 251 | ||
257 | int | 252 | int RIOKillNeighbour(struct rio_info *p, caddr_t arg) |
258 | RIOKillNeighbour(struct rio_info *p, caddr_t arg) | ||
259 | { | 253 | { |
260 | uint Host; | 254 | uint Host; |
261 | uint ID; | 255 | uint ID; |
262 | struct Host *HostP; | 256 | struct Host *HostP; |
263 | struct CmdBlk *CmdBlkP; | 257 | struct CmdBlk *CmdBlkP; |
264 | 258 | ||
265 | rio_dprintk (RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); | 259 | rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); |
266 | 260 | ||
267 | if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) { | 261 | if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) { |
268 | rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); | 262 | rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); |
269 | p->RIOError.Error = COPYIN_FAILED; | 263 | p->RIOError.Error = COPYIN_FAILED; |
270 | return -EFAULT; | 264 | return -EFAULT; |
271 | } | 265 | } |
272 | 266 | ||
273 | if ( KillUnit.Link > 3 ) | 267 | if (KillUnit.Link > 3) |
274 | return -ENXIO; | 268 | return -ENXIO; |
275 | 269 | ||
276 | CmdBlkP = RIOGetCmdBlk(); | 270 | CmdBlkP = RIOGetCmdBlk(); |
277 | 271 | ||
278 | if ( !CmdBlkP ) { | 272 | if (!CmdBlkP) { |
279 | rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); | 273 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); |
280 | return -ENXIO; | 274 | return -ENXIO; |
281 | } | 275 | } |
282 | 276 | ||
283 | CmdBlkP->Packet.dest_unit = 0; | 277 | CmdBlkP->Packet.dest_unit = 0; |
284 | CmdBlkP->Packet.src_unit = 0; | 278 | CmdBlkP->Packet.src_unit = 0; |
285 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 279 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
286 | CmdBlkP->Packet.src_port = BOOT_RUP; | 280 | CmdBlkP->Packet.src_port = BOOT_RUP; |
287 | CmdBlkP->Packet.len = 0x84; | 281 | CmdBlkP->Packet.len = 0x84; |
288 | CmdBlkP->Packet.data[0] = UFOAD; | 282 | CmdBlkP->Packet.data[0] = UFOAD; |
289 | CmdBlkP->Packet.data[1] = KillUnit.Link; | 283 | CmdBlkP->Packet.data[1] = KillUnit.Link; |
290 | CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; | 284 | CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF; |
291 | CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; | 285 | CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF; |
292 | 286 | ||
293 | for ( Host = 0; Host < p->RIONumHosts; Host++ ) { | 287 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
294 | ID = 0; | 288 | ID = 0; |
295 | HostP = &p->RIOHosts[Host]; | 289 | HostP = &p->RIOHosts[Host]; |
296 | 290 | ||
297 | if ( HostP->UniqueNum == KillUnit.UniqueNum ) { | 291 | if (HostP->UniqueNum == KillUnit.UniqueNum) { |
298 | if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link, | 292 | if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) { |
299 | CmdBlkP) == RIO_FAIL ) { | 293 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); |
300 | rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); | ||
301 | return -EIO; | 294 | return -EIO; |
302 | } | 295 | } |
303 | return 0; | 296 | return 0; |
304 | } | 297 | } |
305 | 298 | ||
306 | for ( ID=0; ID < RTAS_PER_HOST; ID++ ) { | 299 | for (ID = 0; ID < RTAS_PER_HOST; ID++) { |
307 | if ( HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum ) { | 300 | if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) { |
308 | CmdBlkP->Packet.dest_unit = ID+1; | 301 | CmdBlkP->Packet.dest_unit = ID + 1; |
309 | if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) { | 302 | if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) { |
310 | rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); | 303 | rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); |
311 | return -EIO; | 304 | return -EIO; |
312 | } | 305 | } |
313 | return 0; | 306 | return 0; |
314 | } | 307 | } |
315 | } | 308 | } |
316 | } | 309 | } |
317 | RIOFreeCmdBlk( CmdBlkP ); | 310 | RIOFreeCmdBlk(CmdBlkP); |
318 | return -ENXIO; | 311 | return -ENXIO; |
319 | } | 312 | } |
320 | 313 | ||
321 | int | 314 | int RIOSuspendBootRta(struct Host *HostP, int ID, int Link) |
322 | RIOSuspendBootRta(struct Host *HostP, int ID, int Link) | ||
323 | { | 315 | { |
324 | struct CmdBlk *CmdBlkP; | 316 | struct CmdBlk *CmdBlkP; |
325 | 317 | ||
326 | rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); | 318 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); |
327 | 319 | ||
328 | CmdBlkP = RIOGetCmdBlk(); | 320 | CmdBlkP = RIOGetCmdBlk(); |
329 | 321 | ||
330 | if ( !CmdBlkP ) { | 322 | if (!CmdBlkP) { |
331 | rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); | 323 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); |
332 | return -ENXIO; | 324 | return -ENXIO; |
333 | } | 325 | } |
334 | 326 | ||
335 | CmdBlkP->Packet.dest_unit = ID; | 327 | CmdBlkP->Packet.dest_unit = ID; |
336 | CmdBlkP->Packet.dest_port = BOOT_RUP; | 328 | CmdBlkP->Packet.dest_port = BOOT_RUP; |
337 | CmdBlkP->Packet.src_unit = 0; | 329 | CmdBlkP->Packet.src_unit = 0; |
338 | CmdBlkP->Packet.src_port = BOOT_RUP; | 330 | CmdBlkP->Packet.src_port = BOOT_RUP; |
339 | CmdBlkP->Packet.len = 0x84; | 331 | CmdBlkP->Packet.len = 0x84; |
340 | CmdBlkP->Packet.data[0] = IWAIT; | 332 | CmdBlkP->Packet.data[0] = IWAIT; |
341 | CmdBlkP->Packet.data[1] = Link; | 333 | CmdBlkP->Packet.data[1] = Link; |
342 | CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; | 334 | CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF; |
343 | CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; | 335 | CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; |
344 | 336 | ||
345 | if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) { | 337 | if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) { |
346 | rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); | 338 | rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); |
347 | return -EIO; | 339 | return -EIO; |
348 | } | 340 | } |
349 | return 0; | 341 | return 0; |
350 | } | 342 | } |
351 | 343 | ||
352 | int | 344 | int RIOFoadWakeup(struct rio_info *p) |
353 | RIOFoadWakeup(struct rio_info *p) | ||
354 | { | 345 | { |
355 | int port; | 346 | int port; |
356 | register struct Port *PortP; | 347 | register struct Port *PortP; |
357 | unsigned long flags; | 348 | unsigned long flags; |
358 | 349 | ||
359 | for ( port=0; port<RIO_PORTS; port++) { | 350 | for (port = 0; port < RIO_PORTS; port++) { |
360 | PortP = p->RIOPortp[port]; | 351 | PortP = p->RIOPortp[port]; |
361 | 352 | ||
362 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 353 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
@@ -377,16 +368,15 @@ RIOFoadWakeup(struct rio_info *p) | |||
377 | PortP->TxBufferOut = 0; | 368 | PortP->TxBufferOut = 0; |
378 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 369 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
379 | } | 370 | } |
380 | return(0); | 371 | return (0); |
381 | } | 372 | } |
382 | 373 | ||
383 | /* | 374 | /* |
384 | ** Incoming command on the COMMAND_RUP to be processed. | 375 | ** Incoming command on the COMMAND_RUP to be processed. |
385 | */ | 376 | */ |
386 | static int | 377 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) |
387 | RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | ||
388 | { | 378 | { |
389 | struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; | 379 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; |
390 | struct Port *PortP; | 380 | struct Port *PortP; |
391 | struct UnixRup *UnixRupP; | 381 | struct UnixRup *UnixRupP; |
392 | ushort SysPort; | 382 | ushort SysPort; |
@@ -395,128 +385,114 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | |||
395 | ushort subCommand; | 385 | ushort subCommand; |
396 | unsigned long flags; | 386 | unsigned long flags; |
397 | 387 | ||
398 | func_enter (); | 388 | func_enter(); |
399 | 389 | ||
400 | #ifdef CHECK | 390 | #ifdef CHECK |
401 | CheckHost( Host ); | 391 | CheckHost(Host); |
402 | CheckHostP( HostP ); | 392 | CheckHostP(HostP); |
403 | CheckPacketP( PacketP ); | 393 | CheckPacketP(PacketP); |
404 | #endif | 394 | #endif |
405 | 395 | ||
406 | /* | 396 | /* |
407 | ** 16 port RTA note: | 397 | ** 16 port RTA note: |
408 | ** Command rup packets coming from the RTA will have pkt->data[1] (which | 398 | ** Command rup packets coming from the RTA will have pkt->data[1] (which |
409 | ** translates to PktCmdP->PhbNum) set to the host port number for the | 399 | ** translates to PktCmdP->PhbNum) set to the host port number for the |
410 | ** particular unit. To access the correct BaseSysPort for a 16 port RTA, | 400 | ** particular unit. To access the correct BaseSysPort for a 16 port RTA, |
411 | ** we can use PhbNum to get the rup number for the appropriate 8 port | 401 | ** we can use PhbNum to get the rup number for the appropriate 8 port |
412 | ** block (for the first block, this should be equal to 'Rup'). | 402 | ** block (for the first block, this should be equal to 'Rup'). |
413 | */ | 403 | */ |
414 | rup = RBYTE(PktCmdP->PhbNum) / (ushort)PORTS_PER_RTA; | 404 | rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA; |
415 | UnixRupP = &HostP->UnixRups[rup]; | 405 | UnixRupP = &HostP->UnixRups[rup]; |
416 | SysPort = UnixRupP->BaseSysPort + | 406 | SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); |
417 | (RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA); | 407 | rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); |
418 | rio_dprintk (RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); | ||
419 | 408 | ||
420 | #ifdef CHECK | 409 | #ifdef CHECK |
421 | CheckRup( rup ); | 410 | CheckRup(rup); |
422 | CheckUnixRupP( UnixRupP ); | 411 | CheckUnixRupP(UnixRupP); |
423 | #endif | 412 | #endif |
424 | if ( UnixRupP->BaseSysPort == NO_PORT ) { | 413 | if (UnixRupP->BaseSysPort == NO_PORT) { |
425 | rio_dprintk (RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); | 414 | rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); |
426 | rio_dprintk (RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); | 415 | rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); |
427 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", | 416 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); |
428 | HostP-p->RIOHosts, HostP->Name ); | 417 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); |
429 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); | 418 | |
430 | 419 | if (Rup >= (ushort) MAX_RUP) { | |
431 | if ( Rup >= (ushort)MAX_RUP ) { | 420 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); |
432 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", | ||
433 | HostP->Mapping[Rup].Name); | ||
434 | } else | 421 | } else |
435 | rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", | 422 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); |
436 | ('A' + Rup - MAX_RUP), HostP->Name); | 423 | |
437 | 424 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port); | |
438 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", | 425 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port); |
439 | PacketP->dest_unit, PacketP->dest_port ); | 426 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len, PacketP->len); |
440 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", | 427 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); |
441 | PacketP->src_unit, PacketP->src_port ); | 428 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); |
442 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len ); | 429 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); |
443 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); | ||
444 | rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum ); | ||
445 | rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " | ||
446 | "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command ); | ||
447 | return TRUE; | 430 | return TRUE; |
448 | } | 431 | } |
449 | |||
450 | #ifdef CHECK | 432 | #ifdef CHECK |
451 | CheckSysPort( SysPort ); | 433 | CheckSysPort(SysPort); |
452 | #endif | 434 | #endif |
453 | PortP = p->RIOPortp[ SysPort ]; | 435 | PortP = p->RIOPortp[SysPort]; |
454 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 436 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
455 | switch( RBYTE(PktCmdP->Command) ) { | 437 | switch (RBYTE(PktCmdP->Command)) { |
456 | case BREAK_RECEIVED: | 438 | case BREAK_RECEIVED: |
457 | rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); | 439 | rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); |
458 | /* If the current line disc. is not multi-threading and | 440 | /* If the current line disc. is not multi-threading and |
459 | the current processor is not the default, reset rup_intr | 441 | the current processor is not the default, reset rup_intr |
460 | and return FALSE to ensure that the command packet is | 442 | and return FALSE to ensure that the command packet is |
461 | not freed. */ | 443 | not freed. */ |
462 | /* Call tmgr HANGUP HERE */ | 444 | /* Call tmgr HANGUP HERE */ |
463 | /* Fix this later when every thing works !!!! RAMRAJ */ | 445 | /* Fix this later when every thing works !!!! RAMRAJ */ |
464 | gs_got_break (&PortP->gs); | 446 | gs_got_break(&PortP->gs); |
447 | break; | ||
448 | |||
449 | case COMPLETE: | ||
450 | rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts); | ||
451 | subCommand = 1; | ||
452 | switch (RBYTE(PktCmdP->SubCommand)) { | ||
453 | case MEMDUMP: | ||
454 | rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); | ||
465 | break; | 455 | break; |
456 | case READ_REGISTER: | ||
457 | rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); | ||
458 | p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); | ||
459 | break; | ||
460 | default: | ||
461 | subCommand = 0; | ||
462 | break; | ||
463 | } | ||
464 | if (subCommand) | ||
465 | break; | ||
466 | rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState); | ||
467 | if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { | ||
468 | rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); | ||
469 | PortP->PortState = RBYTE(PktCmdP->PortStatus); | ||
470 | /* What should we do here ... | ||
471 | wakeup( &PortP->PortState ); | ||
472 | */ | ||
473 | } else | ||
474 | rio_dprintk(RIO_DEBUG_CMD, "No change\n"); | ||
466 | 475 | ||
467 | case COMPLETE: | 476 | /* FALLTHROUGH */ |
468 | rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", | 477 | case MODEM_STATUS: |
469 | RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts); | 478 | /* |
470 | subCommand = 1; | 479 | ** Knock out the tbusy and tstop bits, as these are not relevant |
471 | switch (RBYTE(PktCmdP->SubCommand)) { | 480 | ** to the check for modem status change (they're just there because |
472 | case MEMDUMP : | 481 | ** it's a convenient place to put them!). |
473 | rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", | 482 | */ |
474 | RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); | 483 | ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); |
475 | break; | 484 | if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { |
476 | case READ_REGISTER : | 485 | rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); |
477 | rio_dprintk (RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); | ||
478 | p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); | ||
479 | break; | ||
480 | default : | ||
481 | subCommand = 0; | ||
482 | break; | ||
483 | } | ||
484 | if (subCommand) | ||
485 | break; | ||
486 | rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", | ||
487 | RBYTE(PktCmdP->PortStatus),PortP->PortState); | ||
488 | if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { | ||
489 | rio_dprintk (RIO_DEBUG_CMD, "Mark status & wakeup\n"); | ||
490 | PortP->PortState = RBYTE(PktCmdP->PortStatus); | ||
491 | /* What should we do here ... | ||
492 | wakeup( &PortP->PortState ); | ||
493 | */ | ||
494 | } else | ||
495 | rio_dprintk (RIO_DEBUG_CMD, "No change\n"); | ||
496 | |||
497 | /* FALLTHROUGH */ | ||
498 | case MODEM_STATUS: | ||
499 | /* | 486 | /* |
500 | ** Knock out the tbusy and tstop bits, as these are not relevant | 487 | ** Update ModemState just in case tbusy or tstop states have |
501 | ** to the check for modem status change (they're just there because | 488 | ** changed. |
502 | ** it's a convenient place to put them!). | 489 | */ |
503 | */ | 490 | PortP->ModemState = ReportedModemStatus; |
504 | ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); | 491 | } else { |
505 | if ((PortP->ModemState & MSVR1_HOST) == | 492 | rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus); |
506 | (ReportedModemStatus & MSVR1_HOST)) { | 493 | PortP->ModemState = ReportedModemStatus; |
507 | rio_dprintk (RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); | ||
508 | /* | ||
509 | ** Update ModemState just in case tbusy or tstop states have | ||
510 | ** changed. | ||
511 | */ | ||
512 | PortP->ModemState = ReportedModemStatus; | ||
513 | } | ||
514 | else { | ||
515 | rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", | ||
516 | PortP->ModemState, ReportedModemStatus); | ||
517 | PortP->ModemState = ReportedModemStatus; | ||
518 | #ifdef MODEM_SUPPORT | 494 | #ifdef MODEM_SUPPORT |
519 | if ( PortP->Mapped ) { | 495 | if (PortP->Mapped) { |
520 | /***********************************************************\ | 496 | /***********************************************************\ |
521 | ************************************************************* | 497 | ************************************************************* |
522 | *** *** | 498 | *** *** |
@@ -525,68 +501,67 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | |||
525 | ************************************************************* | 501 | ************************************************************* |
526 | \***********************************************************/ | 502 | \***********************************************************/ |
527 | /* | 503 | /* |
528 | ** If the device is a modem, then check the modem | 504 | ** If the device is a modem, then check the modem |
529 | ** carrier. | 505 | ** carrier. |
530 | */ | 506 | */ |
531 | if (PortP->gs.tty == NULL) | 507 | if (PortP->gs.tty == NULL) |
532 | break; | 508 | break; |
533 | if (PortP->gs.tty->termios == NULL) | 509 | if (PortP->gs.tty->termios == NULL) |
534 | break; | 510 | break; |
535 | |||
536 | if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && | ||
537 | ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) { | ||
538 | 511 | ||
539 | rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n"); | 512 | if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { |
540 | /* | 513 | |
541 | ** Is there a carrier? | 514 | rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); |
542 | */ | 515 | /* |
543 | if ( PortP->ModemState & MSVR1_CD ) { | 516 | ** Is there a carrier? |
544 | /* | 517 | */ |
545 | ** Has carrier just appeared? | 518 | if (PortP->ModemState & MSVR1_CD) { |
546 | */ | 519 | /* |
520 | ** Has carrier just appeared? | ||
521 | */ | ||
547 | if (!(PortP->State & RIO_CARR_ON)) { | 522 | if (!(PortP->State & RIO_CARR_ON)) { |
548 | rio_dprintk (RIO_DEBUG_CMD, "Carrier just came up.\n"); | 523 | rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n"); |
549 | PortP->State |= RIO_CARR_ON; | 524 | PortP->State |= RIO_CARR_ON; |
550 | /* | 525 | /* |
551 | ** wakeup anyone in WOPEN | 526 | ** wakeup anyone in WOPEN |
552 | */ | 527 | */ |
553 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN) ) | 528 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) |
554 | wake_up_interruptible (&PortP->gs.open_wait); | 529 | wake_up_interruptible(&PortP->gs.open_wait); |
555 | #ifdef STATS | 530 | #ifdef STATS |
556 | PortP->Stat.ModemOnCnt++; | 531 | PortP->Stat.ModemOnCnt++; |
557 | #endif | 532 | #endif |
558 | } | 533 | } |
559 | } else { | 534 | } else { |
560 | /* | 535 | /* |
561 | ** Has carrier just dropped? | 536 | ** Has carrier just dropped? |
562 | */ | 537 | */ |
563 | if (PortP->State & RIO_CARR_ON) { | 538 | if (PortP->State & RIO_CARR_ON) { |
564 | if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN)) | 539 | if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) |
565 | tty_hangup (PortP->gs.tty); | 540 | tty_hangup(PortP->gs.tty); |
566 | PortP->State &= ~RIO_CARR_ON; | 541 | PortP->State &= ~RIO_CARR_ON; |
567 | rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n"); | 542 | rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); |
568 | #ifdef STATS | 543 | #ifdef STATS |
569 | PortP->Stat.ModemOffCnt++; | 544 | PortP->Stat.ModemOffCnt++; |
570 | #endif | 545 | #endif |
546 | } | ||
547 | } | ||
548 | } | ||
571 | } | 549 | } |
572 | } | ||
573 | } | ||
574 | } | ||
575 | #endif | 550 | #endif |
576 | } | 551 | } |
577 | break; | 552 | break; |
578 | 553 | ||
579 | default: | 554 | default: |
580 | rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", | 555 | rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts); |
581 | RBYTE(PktCmdP->Command),HostP-p->RIOHosts); | 556 | break; |
582 | break; | ||
583 | } | 557 | } |
584 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 558 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
585 | 559 | ||
586 | func_exit (); | 560 | func_exit(); |
587 | 561 | ||
588 | return TRUE; | 562 | return TRUE; |
589 | } | 563 | } |
564 | |||
590 | /* | 565 | /* |
591 | ** The command mechanism: | 566 | ** The command mechanism: |
592 | ** Each rup has a chain of commands associated with it. | 567 | ** Each rup has a chain of commands associated with it. |
@@ -600,12 +575,11 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP) | |||
600 | /* | 575 | /* |
601 | ** Allocate an empty command block. | 576 | ** Allocate an empty command block. |
602 | */ | 577 | */ |
603 | struct CmdBlk * | 578 | struct CmdBlk *RIOGetCmdBlk(void) |
604 | RIOGetCmdBlk(void) | ||
605 | { | 579 | { |
606 | struct CmdBlk *CmdBlkP; | 580 | struct CmdBlk *CmdBlkP; |
607 | 581 | ||
608 | CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk)); | 582 | CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk)); |
609 | if (CmdBlkP) | 583 | if (CmdBlkP) |
610 | bzero(CmdBlkP, sizeof(struct CmdBlk)); | 584 | bzero(CmdBlkP, sizeof(struct CmdBlk)); |
611 | 585 | ||
@@ -615,31 +589,29 @@ RIOGetCmdBlk(void) | |||
615 | /* | 589 | /* |
616 | ** Return a block to the head of the free list. | 590 | ** Return a block to the head of the free list. |
617 | */ | 591 | */ |
618 | void | 592 | void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) |
619 | RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) | ||
620 | { | 593 | { |
621 | sysfree((void *)CmdBlkP, sizeof(struct CmdBlk)); | 594 | sysfree((void *) CmdBlkP, sizeof(struct CmdBlk)); |
622 | } | 595 | } |
623 | 596 | ||
624 | /* | 597 | /* |
625 | ** attach a command block to the list of commands to be performed for | 598 | ** attach a command block to the list of commands to be performed for |
626 | ** a given rup. | 599 | ** a given rup. |
627 | */ | 600 | */ |
628 | int | 601 | int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) |
629 | RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | ||
630 | { | 602 | { |
631 | struct CmdBlk **Base; | 603 | struct CmdBlk **Base; |
632 | struct UnixRup *UnixRupP; | 604 | struct UnixRup *UnixRupP; |
633 | unsigned long flags; | 605 | unsigned long flags; |
634 | 606 | ||
635 | #ifdef CHECK | 607 | #ifdef CHECK |
636 | CheckHostP( HostP ); | 608 | CheckHostP(HostP); |
637 | CheckRup( Rup ); | 609 | CheckRup(Rup); |
638 | CheckCmdBlkP( CmdBlkP ); | 610 | CheckCmdBlkP(CmdBlkP); |
639 | #endif | 611 | #endif |
640 | if ( Rup >= (ushort)(MAX_RUP+LINKS_PER_UNIT) ) { | 612 | if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { |
641 | rio_dprintk (RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n",Rup); | 613 | rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); |
642 | RIOFreeCmdBlk( CmdBlkP ); | 614 | RIOFreeCmdBlk(CmdBlkP); |
643 | return RIO_FAIL; | 615 | return RIO_FAIL; |
644 | } | 616 | } |
645 | 617 | ||
@@ -648,57 +620,52 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
648 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 620 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
649 | 621 | ||
650 | /* | 622 | /* |
651 | ** If the RUP is currently inactive, then put the request | 623 | ** If the RUP is currently inactive, then put the request |
652 | ** straight on the RUP.... | 624 | ** straight on the RUP.... |
653 | */ | 625 | */ |
654 | if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && | 626 | if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) |
655 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) && | 627 | : TRUE)) { |
656 | (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP) | 628 | rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); |
657 | :TRUE)) { | ||
658 | rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", | ||
659 | CmdBlkP->Packet.data[0]); | ||
660 | 629 | ||
661 | /* | 630 | /* |
662 | ** Whammy! blat that pack! | 631 | ** Whammy! blat that pack! |
663 | */ | 632 | */ |
664 | HostP->Copy( (caddr_t)&CmdBlkP->Packet, | 633 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); |
665 | RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt ), sizeof(PKT) ); | ||
666 | 634 | ||
667 | /* | 635 | /* |
668 | ** place command packet on the pending position. | 636 | ** place command packet on the pending position. |
669 | */ | 637 | */ |
670 | UnixRupP->CmdPendingP = CmdBlkP; | 638 | UnixRupP->CmdPendingP = CmdBlkP; |
671 | 639 | ||
672 | /* | 640 | /* |
673 | ** set the command register | 641 | ** set the command register |
674 | */ | 642 | */ |
675 | WWORD(UnixRupP->RupP->txcontrol , TX_PACKET_READY); | 643 | WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); |
676 | 644 | ||
677 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 645 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
678 | 646 | ||
679 | return RIO_SUCCESS; | 647 | return RIO_SUCCESS; |
680 | } | 648 | } |
681 | rio_dprintk (RIO_DEBUG_CMD, "RUP active - en-queing\n"); | 649 | rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); |
682 | 650 | ||
683 | if ( UnixRupP->CmdsWaitingP != NULL) | 651 | if (UnixRupP->CmdsWaitingP != NULL) |
684 | rio_dprintk (RIO_DEBUG_CMD, "Rup active - command waiting\n"); | 652 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); |
685 | if ( UnixRupP->CmdPendingP != NULL ) | 653 | if (UnixRupP->CmdPendingP != NULL) |
686 | rio_dprintk (RIO_DEBUG_CMD, "Rup active - command pending\n"); | 654 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); |
687 | if ( RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE ) | 655 | if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) |
688 | rio_dprintk (RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); | 656 | rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); |
689 | 657 | ||
690 | Base = &UnixRupP->CmdsWaitingP; | 658 | Base = &UnixRupP->CmdsWaitingP; |
691 | 659 | ||
692 | rio_dprintk (RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int)CmdBlkP,(int)Base); | 660 | rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); |
693 | 661 | ||
694 | while ( *Base ) { | 662 | while (*Base) { |
695 | rio_dprintk (RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int)(*Base)); | 663 | rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base)); |
696 | Base = &((*Base)->NextP); | 664 | Base = &((*Base)->NextP); |
697 | rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", | 665 | rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); |
698 | (int)CmdBlkP,(int)Base); | ||
699 | } | 666 | } |
700 | 667 | ||
701 | rio_dprintk (RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base); | 668 | rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); |
702 | 669 | ||
703 | *Base = CmdBlkP; | 670 | *Base = CmdBlkP; |
704 | 671 | ||
@@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
713 | ** Here we go - if there is an empty rup, fill it! | 680 | ** Here we go - if there is an empty rup, fill it! |
714 | ** must be called at splrio() or higher. | 681 | ** must be called at splrio() or higher. |
715 | */ | 682 | */ |
716 | void | 683 | void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) |
717 | RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | ||
718 | { | 684 | { |
719 | register struct CmdBlk *CmdBlkP; | 685 | register struct CmdBlk *CmdBlkP; |
720 | register struct UnixRup *UnixRupP; | 686 | register struct UnixRup *UnixRupP; |
@@ -723,262 +689,246 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
723 | unsigned long flags; | 689 | unsigned long flags; |
724 | 690 | ||
725 | 691 | ||
726 | Rup = MAX_RUP+LINKS_PER_UNIT; | 692 | Rup = MAX_RUP + LINKS_PER_UNIT; |
727 | 693 | ||
728 | do { /* do this loop for each RUP */ | 694 | do { /* do this loop for each RUP */ |
729 | /* | 695 | /* |
730 | ** locate the rup we are processing & lock it | 696 | ** locate the rup we are processing & lock it |
731 | */ | 697 | */ |
732 | UnixRupP = &HostP->UnixRups[--Rup]; | 698 | UnixRupP = &HostP->UnixRups[--Rup]; |
733 | 699 | ||
734 | spin_lock_irqsave(&UnixRupP->RupLock, flags); | 700 | spin_lock_irqsave(&UnixRupP->RupLock, flags); |
735 | 701 | ||
736 | /* | 702 | /* |
737 | ** First check for incoming commands: | 703 | ** First check for incoming commands: |
738 | */ | 704 | */ |
739 | if ( RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE ) { | 705 | if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { |
740 | int FreeMe; | 706 | int FreeMe; |
741 | 707 | ||
742 | PacketP =(PKT *)RIO_PTR(HostP->Caddr,RWORD(UnixRupP->RupP->rxpkt)); | 708 | PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt)); |
743 | 709 | ||
744 | ShowPacket( DBG_CMD, PacketP ); | 710 | ShowPacket(DBG_CMD, PacketP); |
745 | 711 | ||
746 | switch ( RBYTE(PacketP->dest_port) ) { | 712 | switch (RBYTE(PacketP->dest_port)) { |
747 | case BOOT_RUP: | 713 | case BOOT_RUP: |
748 | rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", | 714 | rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0])); |
749 | RBYTE(PacketP->len) & 0x80 ? "Command":"Data", | 715 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
750 | RBYTE(PacketP->data[0])); | 716 | FreeMe = RIOBootRup(p, Rup, HostP, PacketP); |
751 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 717 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
752 | FreeMe= RIOBootRup(p, Rup,HostP,PacketP); | 718 | break; |
753 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
754 | break; | ||
755 | 719 | ||
756 | case COMMAND_RUP: | 720 | case COMMAND_RUP: |
757 | /* | 721 | /* |
758 | ** Free the RUP lock as loss of carrier causes a | 722 | ** Free the RUP lock as loss of carrier causes a |
759 | ** ttyflush which will (eventually) call another | 723 | ** ttyflush which will (eventually) call another |
760 | ** routine that uses the RUP lock. | 724 | ** routine that uses the RUP lock. |
761 | */ | 725 | */ |
762 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 726 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
763 | FreeMe= RIOCommandRup(p, Rup,HostP,PacketP); | 727 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); |
764 | if (PacketP->data[5] == MEMDUMP) { | 728 | if (PacketP->data[5] == MEMDUMP) { |
765 | rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", | 729 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6])); |
766 | *(ushort *) &(PacketP->data[6])); | 730 | HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); |
767 | HostP->Copy( (caddr_t)&(PacketP->data[8]), | 731 | } |
768 | (caddr_t)p->RIOMemDump, 32 ); | 732 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
769 | } | 733 | break; |
770 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | ||
771 | break; | ||
772 | 734 | ||
773 | case ROUTE_RUP: | 735 | case ROUTE_RUP: |
774 | rio_spin_unlock_irqrestore( &UnixRupP->RupLock, flags); | 736 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
775 | FreeMe = RIORouteRup(p, Rup, HostP, PacketP ); | 737 | FreeMe = RIORouteRup(p, Rup, HostP, PacketP); |
776 | rio_spin_lock_irqsave( &UnixRupP->RupLock, flags ); | 738 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
777 | break; | 739 | break; |
778 | 740 | ||
779 | default: | 741 | default: |
780 | rio_dprintk (RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); | 742 | rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); |
781 | FreeMe = 1; | 743 | FreeMe = 1; |
782 | break; | 744 | break; |
783 | } | 745 | } |
784 | 746 | ||
785 | if ( FreeMe ) { | 747 | if (FreeMe) { |
786 | rio_dprintk (RIO_DEBUG_CMD, "Free processed incoming command packet\n"); | 748 | rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); |
787 | put_free_end(HostP,PacketP); | 749 | put_free_end(HostP, PacketP); |
788 | 750 | ||
789 | WWORD(UnixRupP->RupP->rxcontrol , RX_RUP_INACTIVE); | 751 | WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE); |
790 | 752 | ||
791 | if ( RWORD(UnixRupP->RupP->handshake)==PHB_HANDSHAKE_SET ) { | 753 | if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { |
792 | rio_dprintk (RIO_DEBUG_CMD, "Handshake rup %d\n",Rup); | 754 | rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); |
793 | WWORD(UnixRupP->RupP->handshake, | 755 | WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); |
794 | PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); | ||
795 | } | 756 | } |
796 | } | 757 | } |
797 | } | 758 | } |
798 | 759 | ||
799 | /* | 760 | /* |
800 | ** IF a command was running on the port, | 761 | ** IF a command was running on the port, |
801 | ** and it has completed, then tidy it up. | 762 | ** and it has completed, then tidy it up. |
802 | */ | 763 | */ |
803 | if ( (CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ | 764 | if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ |
804 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | 765 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { |
805 | /* | 766 | /* |
806 | ** we are idle. | 767 | ** we are idle. |
807 | ** there is a command in pending. | 768 | ** there is a command in pending. |
808 | ** Therefore, this command has finished. | 769 | ** Therefore, this command has finished. |
809 | ** So, wakeup whoever is waiting for it (and tell them | 770 | ** So, wakeup whoever is waiting for it (and tell them |
810 | ** what happened). | 771 | ** what happened). |
811 | */ | 772 | */ |
812 | if ( CmdBlkP->Packet.dest_port == BOOT_RUP ) | 773 | if (CmdBlkP->Packet.dest_port == BOOT_RUP) |
813 | rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", | 774 | rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); |
814 | CmdBlkP->Packet.len & 0x80 ? "Command":"Data", | 775 | |
815 | CmdBlkP->Packet.data[0]); | 776 | rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP); |
816 | |||
817 | rio_dprintk (RIO_DEBUG_CMD, "Command 0x%x completed\n",(int)CmdBlkP); | ||
818 | 777 | ||
819 | /* | 778 | /* |
820 | ** Clear the Rup lock to prevent mutual exclusion. | 779 | ** Clear the Rup lock to prevent mutual exclusion. |
821 | */ | 780 | */ |
822 | if ( CmdBlkP->PostFuncP ) { | 781 | if (CmdBlkP->PostFuncP) { |
823 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 782 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
824 | (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg,CmdBlkP); | 783 | (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP); |
825 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 784 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
826 | } | 785 | } |
827 | 786 | ||
828 | /* | 787 | /* |
829 | ** ....clear the pending flag.... | 788 | ** ....clear the pending flag.... |
830 | */ | 789 | */ |
831 | UnixRupP->CmdPendingP = NULL; | 790 | UnixRupP->CmdPendingP = NULL; |
832 | 791 | ||
833 | /* | 792 | /* |
834 | ** ....and return the command block to the freelist. | 793 | ** ....and return the command block to the freelist. |
835 | */ | 794 | */ |
836 | RIOFreeCmdBlk( CmdBlkP ); | 795 | RIOFreeCmdBlk(CmdBlkP); |
837 | } | 796 | } |
838 | 797 | ||
839 | /* | 798 | /* |
840 | ** If there is a command for this rup, and the rup | 799 | ** If there is a command for this rup, and the rup |
841 | ** is idle, then process the command | 800 | ** is idle, then process the command |
842 | */ | 801 | */ |
843 | if ( (CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ | 802 | if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ |
844 | (UnixRupP->CmdPendingP == NULL) && | 803 | (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { |
845 | (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { | ||
846 | /* | 804 | /* |
847 | ** if the pre-function is non-zero, call it. | 805 | ** if the pre-function is non-zero, call it. |
848 | ** If it returns RIO_FAIL then don't | 806 | ** If it returns RIO_FAIL then don't |
849 | ** send this command yet! | 807 | ** send this command yet! |
850 | */ | 808 | */ |
851 | #ifdef CHECK | 809 | #ifdef CHECK |
852 | CheckCmdBlkP (CmdBlkP); | 810 | CheckCmdBlkP(CmdBlkP); |
853 | #endif | 811 | #endif |
854 | if ( !(CmdBlkP->PreFuncP ? | 812 | if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { |
855 | (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) { | 813 | rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); |
856 | rio_dprintk (RIO_DEBUG_CMD, "Not ready to start command 0x%x\n",(int)CmdBlkP); | 814 | } else { |
857 | } | 815 | rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]); |
858 | else { | ||
859 | rio_dprintk (RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", | ||
860 | (int)CmdBlkP, CmdBlkP->Packet.data[0]); | ||
861 | /* | 816 | /* |
862 | ** Whammy! blat that pack! | 817 | ** Whammy! blat that pack! |
863 | */ | 818 | */ |
864 | #ifdef CHECK | 819 | #ifdef CHECK |
865 | CheckPacketP ((PKT *)RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); | 820 | CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); |
866 | #endif | 821 | #endif |
867 | HostP->Copy( (caddr_t)&CmdBlkP->Packet, | 822 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); |
868 | RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); | ||
869 | 823 | ||
870 | /* | 824 | /* |
871 | ** remove the command from the rup command queue... | 825 | ** remove the command from the rup command queue... |
872 | */ | 826 | */ |
873 | UnixRupP->CmdsWaitingP = CmdBlkP->NextP; | 827 | UnixRupP->CmdsWaitingP = CmdBlkP->NextP; |
874 | 828 | ||
875 | /* | 829 | /* |
876 | ** ...and place it on the pending position. | 830 | ** ...and place it on the pending position. |
877 | */ | 831 | */ |
878 | UnixRupP->CmdPendingP = CmdBlkP; | 832 | UnixRupP->CmdPendingP = CmdBlkP; |
879 | 833 | ||
880 | /* | 834 | /* |
881 | ** set the command register | 835 | ** set the command register |
882 | */ | 836 | */ |
883 | WWORD(UnixRupP->RupP->txcontrol,TX_PACKET_READY); | 837 | WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); |
884 | 838 | ||
885 | /* | 839 | /* |
886 | ** the command block will be freed | 840 | ** the command block will be freed |
887 | ** when the command has been processed. | 841 | ** when the command has been processed. |
888 | */ | 842 | */ |
889 | } | 843 | } |
890 | } | 844 | } |
891 | spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 845 | spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
892 | } while ( Rup ); | 846 | } while (Rup); |
893 | } | 847 | } |
894 | 848 | ||
895 | int | 849 | int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) |
896 | RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) | ||
897 | { | 850 | { |
898 | struct Port * PortP = (struct Port *)iPortP; | 851 | struct Port *PortP = (struct Port *) iPortP; |
899 | unsigned long flags; | 852 | unsigned long flags; |
900 | 853 | ||
901 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 854 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
902 | #ifdef CHECK | 855 | #ifdef CHECK |
903 | CheckPortP( PortP ); | 856 | CheckPortP(PortP); |
904 | #endif | 857 | #endif |
905 | PortP->WflushFlag++; | 858 | PortP->WflushFlag++; |
906 | PortP->MagicFlags |= MAGIC_FLUSH; | 859 | PortP->MagicFlags |= MAGIC_FLUSH; |
907 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 860 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
908 | return RIOUnUse( iPortP, CmdBlkP ); | 861 | return RIOUnUse(iPortP, CmdBlkP); |
909 | } | 862 | } |
910 | 863 | ||
911 | int | 864 | int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) |
912 | RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) | ||
913 | { | 865 | { |
914 | struct Port * PortP = (struct Port *)iPortP; | 866 | struct Port *PortP = (struct Port *) iPortP; |
915 | PKT *PacketP; | 867 | PKT *PacketP; |
916 | unsigned long flags; | 868 | unsigned long flags; |
917 | 869 | ||
918 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 870 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
919 | 871 | ||
920 | while ( can_remove_receive(&PacketP, PortP) ) { | 872 | while (can_remove_receive(&PacketP, PortP)) { |
921 | remove_receive(PortP); | 873 | remove_receive(PortP); |
922 | ShowPacket(DBG_PROC, PacketP ); | 874 | ShowPacket(DBG_PROC, PacketP); |
923 | put_free_end( PortP->HostP, PacketP ); | 875 | put_free_end(PortP->HostP, PacketP); |
924 | } | 876 | } |
925 | 877 | ||
926 | if ( RWORD(PortP->PhbP->handshake)==PHB_HANDSHAKE_SET ) { | 878 | if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { |
927 | /* | 879 | /* |
928 | ** MAGIC! (Basically, handshake the RX buffer, so that | 880 | ** MAGIC! (Basically, handshake the RX buffer, so that |
929 | ** the RTAs upstream can be re-enabled.) | 881 | ** the RTAs upstream can be re-enabled.) |
930 | */ | 882 | */ |
931 | rio_dprintk (RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); | 883 | rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); |
932 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); | 884 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); |
933 | } | 885 | } |
934 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 886 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
935 | return RIOUnUse( iPortP, CmdBlkP ); | 887 | return RIOUnUse(iPortP, CmdBlkP); |
936 | } | 888 | } |
937 | 889 | ||
938 | int | 890 | int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) |
939 | RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) | ||
940 | { | 891 | { |
941 | struct Port * PortP = (struct Port *)iPortP; | 892 | struct Port *PortP = (struct Port *) iPortP; |
942 | unsigned long flags; | 893 | unsigned long flags; |
943 | 894 | ||
944 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 895 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
945 | 896 | ||
946 | #ifdef CHECK | 897 | #ifdef CHECK |
947 | CheckPortP( PortP ); | 898 | CheckPortP(PortP); |
948 | #endif | 899 | #endif |
949 | rio_dprintk (RIO_DEBUG_CMD, "Decrement in use count for port\n"); | 900 | rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n"); |
950 | 901 | ||
951 | if (PortP->InUse) { | 902 | if (PortP->InUse) { |
952 | if ( --PortP->InUse != NOT_INUSE ) { | 903 | if (--PortP->InUse != NOT_INUSE) { |
953 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 904 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
954 | return 0; | 905 | return 0; |
955 | } | 906 | } |
956 | } | 907 | } |
957 | /* | 908 | /* |
958 | ** While PortP->InUse is set (i.e. a preemptive command has been sent to | 909 | ** While PortP->InUse is set (i.e. a preemptive command has been sent to |
959 | ** the RTA and is awaiting completion), any transmit data is prevented from | 910 | ** the RTA and is awaiting completion), any transmit data is prevented from |
960 | ** being transferred from the write queue into the transmit packets | 911 | ** being transferred from the write queue into the transmit packets |
961 | ** (add_transmit) and no furthur transmit interrupt will be sent for that | 912 | ** (add_transmit) and no furthur transmit interrupt will be sent for that |
962 | ** data. The next interrupt will occur up to 500ms later (RIOIntr is called | 913 | ** data. The next interrupt will occur up to 500ms later (RIOIntr is called |
963 | ** twice a second as a saftey measure). This was the case when kermit was | 914 | ** twice a second as a saftey measure). This was the case when kermit was |
964 | ** used to send data into a RIO port. After each packet was sent, TCFLSH | 915 | ** used to send data into a RIO port. After each packet was sent, TCFLSH |
965 | ** was called to flush the read queue preemptively. PortP->InUse was | 916 | ** was called to flush the read queue preemptively. PortP->InUse was |
966 | ** incremented, thereby blocking the 6 byte acknowledgement packet | 917 | ** incremented, thereby blocking the 6 byte acknowledgement packet |
967 | ** transmitted back. This acknowledgment hung around for 500ms before | 918 | ** transmitted back. This acknowledgment hung around for 500ms before |
968 | ** being sent, thus reducing input performance substantially!. | 919 | ** being sent, thus reducing input performance substantially!. |
969 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data | 920 | ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data |
970 | ** hanging around in the transmit buffer is sent immediately. | 921 | ** hanging around in the transmit buffer is sent immediately. |
971 | */ | 922 | */ |
972 | WWORD(PortP->HostP->ParmMapP->tx_intr, 1); | 923 | WWORD(PortP->HostP->ParmMapP->tx_intr, 1); |
973 | /* What to do here .. | 924 | /* What to do here .. |
974 | wakeup( (caddr_t)&(PortP->InUse) ); | 925 | wakeup( (caddr_t)&(PortP->InUse) ); |
975 | */ | 926 | */ |
976 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 927 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
977 | return 0; | 928 | return 0; |
978 | } | 929 | } |
979 | 930 | ||
980 | void | 931 | void ShowPacket(uint Flags, struct PKT *PacketP) |
981 | ShowPacket(uint Flags, struct PKT *PacketP) | ||
982 | { | 932 | { |
983 | } | 933 | } |
984 | 934 | ||
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index b4d1a23e27e4..0b7700d2f049 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -82,16 +82,16 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; | |||
82 | #include "rioioctl.h" | 82 | #include "rioioctl.h" |
83 | 83 | ||
84 | 84 | ||
85 | static struct LpbReq LpbReq; | 85 | static struct LpbReq LpbReq; |
86 | static struct RupReq RupReq; | 86 | static struct RupReq RupReq; |
87 | static struct PortReq PortReq; | 87 | static struct PortReq PortReq; |
88 | static struct HostReq HostReq; | 88 | static struct HostReq HostReq; |
89 | static struct HostDpRam HostDpRam; | 89 | static struct HostDpRam HostDpRam; |
90 | static struct DebugCtrl DebugCtrl; | 90 | static struct DebugCtrl DebugCtrl; |
91 | static struct Map MapEnt; | 91 | static struct Map MapEnt; |
92 | static struct PortSetup PortSetup; | 92 | static struct PortSetup PortSetup; |
93 | static struct DownLoad DownLoad; | 93 | static struct DownLoad DownLoad; |
94 | static struct SendPack SendPack; | 94 | static struct SendPack SendPack; |
95 | /* static struct StreamInfo StreamInfo; */ | 95 | /* static struct StreamInfo StreamInfo; */ |
96 | /* static char modemtable[RIO_PORTS]; */ | 96 | /* static char modemtable[RIO_PORTS]; */ |
97 | static struct SpecialRupCmd SpecialRupCmd; | 97 | static struct SpecialRupCmd SpecialRupCmd; |
@@ -99,18 +99,18 @@ static struct PortParams PortParams; | |||
99 | static struct portStats portStats; | 99 | static struct portStats portStats; |
100 | 100 | ||
101 | static struct SubCmdStruct { | 101 | static struct SubCmdStruct { |
102 | ushort Host; | 102 | ushort Host; |
103 | ushort Rup; | 103 | ushort Rup; |
104 | ushort Port; | 104 | ushort Port; |
105 | ushort Addr; | 105 | ushort Addr; |
106 | } SubCmd; | 106 | } SubCmd; |
107 | 107 | ||
108 | struct PortTty { | 108 | struct PortTty { |
109 | uint port; | 109 | uint port; |
110 | struct ttystatics Tty; | 110 | struct ttystatics Tty; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | static struct PortTty PortTty; | 113 | static struct PortTty PortTty; |
114 | typedef struct ttystatics TERMIO; | 114 | typedef struct ttystatics TERMIO; |
115 | 115 | ||
116 | /* | 116 | /* |
@@ -121,267 +121,264 @@ typedef struct ttystatics TERMIO; | |||
121 | ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling | 121 | ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling |
122 | ** process to bog off. | 122 | ** process to bog off. |
123 | */ | 123 | */ |
124 | static int | 124 | static int |
125 | (*RIOBootTable[MAX_PRODUCT])(struct rio_info *, struct DownLoad *) = | 125 | (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = { |
126 | { | 126 | /* 0 */ RIOBootCodeHOST, |
127 | /* 0 */ RIOBootCodeHOST, /* Host Card */ | 127 | /* Host Card */ |
128 | /* 1 */ RIOBootCodeRTA, /* RTA */ | 128 | /* 1 */ RIOBootCodeRTA, |
129 | /* RTA */ | ||
129 | }; | 130 | }; |
130 | 131 | ||
131 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) | 132 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) |
132 | 133 | ||
133 | int copyin (int arg, caddr_t dp, int siz) | 134 | int copyin(int arg, caddr_t dp, int siz) |
134 | { | 135 | { |
135 | int rv; | 136 | int rv; |
136 | 137 | ||
137 | rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *)arg, dp); | 138 | rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp); |
138 | rv = copy_from_user (dp, (void *)arg, siz); | 139 | rv = copy_from_user(dp, (void *) arg, siz); |
139 | if (rv) return COPYFAIL; | 140 | if (rv) |
140 | else return rv; | 141 | return COPYFAIL; |
142 | else | ||
143 | return rv; | ||
141 | } | 144 | } |
142 | 145 | ||
143 | static int copyout (caddr_t dp, int arg, int siz) | 146 | static int copyout(caddr_t dp, int arg, int siz) |
144 | { | 147 | { |
145 | int rv; | 148 | int rv; |
146 | 149 | ||
147 | rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *)arg, dp); | 150 | rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp); |
148 | rv = copy_to_user ((void *)arg, dp, siz); | 151 | rv = copy_to_user((void *) arg, dp, siz); |
149 | if (rv) return COPYFAIL; | 152 | if (rv) |
150 | else return rv; | 153 | return COPYFAIL; |
154 | else | ||
155 | return rv; | ||
151 | } | 156 | } |
152 | 157 | ||
153 | int | 158 | int riocontrol(p, dev, cmd, arg, su) |
154 | riocontrol(p, dev, cmd, arg, su) | 159 | struct rio_info *p; |
155 | struct rio_info * p; | 160 | dev_t dev; |
156 | dev_t dev; | 161 | int cmd; |
157 | int cmd; | 162 | caddr_t arg; |
158 | caddr_t arg; | 163 | int su; |
159 | int su; | ||
160 | { | 164 | { |
161 | uint Host; /* leave me unsigned! */ | 165 | uint Host; /* leave me unsigned! */ |
162 | uint port; /* and me! */ | 166 | uint port; /* and me! */ |
163 | struct Host *HostP; | 167 | struct Host *HostP; |
164 | ushort loop; | 168 | ushort loop; |
165 | int Entry; | 169 | int Entry; |
166 | struct Port *PortP; | 170 | struct Port *PortP; |
167 | PKT *PacketP; | 171 | PKT *PacketP; |
168 | int retval = 0; | 172 | int retval = 0; |
169 | unsigned long flags; | 173 | unsigned long flags; |
170 | 174 | ||
171 | func_enter (); | 175 | func_enter(); |
172 | 176 | ||
173 | /* Confuse the compiler to think that we've initialized these */ | 177 | /* Confuse the compiler to think that we've initialized these */ |
174 | Host=0; | 178 | Host = 0; |
175 | PortP = NULL; | 179 | PortP = NULL; |
176 | 180 | ||
177 | rio_dprintk (RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int)arg); | 181 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg); |
178 | 182 | ||
179 | switch (cmd) { | 183 | switch (cmd) { |
180 | /* | 184 | /* |
181 | ** RIO_SET_TIMER | 185 | ** RIO_SET_TIMER |
182 | ** | 186 | ** |
183 | ** Change the value of the host card interrupt timer. | 187 | ** Change the value of the host card interrupt timer. |
184 | ** If the host card number is -1 then all host cards are changed | 188 | ** If the host card number is -1 then all host cards are changed |
185 | ** otherwise just the specified host card will be changed. | 189 | ** otherwise just the specified host card will be changed. |
186 | */ | 190 | */ |
187 | case RIO_SET_TIMER: | 191 | case RIO_SET_TIMER: |
188 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint)arg); | 192 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg); |
189 | { | 193 | { |
190 | int host, value; | 194 | int host, value; |
191 | host = (uint)arg >> 16; | 195 | host = (uint) arg >> 16; |
192 | value = (uint)arg & 0x0000ffff; | 196 | value = (uint) arg & 0x0000ffff; |
193 | if (host == -1) { | 197 | if (host == -1) { |
194 | for (host = 0; host < p->RIONumHosts; host++) { | 198 | for (host = 0; host < p->RIONumHosts; host++) { |
195 | if (p->RIOHosts[host].Flags == RC_RUNNING) { | 199 | if (p->RIOHosts[host].Flags == RC_RUNNING) { |
196 | WWORD(p->RIOHosts[host].ParmMapP->timer , value); | 200 | WWORD(p->RIOHosts[host].ParmMapP->timer, value); |
197 | } | ||
198 | } | ||
199 | } else if (host >= p->RIONumHosts) { | ||
200 | return -EINVAL; | ||
201 | } else { | ||
202 | if ( p->RIOHosts[host].Flags == RC_RUNNING ) { | ||
203 | WWORD(p->RIOHosts[host].ParmMapP->timer , value); | ||
204 | } | 201 | } |
205 | } | 202 | } |
206 | } | 203 | } else if (host >= p->RIONumHosts) { |
207 | return 0; | 204 | return -EINVAL; |
208 | 205 | } else { | |
209 | case RIO_IDENTIFY_DRIVER: | 206 | if (p->RIOHosts[host].Flags == RC_RUNNING) { |
210 | /* | 207 | WWORD(p->RIOHosts[host].ParmMapP->timer, value); |
211 | ** 15.10.1998 ARG - ESIL 0760 part fix | ||
212 | ** Added driver ident string output. | ||
213 | ** | ||
214 | #ifndef __THIS_RELEASE__ | ||
215 | #warning Driver Version string not defined ! | ||
216 | #endif | ||
217 | cprintf("%s %s %s %s\n", | ||
218 | RIO_DRV_STR, | ||
219 | __THIS_RELEASE__, | ||
220 | __DATE__, __TIME__ ); | ||
221 | |||
222 | return 0; | ||
223 | |||
224 | case RIO_DISPLAY_HOST_CFG: | ||
225 | ** | ||
226 | ** 15.10.1998 ARG - ESIL 0760 part fix | ||
227 | ** Added driver host card ident string output. | ||
228 | ** | ||
229 | ** Note that the only types currently supported | ||
230 | ** are ISA and PCI. Also this driver does not | ||
231 | ** (yet) distinguish between the Old PCI card | ||
232 | ** and the Jet PCI card. In fact I think this | ||
233 | ** driver only supports JET PCI ! | ||
234 | ** | ||
235 | |||
236 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
237 | { | ||
238 | HostP = &(p->RIOHosts[Host]); | ||
239 | |||
240 | switch ( HostP->Type ) | ||
241 | { | ||
242 | case RIO_AT : | ||
243 | strcpy( host_type, RIO_AT_HOST_STR ); | ||
244 | break; | ||
245 | |||
246 | case RIO_PCI : | ||
247 | strcpy( host_type, RIO_PCI_HOST_STR ); | ||
248 | break; | ||
249 | |||
250 | default : | ||
251 | strcpy( host_type, "Unknown" ); | ||
252 | break; | ||
253 | } | 208 | } |
209 | } | ||
210 | } | ||
211 | return 0; | ||
254 | 212 | ||
255 | cprintf( | 213 | case RIO_IDENTIFY_DRIVER: |
256 | "RIO Host %d - Type:%s Addr:%X IRQ:%d\n", | 214 | /* |
257 | Host, host_type, | 215 | ** 15.10.1998 ARG - ESIL 0760 part fix |
258 | (uint)HostP->PaddrP, | 216 | ** Added driver ident string output. |
259 | (int)HostP->Ivec - 32 ); | 217 | ** |
218 | #ifndef __THIS_RELEASE__ | ||
219 | #warning Driver Version string not defined ! | ||
220 | #endif | ||
221 | cprintf("%s %s %s %s\n", | ||
222 | RIO_DRV_STR, | ||
223 | __THIS_RELEASE__, | ||
224 | __DATE__, __TIME__ ); | ||
225 | |||
226 | return 0; | ||
227 | |||
228 | case RIO_DISPLAY_HOST_CFG: | ||
229 | ** | ||
230 | ** 15.10.1998 ARG - ESIL 0760 part fix | ||
231 | ** Added driver host card ident string output. | ||
232 | ** | ||
233 | ** Note that the only types currently supported | ||
234 | ** are ISA and PCI. Also this driver does not | ||
235 | ** (yet) distinguish between the Old PCI card | ||
236 | ** and the Jet PCI card. In fact I think this | ||
237 | ** driver only supports JET PCI ! | ||
238 | ** | ||
239 | |||
240 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
241 | { | ||
242 | HostP = &(p->RIOHosts[Host]); | ||
243 | |||
244 | switch ( HostP->Type ) | ||
245 | { | ||
246 | case RIO_AT : | ||
247 | strcpy( host_type, RIO_AT_HOST_STR ); | ||
248 | break; | ||
249 | |||
250 | case RIO_PCI : | ||
251 | strcpy( host_type, RIO_PCI_HOST_STR ); | ||
252 | break; | ||
253 | |||
254 | default : | ||
255 | strcpy( host_type, "Unknown" ); | ||
256 | break; | ||
257 | } | ||
258 | |||
259 | cprintf( | ||
260 | "RIO Host %d - Type:%s Addr:%X IRQ:%d\n", | ||
261 | Host, host_type, | ||
262 | (uint)HostP->PaddrP, | ||
263 | (int)HostP->Ivec - 32 ); | ||
264 | } | ||
265 | return 0; | ||
266 | ** | ||
267 | */ | ||
268 | |||
269 | case RIO_FOAD_RTA: | ||
270 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | ||
271 | return RIOCommandRta(p, (uint) arg, RIOFoadRta); | ||
272 | |||
273 | case RIO_ZOMBIE_RTA: | ||
274 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | ||
275 | return RIOCommandRta(p, (uint) arg, RIOZombieRta); | ||
276 | |||
277 | case RIO_IDENTIFY_RTA: | ||
278 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | ||
279 | return RIOIdentifyRta(p, arg); | ||
280 | |||
281 | case RIO_KILL_NEIGHBOUR: | ||
282 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | ||
283 | return RIOKillNeighbour(p, arg); | ||
284 | |||
285 | case SPECIAL_RUP_CMD: | ||
286 | { | ||
287 | struct CmdBlk *CmdBlkP; | ||
288 | |||
289 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | ||
290 | if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) { | ||
291 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | ||
292 | p->RIOError.Error = COPYIN_FAILED; | ||
293 | return -EFAULT; | ||
294 | } | ||
295 | CmdBlkP = RIOGetCmdBlk(); | ||
296 | if (!CmdBlkP) { | ||
297 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); | ||
298 | return -ENXIO; | ||
299 | } | ||
300 | CmdBlkP->Packet = SpecialRupCmd.Packet; | ||
301 | if (SpecialRupCmd.Host >= p->RIONumHosts) | ||
302 | SpecialRupCmd.Host = 0; | ||
303 | rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum); | ||
304 | if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { | ||
305 | cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); | ||
260 | } | 306 | } |
261 | return 0; | 307 | return 0; |
262 | ** | 308 | } |
263 | */ | ||
264 | |||
265 | case RIO_FOAD_RTA: | ||
266 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | ||
267 | return RIOCommandRta(p, (uint)arg, RIOFoadRta); | ||
268 | |||
269 | case RIO_ZOMBIE_RTA: | ||
270 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | ||
271 | return RIOCommandRta(p, (uint)arg, RIOZombieRta); | ||
272 | |||
273 | case RIO_IDENTIFY_RTA: | ||
274 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | ||
275 | return RIOIdentifyRta(p, arg); | ||
276 | |||
277 | case RIO_KILL_NEIGHBOUR: | ||
278 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | ||
279 | return RIOKillNeighbour(p, arg); | ||
280 | |||
281 | case SPECIAL_RUP_CMD: | ||
282 | { | ||
283 | struct CmdBlk *CmdBlkP; | ||
284 | |||
285 | rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | ||
286 | if (copyin((int)arg, (caddr_t)&SpecialRupCmd, | ||
287 | sizeof(SpecialRupCmd)) == COPYFAIL ) { | ||
288 | rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | ||
289 | p->RIOError.Error = COPYIN_FAILED; | ||
290 | return -EFAULT; | ||
291 | } | ||
292 | CmdBlkP = RIOGetCmdBlk(); | ||
293 | if ( !CmdBlkP ) { | ||
294 | rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); | ||
295 | return -ENXIO; | ||
296 | } | ||
297 | CmdBlkP->Packet = SpecialRupCmd.Packet; | ||
298 | if ( SpecialRupCmd.Host >= p->RIONumHosts ) | ||
299 | SpecialRupCmd.Host = 0; | ||
300 | rio_dprintk (RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", | ||
301 | SpecialRupCmd.Host, SpecialRupCmd.RupNum); | ||
302 | if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], | ||
303 | SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { | ||
304 | cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); | ||
305 | } | ||
306 | return 0; | ||
307 | } | ||
308 | 309 | ||
309 | case RIO_DEBUG_MEM: | 310 | case RIO_DEBUG_MEM: |
310 | #ifdef DEBUG_MEM_SUPPORT | 311 | #ifdef DEBUG_MEM_SUPPORT |
311 | RIO_DEBUG_CTRL, if (su) | 312 | RIO_DEBUG_CTRL, if (su) |
312 | return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); | 313 | return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); |
313 | else | 314 | else |
314 | #endif | 315 | #endif |
315 | return -EPERM; | 316 | return -EPERM; |
316 | |||
317 | case RIO_ALL_MODEM: | ||
318 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); | ||
319 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | ||
320 | return -EINVAL; | ||
321 | |||
322 | case RIO_GET_TABLE: | ||
323 | /* | ||
324 | ** Read the routing table from the device driver to user space | ||
325 | */ | ||
326 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); | ||
327 | 317 | ||
328 | if ((retval = RIOApel(p)) != 0) | 318 | case RIO_ALL_MODEM: |
329 | return retval; | 319 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); |
320 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | ||
321 | return -EINVAL; | ||
330 | 322 | ||
331 | if (copyout((caddr_t)p->RIOConnectTable, (int)arg, | 323 | case RIO_GET_TABLE: |
332 | TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) { | 324 | /* |
333 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | 325 | ** Read the routing table from the device driver to user space |
334 | p->RIOError.Error = COPYOUT_FAILED; | 326 | */ |
335 | return -EFAULT; | 327 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); |
336 | } | 328 | |
329 | if ((retval = RIOApel(p)) != 0) | ||
330 | return retval; | ||
331 | |||
332 | if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { | ||
333 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | ||
334 | p->RIOError.Error = COPYOUT_FAILED; | ||
335 | return -EFAULT; | ||
336 | } | ||
337 | |||
338 | { | ||
339 | int entry; | ||
340 | rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); | ||
341 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { | ||
342 | if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0)) | ||
343 | continue; | ||
344 | |||
345 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum); | ||
346 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum); | ||
347 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID); | ||
348 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2); | ||
349 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags); | ||
350 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort); | ||
351 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit); | ||
352 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link); | ||
353 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit); | ||
354 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link); | ||
355 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit); | ||
356 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link); | ||
357 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit); | ||
358 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link); | ||
359 | rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name); | ||
360 | } | ||
361 | rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n"); | ||
362 | } | ||
363 | p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ | ||
364 | return 0; | ||
337 | 365 | ||
338 | { | 366 | case RIO_PUT_TABLE: |
339 | int entry; | 367 | /* |
340 | rio_dprintk (RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); | 368 | ** Write the routing table to the device driver from user space |
341 | for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ ) | 369 | */ |
342 | { | 370 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); |
343 | if ((p->RIOConnectTable[entry].ID == 0) && | 371 | |
344 | (p->RIOConnectTable[entry].HostUniqueNum == 0) && | 372 | if (!su) { |
345 | (p->RIOConnectTable[entry].RtaUniqueNum == 0)) continue; | 373 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); |
346 | 374 | p->RIOError.Error = NOT_SUPER_USER; | |
347 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ); | 375 | return -EPERM; |
348 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ); | 376 | } |
349 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ); | 377 | if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { |
350 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ); | 378 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); |
351 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int)p->RIOConnectTable[entry].Flags ); | 379 | p->RIOError.Error = COPYIN_FAILED; |
352 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int)p->RIOConnectTable[entry].SysPort ); | 380 | return -EFAULT; |
353 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ); | 381 | } |
354 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link ); | ||
355 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ); | ||
356 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link ); | ||
357 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ); | ||
358 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link ); | ||
359 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ); | ||
360 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link ); | ||
361 | rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ); | ||
362 | } | ||
363 | rio_dprintk (RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n"); | ||
364 | } | ||
365 | p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ | ||
366 | return 0; | ||
367 | |||
368 | case RIO_PUT_TABLE: | ||
369 | /* | ||
370 | ** Write the routing table to the device driver from user space | ||
371 | */ | ||
372 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); | ||
373 | |||
374 | if ( !su ) { | ||
375 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); | ||
376 | p->RIOError.Error = NOT_SUPER_USER; | ||
377 | return -EPERM; | ||
378 | } | ||
379 | if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0], | ||
380 | TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) { | ||
381 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); | ||
382 | p->RIOError.Error = COPYIN_FAILED; | ||
383 | return -EFAULT; | ||
384 | } | ||
385 | /* | 382 | /* |
386 | *********************************** | 383 | *********************************** |
387 | { | 384 | { |
@@ -409,1353 +406,1244 @@ RIO_DEBUG_CTRL, if (su) | |||
409 | } | 406 | } |
410 | *********************************** | 407 | *********************************** |
411 | */ | 408 | */ |
412 | return RIONewTable(p); | 409 | return RIONewTable(p); |
413 | |||
414 | case RIO_GET_BINDINGS : | ||
415 | /* | ||
416 | ** Send bindings table, containing unique numbers of RTAs owned | ||
417 | ** by this system to user space | ||
418 | */ | ||
419 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); | ||
420 | 410 | ||
421 | if ( !su ) | 411 | case RIO_GET_BINDINGS: |
422 | { | 412 | /* |
423 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); | 413 | ** Send bindings table, containing unique numbers of RTAs owned |
424 | p->RIOError.Error = NOT_SUPER_USER; | 414 | ** by this system to user space |
425 | return -EPERM; | 415 | */ |
426 | } | 416 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); |
427 | if (copyout((caddr_t) p->RIOBindTab, (int)arg, | 417 | |
428 | (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) { | 418 | if (!su) { |
429 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | 419 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); |
430 | p->RIOError.Error = COPYOUT_FAILED; | 420 | p->RIOError.Error = NOT_SUPER_USER; |
431 | return -EFAULT; | 421 | return -EPERM; |
432 | } | 422 | } |
433 | return 0; | 423 | if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { |
434 | 424 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | |
435 | case RIO_PUT_BINDINGS : | 425 | p->RIOError.Error = COPYOUT_FAILED; |
426 | return -EFAULT; | ||
427 | } | ||
428 | return 0; | ||
429 | |||
430 | case RIO_PUT_BINDINGS: | ||
431 | /* | ||
432 | ** Receive a bindings table, containing unique numbers of RTAs owned | ||
433 | ** by this system | ||
434 | */ | ||
435 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); | ||
436 | |||
437 | if (!su) { | ||
438 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); | ||
439 | p->RIOError.Error = NOT_SUPER_USER; | ||
440 | return -EPERM; | ||
441 | } | ||
442 | if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { | ||
443 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | ||
444 | p->RIOError.Error = COPYIN_FAILED; | ||
445 | return -EFAULT; | ||
446 | } | ||
447 | return 0; | ||
448 | |||
449 | case RIO_BIND_RTA: | ||
450 | { | ||
451 | int EmptySlot = -1; | ||
436 | /* | 452 | /* |
437 | ** Receive a bindings table, containing unique numbers of RTAs owned | 453 | ** Bind this RTA to host, so that it will be booted by |
438 | ** by this system | 454 | ** host in 'boot owned RTAs' mode. |
439 | */ | 455 | */ |
440 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); | 456 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); |
441 | 457 | ||
442 | if ( !su ) | 458 | if (!su) { |
443 | { | 459 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); |
444 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); | 460 | p->RIOError.Error = NOT_SUPER_USER; |
445 | p->RIOError.Error = NOT_SUPER_USER; | 461 | return -EPERM; |
446 | return -EPERM; | 462 | } |
447 | } | 463 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { |
448 | if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0], | 464 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) |
449 | (sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) { | 465 | EmptySlot = Entry; |
450 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | 466 | else if (p->RIOBindTab[Entry] == (int) arg) { |
451 | p->RIOError.Error = COPYIN_FAILED; | ||
452 | return -EFAULT; | ||
453 | } | ||
454 | return 0; | ||
455 | |||
456 | case RIO_BIND_RTA : | ||
457 | { | ||
458 | int EmptySlot = -1; | ||
459 | /* | ||
460 | ** Bind this RTA to host, so that it will be booted by | ||
461 | ** host in 'boot owned RTAs' mode. | ||
462 | */ | ||
463 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); | ||
464 | |||
465 | if ( !su ) { | ||
466 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); | ||
467 | p->RIOError.Error = NOT_SUPER_USER; | ||
468 | return -EPERM; | ||
469 | } | ||
470 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { | ||
471 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) | ||
472 | EmptySlot = Entry; | ||
473 | else if (p->RIOBindTab[Entry] == (int) arg) { | ||
474 | /* | ||
475 | ** Already exists - delete | ||
476 | */ | ||
477 | p->RIOBindTab[Entry] = 0L; | ||
478 | rio_dprintk (RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", | ||
479 | (int) arg); | ||
480 | return 0; | ||
481 | } | ||
482 | } | ||
483 | /* | 467 | /* |
484 | ** Dosen't exist - add | 468 | ** Already exists - delete |
485 | */ | 469 | */ |
486 | if (EmptySlot != -1) { | 470 | p->RIOBindTab[Entry] = 0L; |
487 | p->RIOBindTab[EmptySlot] = (int) arg; | 471 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg); |
488 | rio_dprintk (RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", | ||
489 | (int) arg); | ||
490 | } | ||
491 | else { | ||
492 | rio_dprintk (RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", | ||
493 | (int) arg); | ||
494 | return -ENOMEM; | ||
495 | } | ||
496 | return 0; | 472 | return 0; |
497 | } | 473 | } |
498 | 474 | } | |
499 | case RIO_RESUME : | 475 | /* |
500 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME\n"); | 476 | ** Dosen't exist - add |
501 | port = (uint) arg; | 477 | */ |
502 | if ((port < 0) || (port > 511)) { | 478 | if (EmptySlot != -1) { |
503 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); | 479 | p->RIOBindTab[EmptySlot] = (int) arg; |
504 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 480 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg); |
505 | return -EINVAL; | 481 | } else { |
506 | } | 482 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg); |
507 | PortP = p->RIOPortp[port]; | 483 | return -ENOMEM; |
508 | if (!PortP->Mapped) { | 484 | } |
509 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); | 485 | return 0; |
510 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; | 486 | } |
511 | return -EINVAL; | 487 | |
512 | } | 488 | case RIO_RESUME: |
513 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { | 489 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); |
514 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); | 490 | port = (uint) arg; |
515 | return -EINVAL; | 491 | if ((port < 0) || (port > 511)) { |
516 | } | 492 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); |
517 | 493 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | |
518 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 494 | return -EINVAL; |
519 | if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == | 495 | } |
520 | RIO_FAIL) { | 496 | PortP = p->RIOPortp[port]; |
521 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); | 497 | if (!PortP->Mapped) { |
522 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 498 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); |
523 | return -EBUSY; | 499 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; |
524 | } | 500 | return -EINVAL; |
525 | else { | 501 | } |
526 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); | 502 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
527 | PortP->State |= RIO_BUSY; | 503 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); |
528 | } | 504 | return -EINVAL; |
529 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 505 | } |
530 | return retval; | 506 | |
531 | 507 | rio_spin_lock_irqsave(&PortP->portSem, flags); | |
532 | case RIO_ASSIGN_RTA: | 508 | if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) { |
533 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); | 509 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); |
534 | if ( !su ) { | 510 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
535 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); | 511 | return -EBUSY; |
536 | p->RIOError.Error = NOT_SUPER_USER; | 512 | } else { |
537 | return -EPERM; | 513 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); |
538 | } | 514 | PortP->State |= RIO_BUSY; |
539 | if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) | 515 | } |
540 | == COPYFAIL) { | 516 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
541 | rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 517 | return retval; |
542 | p->RIOError.Error = COPYIN_FAILED; | 518 | |
543 | return -EFAULT; | 519 | case RIO_ASSIGN_RTA: |
544 | } | 520 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); |
545 | return RIOAssignRta(p, &MapEnt); | 521 | if (!su) { |
546 | 522 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); | |
547 | case RIO_CHANGE_NAME: | 523 | p->RIOError.Error = NOT_SUPER_USER; |
548 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); | 524 | return -EPERM; |
549 | if ( !su ) { | 525 | } |
550 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); | 526 | if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) |
551 | p->RIOError.Error = NOT_SUPER_USER; | 527 | == COPYFAIL) { |
552 | return -EPERM; | 528 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
553 | } | 529 | p->RIOError.Error = COPYIN_FAILED; |
554 | if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) | 530 | return -EFAULT; |
555 | == COPYFAIL) { | 531 | } |
556 | rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 532 | return RIOAssignRta(p, &MapEnt); |
557 | p->RIOError.Error = COPYIN_FAILED; | 533 | |
558 | return -EFAULT; | 534 | case RIO_CHANGE_NAME: |
559 | } | 535 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); |
560 | return RIOChangeName(p, &MapEnt); | 536 | if (!su) { |
561 | 537 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); | |
562 | case RIO_DELETE_RTA: | 538 | p->RIOError.Error = NOT_SUPER_USER; |
563 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); | 539 | return -EPERM; |
564 | if ( !su ) { | 540 | } |
565 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); | 541 | if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) |
566 | p->RIOError.Error = NOT_SUPER_USER; | 542 | == COPYFAIL) { |
567 | return -EPERM; | 543 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
568 | } | 544 | p->RIOError.Error = COPYIN_FAILED; |
569 | if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) | 545 | return -EFAULT; |
570 | == COPYFAIL ) { | 546 | } |
571 | rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n"); | 547 | return RIOChangeName(p, &MapEnt); |
572 | p->RIOError.Error = COPYIN_FAILED; | 548 | |
573 | return -EFAULT; | 549 | case RIO_DELETE_RTA: |
574 | } | 550 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); |
575 | return RIODeleteRta(p, &MapEnt); | 551 | if (!su) { |
576 | 552 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); | |
577 | case RIO_QUICK_CHECK: | 553 | p->RIOError.Error = NOT_SUPER_USER; |
578 | /* | 554 | return -EPERM; |
579 | ** 09.12.1998 ARG - ESIL 0776 part fix | 555 | } |
580 | ** A customer was using this to get the RTAs | 556 | if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) |
581 | ** connect/disconnect status. | 557 | == COPYFAIL) { |
582 | ** RIOConCon() had been botched use RIOHalted | 558 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); |
583 | ** to keep track of RTA connections and | 559 | p->RIOError.Error = COPYIN_FAILED; |
584 | ** disconnections. That has been changed and | 560 | return -EFAULT; |
585 | ** RIORtaDisCons in the rio_info struct now | 561 | } |
586 | ** does the job. So we need to return the value | 562 | return RIODeleteRta(p, &MapEnt); |
587 | ** of RIORtaCons instead of RIOHalted. | 563 | |
588 | ** | 564 | case RIO_QUICK_CHECK: |
589 | if (copyout((caddr_t)&p->RIOHalted,(int)arg, | 565 | /* |
590 | sizeof(uint))==COPYFAIL) { | 566 | ** 09.12.1998 ARG - ESIL 0776 part fix |
591 | ** | 567 | ** A customer was using this to get the RTAs |
592 | */ | 568 | ** connect/disconnect status. |
593 | 569 | ** RIOConCon() had been botched use RIOHalted | |
594 | if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg, | 570 | ** to keep track of RTA connections and |
595 | sizeof(uint))==COPYFAIL) { | 571 | ** disconnections. That has been changed and |
596 | p->RIOError.Error = COPYOUT_FAILED; | 572 | ** RIORtaDisCons in the rio_info struct now |
597 | return -EFAULT; | 573 | ** does the job. So we need to return the value |
598 | } | 574 | ** of RIORtaCons instead of RIOHalted. |
599 | return 0; | 575 | ** |
600 | 576 | if (copyout((caddr_t)&p->RIOHalted,(int)arg, | |
601 | case RIO_LAST_ERROR: | 577 | sizeof(uint))==COPYFAIL) { |
602 | if (copyout((caddr_t)&p->RIOError, (int)arg, | 578 | ** |
603 | sizeof(struct Error)) ==COPYFAIL ) | 579 | */ |
604 | return -EFAULT; | 580 | |
605 | return 0; | 581 | if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) { |
606 | 582 | p->RIOError.Error = COPYOUT_FAILED; | |
607 | case RIO_GET_LOG: | 583 | return -EFAULT; |
608 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); | 584 | } |
585 | return 0; | ||
586 | |||
587 | case RIO_LAST_ERROR: | ||
588 | if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL) | ||
589 | return -EFAULT; | ||
590 | return 0; | ||
591 | |||
592 | case RIO_GET_LOG: | ||
593 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); | ||
609 | #ifdef LOGGING | 594 | #ifdef LOGGING |
610 | RIOGetLog(arg); | 595 | RIOGetLog(arg); |
611 | return 0; | 596 | return 0; |
612 | #else | 597 | #else |
613 | return -EINVAL; | 598 | return -EINVAL; |
614 | #endif | 599 | #endif |
615 | 600 | ||
616 | case RIO_GET_MODTYPE: | 601 | case RIO_GET_MODTYPE: |
617 | if ( copyin( (int)arg, (caddr_t)&port, | 602 | if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { |
618 | sizeof(uint)) == COPYFAIL ) | 603 | p->RIOError.Error = COPYIN_FAILED; |
619 | { | 604 | return -EFAULT; |
620 | p->RIOError.Error = COPYIN_FAILED; | 605 | } |
621 | return -EFAULT; | 606 | rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port); |
622 | } | 607 | if (port < 0 || port > 511) { |
623 | rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port); | 608 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); |
624 | if ( port < 0 || port > 511 ) | 609 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
625 | { | 610 | return -EINVAL; |
626 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); | 611 | } |
627 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 612 | PortP = (p->RIOPortp[port]); |
628 | return -EINVAL; | 613 | if (!PortP->Mapped) { |
629 | } | 614 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); |
630 | PortP = (p->RIOPortp[port]); | 615 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; |
631 | if (!PortP->Mapped) | 616 | return -EINVAL; |
632 | { | 617 | } |
633 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); | 618 | /* |
634 | p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; | 619 | ** Return module type of port |
635 | return -EINVAL; | 620 | */ |
636 | } | 621 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; |
637 | /* | 622 | if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) { |
638 | ** Return module type of port | 623 | p->RIOError.Error = COPYOUT_FAILED; |
639 | */ | 624 | return -EFAULT; |
640 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; | 625 | } |
641 | if (copyout((caddr_t)&port, (int)arg, | 626 | return (0); |
642 | sizeof(uint)) == COPYFAIL) { | 627 | /* |
643 | p->RIOError.Error = COPYOUT_FAILED; | 628 | ** 02.03.1999 ARG - ESIL 0820 fix |
644 | return -EFAULT; | 629 | ** We are no longer using "Boot Mode", so these ioctls |
645 | } | 630 | ** are not required : |
646 | return(0); | 631 | ** |
647 | /* | 632 | case RIO_GET_BOOT_MODE : |
648 | ** 02.03.1999 ARG - ESIL 0820 fix | 633 | rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode)); |
649 | ** We are no longer using "Boot Mode", so these ioctls | 634 | ** |
650 | ** are not required : | 635 | ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE |
651 | ** | 636 | ** |
652 | case RIO_GET_BOOT_MODE : | 637 | if (copyout((caddr_t)&p->RIOBootMode, (int)arg, |
653 | rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode)); | 638 | sizeof(p->RIOBootMode)) == COPYFAIL) { |
654 | ** | 639 | p->RIOError.Error = COPYOUT_FAILED; |
655 | ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE | 640 | return -EFAULT; |
656 | ** | 641 | } |
657 | if (copyout((caddr_t)&p->RIOBootMode, (int)arg, | 642 | return(0); |
658 | sizeof(p->RIOBootMode)) == COPYFAIL) { | 643 | |
659 | p->RIOError.Error = COPYOUT_FAILED; | 644 | case RIO_SET_BOOT_MODE : |
660 | return -EFAULT; | 645 | p->RIOBootMode = (uint) arg; |
661 | } | 646 | rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode)); |
662 | return(0); | 647 | return(0); |
663 | 648 | ** | |
664 | case RIO_SET_BOOT_MODE : | 649 | ** End ESIL 0820 fix |
665 | p->RIOBootMode = (uint) arg; | 650 | */ |
666 | rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode)); | 651 | |
667 | return(0); | 652 | case RIO_BLOCK_OPENS: |
668 | ** | 653 | rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n"); |
669 | ** End ESIL 0820 fix | 654 | for (Entry = 0; Entry < RIO_PORTS; Entry++) { |
670 | */ | 655 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
671 | 656 | p->RIOPortp[Entry]->WaitUntilBooted = 1; | |
672 | case RIO_BLOCK_OPENS: | 657 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
673 | rio_dprintk (RIO_DEBUG_CTRL, "Opens block until booted\n"); | 658 | } |
674 | for ( Entry=0; Entry < RIO_PORTS; Entry++ ) { | 659 | return 0; |
675 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 660 | |
676 | p->RIOPortp[Entry]->WaitUntilBooted = 1; | 661 | case RIO_SETUP_PORTS: |
677 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 662 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); |
678 | } | 663 | if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) |
679 | return 0; | 664 | == COPYFAIL) { |
680 | 665 | p->RIOError.Error = COPYIN_FAILED; | |
681 | case RIO_SETUP_PORTS: | 666 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); |
682 | rio_dprintk (RIO_DEBUG_CTRL, "Setup ports\n"); | 667 | return -EFAULT; |
683 | if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) | 668 | } |
684 | == COPYFAIL ) { | 669 | if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) { |
685 | p->RIOError.Error = COPYIN_FAILED; | 670 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
686 | rio_dprintk (RIO_DEBUG_CTRL, "EFAULT"); | 671 | rio_dprintk(RIO_DEBUG_CTRL, "ENXIO"); |
687 | return -EFAULT; | 672 | return -ENXIO; |
688 | } | 673 | } |
689 | if ( PortSetup.From > PortSetup.To || | 674 | if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) { |
690 | PortSetup.To >= RIO_PORTS ) { | 675 | p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; |
691 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 676 | rio_dprintk(RIO_DEBUG_CTRL, "EINVAL"); |
692 | rio_dprintk (RIO_DEBUG_CTRL, "ENXIO"); | 677 | return -EINVAL; |
693 | return -ENXIO; | 678 | } |
694 | } | 679 | if (!p->RIOPortp) { |
695 | if ( PortSetup.XpCps > p->RIOConf.MaxXpCps || | 680 | cprintf("No p->RIOPortp array!\n"); |
696 | PortSetup.XpCps < p->RIOConf.MinXpCps ) { | 681 | rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); |
697 | p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; | 682 | return -EIO; |
698 | rio_dprintk (RIO_DEBUG_CTRL, "EINVAL"); | 683 | } |
699 | return -EINVAL; | 684 | rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); |
700 | } | 685 | for (loop = PortSetup.From; loop <= PortSetup.To; loop++) { |
701 | if ( !p->RIOPortp ) { | 686 | rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); |
702 | cprintf("No p->RIOPortp array!\n"); | ||
703 | rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); | ||
704 | return -EIO; | ||
705 | } | ||
706 | rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); | ||
707 | for (loop=PortSetup.From; loop<=PortSetup.To; loop++) { | ||
708 | rio_dprintk (RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); | ||
709 | #if 0 | 687 | #if 0 |
710 | PortP = p->RIOPortp[loop]; | 688 | PortP = p->RIOPortp[loop]; |
711 | if ( !PortP->TtyP ) | 689 | if (!PortP->TtyP) |
712 | PortP->TtyP = &p->channel[loop]; | 690 | PortP->TtyP = &p->channel[loop]; |
713 | 691 | ||
714 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 692 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
715 | if ( PortSetup.IxAny ) | 693 | if (PortSetup.IxAny) |
716 | PortP->Config |= RIO_IXANY; | 694 | PortP->Config |= RIO_IXANY; |
717 | else | 695 | else |
718 | PortP->Config &= ~RIO_IXANY; | 696 | PortP->Config &= ~RIO_IXANY; |
719 | if ( PortSetup.IxOn ) | 697 | if (PortSetup.IxOn) |
720 | PortP->Config |= RIO_IXON; | 698 | PortP->Config |= RIO_IXON; |
721 | else | 699 | else |
722 | PortP->Config &= ~RIO_IXON; | 700 | PortP->Config &= ~RIO_IXON; |
723 | |||
724 | /* | ||
725 | ** If the port needs to wait for all a processes output | ||
726 | ** to drain before closing then this flag will be set. | ||
727 | */ | ||
728 | if (PortSetup.Drain) { | ||
729 | PortP->Config |= RIO_WAITDRAIN; | ||
730 | } else { | ||
731 | PortP->Config &= ~RIO_WAITDRAIN; | ||
732 | } | ||
733 | /* | ||
734 | ** Store settings if locking or unlocking port or if the | ||
735 | ** port is not locked, when setting the store option. | ||
736 | */ | ||
737 | if (PortP->Mapped && | ||
738 | ((PortSetup.Lock && !PortP->Lock) || | ||
739 | (!PortP->Lock && | ||
740 | (PortSetup.Store && !PortP->Store)))) { | ||
741 | PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag; | ||
742 | PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag; | ||
743 | PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag; | ||
744 | PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag; | ||
745 | PortP->StoredTty.line = PortP->TtyP->tm.c_line; | ||
746 | bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, | ||
747 | NCC + 5); | ||
748 | } | ||
749 | PortP->Lock = PortSetup.Lock; | ||
750 | PortP->Store = PortSetup.Store; | ||
751 | PortP->Xprint.XpCps = PortSetup.XpCps; | ||
752 | bcopy(PortSetup.XpOn,PortP->Xprint.XpOn,MAX_XP_CTRL_LEN); | ||
753 | bcopy(PortSetup.XpOff,PortP->Xprint.XpOff,MAX_XP_CTRL_LEN); | ||
754 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; | ||
755 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; | ||
756 | PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+ | ||
757 | RIOStrlen(PortP->Xprint.XpOff); | ||
758 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
759 | #endif | ||
760 | } | ||
761 | rio_dprintk (RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); | ||
762 | rio_dprintk (RIO_DEBUG_CTRL, "Retval:%x\n", retval); | ||
763 | return retval; | ||
764 | |||
765 | case RIO_GET_PORT_SETUP : | ||
766 | rio_dprintk (RIO_DEBUG_CTRL, "Get port setup\n"); | ||
767 | if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) | ||
768 | == COPYFAIL ) { | ||
769 | p->RIOError.Error = COPYIN_FAILED; | ||
770 | return -EFAULT; | ||
771 | } | ||
772 | if ( PortSetup.From >= RIO_PORTS ) { | ||
773 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
774 | return -ENXIO; | ||
775 | } | ||
776 | 701 | ||
777 | port = PortSetup.To = PortSetup.From; | 702 | /* |
778 | PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? | 703 | ** If the port needs to wait for all a processes output |
779 | 1 : 0; | 704 | ** to drain before closing then this flag will be set. |
780 | PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? | 705 | */ |
781 | 1 : 0; | 706 | if (PortSetup.Drain) { |
782 | PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? | 707 | PortP->Config |= RIO_WAITDRAIN; |
783 | 1 : 0; | 708 | } else { |
784 | PortSetup.Store = p->RIOPortp[port]->Store; | 709 | PortP->Config &= ~RIO_WAITDRAIN; |
785 | PortSetup.Lock = p->RIOPortp[port]->Lock; | 710 | } |
786 | PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; | 711 | /* |
787 | bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, | 712 | ** Store settings if locking or unlocking port or if the |
788 | MAX_XP_CTRL_LEN); | 713 | ** port is not locked, when setting the store option. |
789 | bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, | 714 | */ |
790 | MAX_XP_CTRL_LEN); | 715 | if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) { |
791 | PortSetup.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; | 716 | PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag; |
792 | PortSetup.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; | 717 | PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag; |
793 | 718 | PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag; | |
794 | if ( copyout((caddr_t)&PortSetup,(int)arg,sizeof(PortSetup)) | 719 | PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag; |
795 | ==COPYFAIL ) { | 720 | PortP->StoredTty.line = PortP->TtyP->tm.c_line; |
796 | p->RIOError.Error = COPYOUT_FAILED; | 721 | bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5); |
797 | return -EFAULT; | 722 | } |
798 | } | 723 | PortP->Lock = PortSetup.Lock; |
799 | return retval; | 724 | PortP->Store = PortSetup.Store; |
800 | 725 | PortP->Xprint.XpCps = PortSetup.XpCps; | |
801 | case RIO_GET_PORT_PARAMS : | 726 | bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN); |
802 | rio_dprintk (RIO_DEBUG_CTRL, "Get port params\n"); | 727 | bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN); |
803 | if (copyin( (int)arg, (caddr_t)&PortParams, | 728 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; |
804 | sizeof(struct PortParams)) == COPYFAIL) { | 729 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; |
805 | p->RIOError.Error = COPYIN_FAILED; | 730 | PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff); |
806 | return -EFAULT; | 731 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
807 | } | 732 | #endif |
808 | if (PortParams.Port >= RIO_PORTS) { | 733 | } |
809 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 734 | rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); |
810 | return -ENXIO; | 735 | rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval); |
811 | } | 736 | return retval; |
812 | PortP = (p->RIOPortp[PortParams.Port]); | 737 | |
813 | PortParams.Config = PortP->Config; | 738 | case RIO_GET_PORT_SETUP: |
814 | PortParams.State = PortP->State; | 739 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); |
815 | rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | 740 | if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) |
816 | 741 | == COPYFAIL) { | |
817 | if (copyout((caddr_t)&PortParams, (int)arg, | 742 | p->RIOError.Error = COPYIN_FAILED; |
818 | sizeof(struct PortParams)) == COPYFAIL ) { | 743 | return -EFAULT; |
819 | p->RIOError.Error = COPYOUT_FAILED; | 744 | } |
820 | return -EFAULT; | 745 | if (PortSetup.From >= RIO_PORTS) { |
821 | } | 746 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
822 | return retval; | 747 | return -ENXIO; |
823 | 748 | } | |
824 | case RIO_GET_PORT_TTY : | 749 | |
825 | rio_dprintk (RIO_DEBUG_CTRL, "Get port tty\n"); | 750 | port = PortSetup.To = PortSetup.From; |
826 | if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty)) | 751 | PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0; |
827 | == COPYFAIL) { | 752 | PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0; |
828 | p->RIOError.Error = COPYIN_FAILED; | 753 | PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0; |
829 | return -EFAULT; | 754 | PortSetup.Store = p->RIOPortp[port]->Store; |
830 | } | 755 | PortSetup.Lock = p->RIOPortp[port]->Lock; |
831 | if ( PortTty.port >= RIO_PORTS ) { | 756 | PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; |
832 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 757 | bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN); |
833 | return -ENXIO; | 758 | bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN); |
834 | } | 759 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; |
835 | 760 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | |
836 | rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | 761 | |
837 | PortP = (p->RIOPortp[PortTty.port]); | 762 | if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup)) |
763 | == COPYFAIL) { | ||
764 | p->RIOError.Error = COPYOUT_FAILED; | ||
765 | return -EFAULT; | ||
766 | } | ||
767 | return retval; | ||
768 | |||
769 | case RIO_GET_PORT_PARAMS: | ||
770 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); | ||
771 | if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) { | ||
772 | p->RIOError.Error = COPYIN_FAILED; | ||
773 | return -EFAULT; | ||
774 | } | ||
775 | if (PortParams.Port >= RIO_PORTS) { | ||
776 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
777 | return -ENXIO; | ||
778 | } | ||
779 | PortP = (p->RIOPortp[PortParams.Port]); | ||
780 | PortParams.Config = PortP->Config; | ||
781 | PortParams.State = PortP->State; | ||
782 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | ||
783 | |||
784 | if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) { | ||
785 | p->RIOError.Error = COPYOUT_FAILED; | ||
786 | return -EFAULT; | ||
787 | } | ||
788 | return retval; | ||
789 | |||
790 | case RIO_GET_PORT_TTY: | ||
791 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); | ||
792 | if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) | ||
793 | == COPYFAIL) { | ||
794 | p->RIOError.Error = COPYIN_FAILED; | ||
795 | return -EFAULT; | ||
796 | } | ||
797 | if (PortTty.port >= RIO_PORTS) { | ||
798 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
799 | return -ENXIO; | ||
800 | } | ||
801 | |||
802 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | ||
803 | PortP = (p->RIOPortp[PortTty.port]); | ||
838 | #if 0 | 804 | #if 0 |
839 | PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; | 805 | PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; |
840 | PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag; | 806 | PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag; |
841 | PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag; | 807 | PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag; |
842 | PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag; | 808 | PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag; |
843 | #endif | 809 | #endif |
844 | if (copyout((caddr_t)&PortTty, (int)arg, | 810 | if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { |
845 | sizeof(struct PortTty)) == COPYFAIL) { | 811 | p->RIOError.Error = COPYOUT_FAILED; |
846 | p->RIOError.Error = COPYOUT_FAILED; | 812 | return -EFAULT; |
847 | return -EFAULT; | 813 | } |
848 | } | 814 | return retval; |
849 | return retval; | 815 | |
850 | 816 | case RIO_SET_PORT_TTY: | |
851 | case RIO_SET_PORT_TTY : | 817 | if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) { |
852 | if (copyin((int)arg, (caddr_t)&PortTty, | 818 | p->RIOError.Error = COPYIN_FAILED; |
853 | sizeof(struct PortTty)) == COPYFAIL) { | 819 | return -EFAULT; |
854 | p->RIOError.Error = COPYIN_FAILED; | 820 | } |
855 | return -EFAULT; | 821 | rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); |
856 | } | 822 | if (PortTty.port >= (ushort) RIO_PORTS) { |
857 | rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); | 823 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
858 | if (PortTty.port >= (ushort) RIO_PORTS) { | 824 | return -ENXIO; |
859 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 825 | } |
860 | return -ENXIO; | 826 | PortP = (p->RIOPortp[PortTty.port]); |
861 | } | ||
862 | PortP = (p->RIOPortp[PortTty.port]); | ||
863 | #if 0 | 827 | #if 0 |
864 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 828 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
865 | PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag; | 829 | PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag; |
866 | PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag; | 830 | PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag; |
867 | PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag; | 831 | PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag; |
868 | PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag; | 832 | PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag; |
869 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 833 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
870 | #endif | 834 | #endif |
871 | 835 | ||
872 | RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); | 836 | RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP); |
873 | return retval; | 837 | return retval; |
874 | 838 | ||
875 | case RIO_SET_PORT_PARAMS : | 839 | case RIO_SET_PORT_PARAMS: |
876 | rio_dprintk (RIO_DEBUG_CTRL, "Set port params\n"); | 840 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); |
877 | if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams)) | 841 | if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams)) |
878 | == COPYFAIL ) { | 842 | == COPYFAIL) { |
879 | p->RIOError.Error = COPYIN_FAILED; | 843 | p->RIOError.Error = COPYIN_FAILED; |
880 | return -EFAULT; | 844 | return -EFAULT; |
881 | } | 845 | } |
882 | if (PortParams.Port >= (ushort) RIO_PORTS) { | 846 | if (PortParams.Port >= (ushort) RIO_PORTS) { |
883 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 847 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
884 | return -ENXIO; | 848 | return -ENXIO; |
885 | } | 849 | } |
886 | PortP = (p->RIOPortp[PortParams.Port]); | 850 | PortP = (p->RIOPortp[PortParams.Port]); |
887 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 851 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
888 | PortP->Config = PortParams.Config; | 852 | PortP->Config = PortParams.Config; |
889 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 853 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
890 | return retval; | 854 | return retval; |
891 | 855 | ||
892 | case RIO_GET_PORT_STATS : | 856 | case RIO_GET_PORT_STATS: |
893 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); | 857 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); |
894 | if ( copyin((int)arg, (caddr_t)&portStats, | 858 | if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { |
895 | sizeof(struct portStats)) == COPYFAIL ) { | 859 | p->RIOError.Error = COPYIN_FAILED; |
896 | p->RIOError.Error = COPYIN_FAILED; | 860 | return -EFAULT; |
897 | return -EFAULT; | 861 | } |
898 | } | 862 | if (portStats.port >= RIO_PORTS) { |
899 | if ( portStats.port >= RIO_PORTS ) { | 863 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
900 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 864 | return -ENXIO; |
901 | return -ENXIO; | 865 | } |
902 | } | 866 | PortP = (p->RIOPortp[portStats.port]); |
903 | PortP = (p->RIOPortp[portStats.port]); | 867 | portStats.gather = PortP->statsGather; |
904 | portStats.gather = PortP->statsGather; | 868 | portStats.txchars = PortP->txchars; |
905 | portStats.txchars = PortP->txchars; | 869 | portStats.rxchars = PortP->rxchars; |
906 | portStats.rxchars = PortP->rxchars; | 870 | portStats.opens = PortP->opens; |
907 | portStats.opens = PortP->opens; | 871 | portStats.closes = PortP->closes; |
908 | portStats.closes = PortP->closes; | 872 | portStats.ioctls = PortP->ioctls; |
909 | portStats.ioctls = PortP->ioctls; | 873 | if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) { |
910 | if ( copyout((caddr_t)&portStats, (int)arg, | 874 | p->RIOError.Error = COPYOUT_FAILED; |
911 | sizeof(struct portStats)) == COPYFAIL ) { | 875 | return -EFAULT; |
912 | p->RIOError.Error = COPYOUT_FAILED; | 876 | } |
913 | return -EFAULT; | 877 | return retval; |
914 | } | 878 | |
915 | return retval; | 879 | case RIO_RESET_PORT_STATS: |
916 | 880 | port = (uint) arg; | |
917 | case RIO_RESET_PORT_STATS : | 881 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); |
918 | port = (uint) arg; | 882 | if (port >= RIO_PORTS) { |
919 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); | 883 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
920 | if ( port >= RIO_PORTS ) { | 884 | return -ENXIO; |
921 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 885 | } |
922 | return -ENXIO; | 886 | PortP = (p->RIOPortp[port]); |
923 | } | 887 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
924 | PortP = (p->RIOPortp[port]); | 888 | PortP->txchars = 0; |
925 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 889 | PortP->rxchars = 0; |
926 | PortP->txchars = 0; | 890 | PortP->opens = 0; |
927 | PortP->rxchars = 0; | 891 | PortP->closes = 0; |
928 | PortP->opens = 0; | 892 | PortP->ioctls = 0; |
929 | PortP->closes = 0; | 893 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
930 | PortP->ioctls = 0; | 894 | return retval; |
931 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 895 | |
932 | return retval; | 896 | case RIO_GATHER_PORT_STATS: |
933 | 897 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | |
934 | case RIO_GATHER_PORT_STATS : | 898 | if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { |
935 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | 899 | p->RIOError.Error = COPYIN_FAILED; |
936 | if ( copyin( (int)arg, (caddr_t)&portStats, | 900 | return -EFAULT; |
937 | sizeof(struct portStats)) == COPYFAIL ) { | 901 | } |
938 | p->RIOError.Error = COPYIN_FAILED; | 902 | if (portStats.port >= RIO_PORTS) { |
939 | return -EFAULT; | 903 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
940 | } | 904 | return -ENXIO; |
941 | if ( portStats.port >= RIO_PORTS ) { | 905 | } |
942 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 906 | PortP = (p->RIOPortp[portStats.port]); |
943 | return -ENXIO; | 907 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
944 | } | 908 | PortP->statsGather = portStats.gather; |
945 | PortP = (p->RIOPortp[portStats.port]); | 909 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
946 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 910 | return retval; |
947 | PortP->statsGather = portStats.gather; | ||
948 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
949 | return retval; | ||
950 | 911 | ||
951 | #ifdef DEBUG_SUPPORTED | 912 | #ifdef DEBUG_SUPPORTED |
952 | case RIO_READ_LEVELS: | 913 | case RIO_READ_LEVELS: |
953 | { | 914 | { |
954 | int num; | 915 | int num; |
955 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); | 916 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); |
956 | for ( num=0; RIODbInf[num].Flag; num++ ) ; | 917 | for (num = 0; RIODbInf[num].Flag; num++); |
957 | rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copy\n",num); | 918 | rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num); |
958 | if (copyout((caddr_t)RIODbInf,(int)arg, | 919 | if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) { |
959 | sizeof(struct DbInf)*(num+1))==COPYFAIL) { | 920 | rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); |
960 | rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); | 921 | p->RIOError.Error = COPYOUT_FAILED; |
961 | p->RIOError.Error = COPYOUT_FAILED; | 922 | return -EFAULT; |
962 | return -EFAULT; | 923 | } |
963 | } | 924 | rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num); |
964 | rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num); | 925 | return retval; |
965 | return retval; | 926 | } |
966 | } | ||
967 | #endif | 927 | #endif |
968 | 928 | ||
969 | case RIO_READ_CONFIG: | 929 | case RIO_READ_CONFIG: |
970 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); | 930 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); |
971 | if (copyout((caddr_t)&p->RIOConf, (int)arg, | 931 | if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { |
972 | sizeof(struct Conf)) ==COPYFAIL ) { | 932 | p->RIOError.Error = COPYOUT_FAILED; |
973 | p->RIOError.Error = COPYOUT_FAILED; | 933 | return -EFAULT; |
974 | return -EFAULT; | 934 | } |
975 | } | 935 | return retval; |
976 | return retval; | 936 | |
977 | 937 | case RIO_SET_CONFIG: | |
978 | case RIO_SET_CONFIG: | 938 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); |
979 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); | 939 | if (!su) { |
980 | if ( !su ) { | 940 | p->RIOError.Error = NOT_SUPER_USER; |
981 | p->RIOError.Error = NOT_SUPER_USER; | 941 | return -EPERM; |
982 | return -EPERM; | 942 | } |
943 | if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf)) | ||
944 | == COPYFAIL) { | ||
945 | p->RIOError.Error = COPYIN_FAILED; | ||
946 | return -EFAULT; | ||
947 | } | ||
948 | /* | ||
949 | ** move a few value around | ||
950 | */ | ||
951 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
952 | if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING) | ||
953 | WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer); | ||
954 | return retval; | ||
955 | |||
956 | case RIO_START_POLLER: | ||
957 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); | ||
958 | return -EINVAL; | ||
959 | |||
960 | case RIO_STOP_POLLER: | ||
961 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); | ||
962 | if (!su) { | ||
963 | p->RIOError.Error = NOT_SUPER_USER; | ||
964 | return -EPERM; | ||
965 | } | ||
966 | p->RIOPolling = NOT_POLLING; | ||
967 | return retval; | ||
968 | |||
969 | case RIO_SETDEBUG: | ||
970 | case RIO_GETDEBUG: | ||
971 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | ||
972 | if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl)) | ||
973 | == COPYFAIL) { | ||
974 | p->RIOError.Error = COPYIN_FAILED; | ||
975 | return -EFAULT; | ||
976 | } | ||
977 | if (DebugCtrl.SysPort == NO_PORT) { | ||
978 | if (cmd == RIO_SETDEBUG) { | ||
979 | if (!su) { | ||
980 | p->RIOError.Error = NOT_SUPER_USER; | ||
981 | return -EPERM; | ||
983 | } | 982 | } |
984 | if ( copyin((int)arg, (caddr_t)&p->RIOConf, sizeof(struct Conf) ) | 983 | p->rio_debug = DebugCtrl.Debug; |
985 | ==COPYFAIL ) { | 984 | p->RIODebugWait = DebugCtrl.Wait; |
986 | p->RIOError.Error = COPYIN_FAILED; | 985 | rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait); |
987 | return -EFAULT; | 986 | } else { |
987 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); | ||
988 | DebugCtrl.Debug = p->rio_debug; | ||
989 | DebugCtrl.Wait = p->RIODebugWait; | ||
990 | if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { | ||
991 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); | ||
992 | p->RIOError.Error = COPYOUT_FAILED; | ||
993 | return -EFAULT; | ||
988 | } | 994 | } |
989 | /* | 995 | } |
990 | ** move a few value around | 996 | } else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) { |
991 | */ | 997 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); |
992 | for (Host=0; Host < p->RIONumHosts; Host++) | 998 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
993 | if ( (p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING ) | 999 | return -ENXIO; |
994 | WWORD(p->RIOHosts[Host].ParmMapP->timer , | 1000 | } else if (cmd == RIO_SETDEBUG) { |
995 | p->RIOConf.Timer); | 1001 | if (!su) { |
996 | return retval; | 1002 | p->RIOError.Error = NOT_SUPER_USER; |
997 | 1003 | return -EPERM; | |
998 | case RIO_START_POLLER: | 1004 | } |
999 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); | 1005 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
1000 | return -EINVAL; | 1006 | p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; |
1007 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1008 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1009 | } else { | ||
1010 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1011 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | ||
1012 | if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { | ||
1013 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | ||
1014 | p->RIOError.Error = COPYOUT_FAILED; | ||
1015 | return -EFAULT; | ||
1016 | } | ||
1017 | } | ||
1018 | return retval; | ||
1001 | 1019 | ||
1002 | case RIO_STOP_POLLER: | 1020 | case RIO_VERSID: |
1003 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); | 1021 | /* |
1004 | if ( !su ) { | 1022 | ** Enquire about the release and version. |
1005 | p->RIOError.Error = NOT_SUPER_USER; | 1023 | ** We return MAX_VERSION_LEN bytes, being a |
1006 | return -EPERM; | 1024 | ** textual null terminated string. |
1007 | } | 1025 | */ |
1008 | p->RIOPolling = NOT_POLLING; | 1026 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); |
1009 | return retval; | 1027 | if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) { |
1010 | 1028 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | |
1011 | case RIO_SETDEBUG: | 1029 | p->RIOError.Error = COPYOUT_FAILED; |
1012 | case RIO_GETDEBUG: | 1030 | return -EFAULT; |
1013 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | 1031 | } |
1014 | if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) ) | 1032 | return retval; |
1015 | ==COPYFAIL ) { | ||
1016 | p->RIOError.Error = COPYIN_FAILED; | ||
1017 | return -EFAULT; | ||
1018 | } | ||
1019 | if ( DebugCtrl.SysPort == NO_PORT ) { | ||
1020 | if ( cmd == RIO_SETDEBUG ) { | ||
1021 | if ( !su ) { | ||
1022 | p->RIOError.Error = NOT_SUPER_USER; | ||
1023 | return -EPERM; | ||
1024 | } | ||
1025 | p->rio_debug = DebugCtrl.Debug; | ||
1026 | p->RIODebugWait = DebugCtrl.Wait; | ||
1027 | rio_dprintk (RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", | ||
1028 | p->rio_debug,p->RIODebugWait); | ||
1029 | } | ||
1030 | else { | ||
1031 | rio_dprintk (RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", | ||
1032 | p->rio_debug,p->RIODebugWait); | ||
1033 | DebugCtrl.Debug = p->rio_debug; | ||
1034 | DebugCtrl.Wait = p->RIODebugWait; | ||
1035 | if ( copyout((caddr_t)&DebugCtrl,(int)arg, | ||
1036 | sizeof(DebugCtrl)) == COPYFAIL ) { | ||
1037 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", | ||
1038 | DebugCtrl.SysPort); | ||
1039 | p->RIOError.Error = COPYOUT_FAILED; | ||
1040 | return -EFAULT; | ||
1041 | } | ||
1042 | } | ||
1043 | } | ||
1044 | else if ( DebugCtrl.SysPort >= RIO_PORTS && | ||
1045 | DebugCtrl.SysPort != NO_PORT ) { | ||
1046 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", | ||
1047 | DebugCtrl.SysPort); | ||
1048 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1049 | return -ENXIO; | ||
1050 | } | ||
1051 | else if ( cmd == RIO_SETDEBUG ) { | ||
1052 | if ( !su ) { | ||
1053 | p->RIOError.Error = NOT_SUPER_USER; | ||
1054 | return -EPERM; | ||
1055 | } | ||
1056 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1057 | p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; | ||
1058 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
1059 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", | ||
1060 | p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1061 | } | ||
1062 | else { | ||
1063 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", | ||
1064 | p->RIOPortp[DebugCtrl.SysPort]->Debug); | ||
1065 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | ||
1066 | if ( copyout((caddr_t)&DebugCtrl,(int)arg, | ||
1067 | sizeof(DebugCtrl))==COPYFAIL ) { | ||
1068 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | ||
1069 | p->RIOError.Error = COPYOUT_FAILED; | ||
1070 | return -EFAULT; | ||
1071 | } | ||
1072 | } | ||
1073 | return retval; | ||
1074 | |||
1075 | case RIO_VERSID: | ||
1076 | /* | ||
1077 | ** Enquire about the release and version. | ||
1078 | ** We return MAX_VERSION_LEN bytes, being a | ||
1079 | ** textual null terminated string. | ||
1080 | */ | ||
1081 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID\n"); | ||
1082 | if ( copyout( (caddr_t)RIOVersid(), | ||
1083 | (int)arg, | ||
1084 | sizeof(struct rioVersion) ) == COPYFAIL ) | ||
1085 | { | ||
1086 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | ||
1087 | p->RIOError.Error = COPYOUT_FAILED; | ||
1088 | return -EFAULT; | ||
1089 | } | ||
1090 | return retval; | ||
1091 | 1033 | ||
1092 | /* | 1034 | /* |
1093 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 1035 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1094 | ** !! commented out previous 'RIO_VERSID' functionality !! | 1036 | ** !! commented out previous 'RIO_VERSID' functionality !! |
1095 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 1037 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1096 | ** | 1038 | ** |
1097 | case RIO_VERSID: | 1039 | case RIO_VERSID: |
1098 | ** | 1040 | ** |
1099 | ** Enquire about the release and version. | 1041 | ** Enquire about the release and version. |
1100 | ** We return MAX_VERSION_LEN bytes, being a textual null | 1042 | ** We return MAX_VERSION_LEN bytes, being a textual null |
1101 | ** terminated string. | 1043 | ** terminated string. |
1102 | ** | 1044 | ** |
1103 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n")); | 1045 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n")); |
1104 | if (copyout((caddr_t)RIOVersid(), | 1046 | if (copyout((caddr_t)RIOVersid(), |
1105 | (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) { | 1047 | (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) { |
1106 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host)); | 1048 | rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host)); |
1107 | p->RIOError.Error = COPYOUT_FAILED; | 1049 | p->RIOError.Error = COPYOUT_FAILED; |
1108 | return -EFAULT; | 1050 | return -EFAULT; |
1109 | } | 1051 | } |
1110 | return retval; | 1052 | return retval; |
1111 | ** | 1053 | ** |
1112 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 1054 | ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1113 | */ | 1055 | */ |
1114 | 1056 | ||
1115 | case RIO_NUM_HOSTS: | 1057 | case RIO_NUM_HOSTS: |
1116 | /* | 1058 | /* |
1117 | ** Enquire as to the number of hosts located | 1059 | ** Enquire as to the number of hosts located |
1118 | ** at init time. | 1060 | ** at init time. |
1119 | */ | 1061 | */ |
1120 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); | 1062 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); |
1121 | if (copyout((caddr_t)&p->RIONumHosts, (int)arg, | 1063 | if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) { |
1122 | sizeof(p->RIONumHosts) )==COPYFAIL ) { | 1064 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); |
1123 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); | 1065 | p->RIOError.Error = COPYOUT_FAILED; |
1124 | p->RIOError.Error = COPYOUT_FAILED; | 1066 | return -EFAULT; |
1125 | return -EFAULT; | 1067 | } |
1126 | } | 1068 | return retval; |
1127 | return retval; | 1069 | |
1128 | 1070 | case RIO_HOST_FOAD: | |
1129 | case RIO_HOST_FOAD: | 1071 | /* |
1130 | /* | 1072 | ** Kill host. This may not be in the final version... |
1131 | ** Kill host. This may not be in the final version... | 1073 | */ |
1132 | */ | 1074 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg); |
1133 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int)arg); | 1075 | if (!su) { |
1134 | if ( !su ) { | 1076 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); |
1135 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); | 1077 | p->RIOError.Error = NOT_SUPER_USER; |
1136 | p->RIOError.Error = NOT_SUPER_USER; | 1078 | return -EPERM; |
1137 | return -EPERM; | 1079 | } |
1138 | } | 1080 | p->RIOHalted = 1; |
1139 | p->RIOHalted = 1; | 1081 | p->RIOSystemUp = 0; |
1140 | p->RIOSystemUp = 0; | 1082 | |
1141 | 1083 | for (Host = 0; Host < p->RIONumHosts; Host++) { | |
1142 | for ( Host=0; Host<p->RIONumHosts; Host++ ) { | 1084 | (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); |
1143 | (void)RIOBoardTest( p->RIOHosts[Host].PaddrP, | 1085 | bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); |
1144 | p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, | 1086 | p->RIOHosts[Host].Flags = RC_WAITING; |
1145 | p->RIOHosts[Host].Slot ); | ||
1146 | bzero( (caddr_t)&p->RIOHosts[Host].Flags, | ||
1147 | ((int)&p->RIOHosts[Host].____end_marker____) - | ||
1148 | ((int)&p->RIOHosts[Host].Flags) ); | ||
1149 | p->RIOHosts[Host].Flags = RC_WAITING; | ||
1150 | #if 0 | 1087 | #if 0 |
1151 | RIOSetupDataStructs(p); | 1088 | RIOSetupDataStructs(p); |
1152 | #endif | 1089 | #endif |
1153 | } | 1090 | } |
1154 | RIOFoadWakeup(p); | 1091 | RIOFoadWakeup(p); |
1155 | p->RIONumBootPkts = 0; | 1092 | p->RIONumBootPkts = 0; |
1156 | p->RIOBooting = 0; | 1093 | p->RIOBooting = 0; |
1157 | 1094 | ||
1158 | #ifdef RINGBUFFER_SUPPORT | 1095 | #ifdef RINGBUFFER_SUPPORT |
1159 | for( loop=0; loop<RIO_PORTS; loop++ ) | 1096 | for (loop = 0; loop < RIO_PORTS; loop++) |
1160 | if ( p->RIOPortp[loop]->TxRingBuffer ) | 1097 | if (p->RIOPortp[loop]->TxRingBuffer) |
1161 | sysfree((void *)p->RIOPortp[loop]->TxRingBuffer, | 1098 | sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize); |
1162 | RIOBufferSize ); | ||
1163 | #endif | 1099 | #endif |
1164 | #if 0 | 1100 | #if 0 |
1165 | bzero((caddr_t)&p->RIOPortp[0],RIO_PORTS*sizeof(struct Port)); | 1101 | bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port)); |
1166 | #else | 1102 | #else |
1167 | printk ("HEEEEELP!\n"); | 1103 | printk("HEEEEELP!\n"); |
1168 | #endif | 1104 | #endif |
1169 | 1105 | ||
1170 | for( loop=0; loop<RIO_PORTS; loop++ ) { | 1106 | for (loop = 0; loop < RIO_PORTS; loop++) { |
1171 | #if 0 | 1107 | #if 0 |
1172 | p->RIOPortp[loop]->TtyP = &p->channel[loop]; | 1108 | p->RIOPortp[loop]->TtyP = &p->channel[loop]; |
1173 | #endif | 1109 | #endif |
1174 | |||
1175 | spin_lock_init(&p->RIOPortp[loop]->portSem); | ||
1176 | p->RIOPortp[loop]->InUse = NOT_INUSE; | ||
1177 | } | ||
1178 | |||
1179 | p->RIOSystemUp = 0; | ||
1180 | return retval; | ||
1181 | |||
1182 | case RIO_DOWNLOAD: | ||
1183 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); | ||
1184 | if ( !su ) { | ||
1185 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); | ||
1186 | p->RIOError.Error = NOT_SUPER_USER; | ||
1187 | return -EPERM; | ||
1188 | } | ||
1189 | if ( copyin((int)arg, (caddr_t)&DownLoad, | ||
1190 | sizeof(DownLoad) )==COPYFAIL ) { | ||
1191 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); | ||
1192 | p->RIOError.Error = COPYIN_FAILED; | ||
1193 | return -EFAULT; | ||
1194 | } | ||
1195 | rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", | ||
1196 | DownLoad.ProductCode); | ||
1197 | |||
1198 | /* | ||
1199 | ** It is important that the product code is an unsigned object! | ||
1200 | */ | ||
1201 | if ( DownLoad.ProductCode > MAX_PRODUCT ) { | ||
1202 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", | ||
1203 | DownLoad.ProductCode); | ||
1204 | p->RIOError.Error = NO_SUCH_PRODUCT; | ||
1205 | return -ENXIO; | ||
1206 | } | ||
1207 | /* | ||
1208 | ** do something! | ||
1209 | */ | ||
1210 | retval = (*(RIOBootTable[DownLoad.ProductCode]))(p, &DownLoad); | ||
1211 | /* <-- Panic */ | ||
1212 | p->RIOHalted = 0; | ||
1213 | /* | ||
1214 | ** and go back, content with a job well completed. | ||
1215 | */ | ||
1216 | return retval; | ||
1217 | |||
1218 | case RIO_PARMS: | ||
1219 | { | ||
1220 | uint host; | ||
1221 | |||
1222 | if (copyin((int)arg, (caddr_t)&host, | ||
1223 | sizeof(host) ) == COPYFAIL ) { | ||
1224 | rio_dprintk (RIO_DEBUG_CTRL, | ||
1225 | "RIO_HOST_REQ: Copy in from user space failed\n"); | ||
1226 | p->RIOError.Error = COPYIN_FAILED; | ||
1227 | return -EFAULT; | ||
1228 | } | ||
1229 | /* | ||
1230 | ** Fetch the parmmap | ||
1231 | */ | ||
1232 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS\n"); | ||
1233 | if ( copyout( (caddr_t)p->RIOHosts[host].ParmMapP, | ||
1234 | (int)arg, sizeof(PARM_MAP) )==COPYFAIL ) { | ||
1235 | p->RIOError.Error = COPYOUT_FAILED; | ||
1236 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); | ||
1237 | return -EFAULT; | ||
1238 | } | ||
1239 | } | ||
1240 | return retval; | ||
1241 | |||
1242 | case RIO_HOST_REQ: | ||
1243 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); | ||
1244 | if (copyin((int)arg, (caddr_t)&HostReq, | ||
1245 | sizeof(HostReq) )==COPYFAIL ) { | ||
1246 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | ||
1247 | p->RIOError.Error = COPYIN_FAILED; | ||
1248 | return -EFAULT; | ||
1249 | } | ||
1250 | if ( HostReq.HostNum >= p->RIONumHosts ) { | ||
1251 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1252 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", | ||
1253 | HostReq.HostNum); | ||
1254 | return -ENXIO; | ||
1255 | } | ||
1256 | rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); | ||
1257 | 1110 | ||
1258 | if (copyout((caddr_t)&p->RIOHosts[HostReq.HostNum], | 1111 | spin_lock_init(&p->RIOPortp[loop]->portSem); |
1259 | (int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) { | 1112 | p->RIOPortp[loop]->InUse = NOT_INUSE; |
1260 | p->RIOError.Error = COPYOUT_FAILED; | 1113 | } |
1261 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); | 1114 | |
1262 | return -EFAULT; | 1115 | p->RIOSystemUp = 0; |
1263 | } | 1116 | return retval; |
1264 | return retval; | 1117 | |
1265 | 1118 | case RIO_DOWNLOAD: | |
1266 | case RIO_HOST_DPRAM: | 1119 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); |
1267 | rio_dprintk (RIO_DEBUG_CTRL, "Request for DPRAM\n"); | 1120 | if (!su) { |
1268 | if ( copyin( (int)arg, (caddr_t)&HostDpRam, | 1121 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); |
1269 | sizeof(HostDpRam) )==COPYFAIL ) { | 1122 | p->RIOError.Error = NOT_SUPER_USER; |
1270 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); | 1123 | return -EPERM; |
1271 | p->RIOError.Error = COPYIN_FAILED; | 1124 | } |
1272 | return -EFAULT; | 1125 | if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) { |
1273 | } | 1126 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); |
1274 | if ( HostDpRam.HostNum >= p->RIONumHosts ) { | 1127 | p->RIOError.Error = COPYIN_FAILED; |
1275 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | 1128 | return -EFAULT; |
1276 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", | 1129 | } |
1277 | HostDpRam.HostNum); | 1130 | rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode); |
1278 | return -ENXIO; | ||
1279 | } | ||
1280 | rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); | ||
1281 | |||
1282 | if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { | ||
1283 | int off; | ||
1284 | /* It's hardware like this that really gets on my tits. */ | ||
1285 | static unsigned char copy[sizeof(struct DpRam)]; | ||
1286 | for ( off=0; off<sizeof(struct DpRam); off++ ) | ||
1287 | copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; | ||
1288 | if ( copyout( (caddr_t)copy, (int)HostDpRam.DpRamP, | ||
1289 | sizeof(struct DpRam) ) == COPYFAIL ) { | ||
1290 | p->RIOError.Error = COPYOUT_FAILED; | ||
1291 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | ||
1292 | return -EFAULT; | ||
1293 | } | ||
1294 | } | ||
1295 | else if (copyout((caddr_t)p->RIOHosts[HostDpRam.HostNum].Caddr, | ||
1296 | (int)HostDpRam.DpRamP, | ||
1297 | sizeof(struct DpRam) ) == COPYFAIL ) { | ||
1298 | p->RIOError.Error = COPYOUT_FAILED; | ||
1299 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | ||
1300 | return -EFAULT; | ||
1301 | } | ||
1302 | return retval; | ||
1303 | |||
1304 | case RIO_SET_BUSY: | ||
1305 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); | ||
1306 | if ( (int)arg < 0 || (int)arg > 511 ) { | ||
1307 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg); | ||
1308 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1309 | return -EINVAL; | ||
1310 | } | ||
1311 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1312 | p->RIOPortp[(int)arg]->State |= RIO_BUSY; | ||
1313 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
1314 | return retval; | ||
1315 | |||
1316 | case RIO_HOST_PORT: | ||
1317 | /* | ||
1318 | ** The daemon want port information | ||
1319 | ** (probably for debug reasons) | ||
1320 | */ | ||
1321 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); | ||
1322 | if ( copyin((int)arg, (caddr_t)&PortReq, | ||
1323 | sizeof(PortReq) )==COPYFAIL ) { | ||
1324 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); | ||
1325 | p->RIOError.Error = COPYIN_FAILED; | ||
1326 | return -EFAULT; | ||
1327 | } | ||
1328 | |||
1329 | if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ | ||
1330 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", | ||
1331 | PortReq.SysPort); | ||
1332 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1333 | return -ENXIO; | ||
1334 | } | ||
1335 | rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); | ||
1336 | if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort], | ||
1337 | (int)PortReq.PortP, | ||
1338 | sizeof(struct Port) ) == COPYFAIL) { | ||
1339 | p->RIOError.Error = COPYOUT_FAILED; | ||
1340 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); | ||
1341 | return -EFAULT; | ||
1342 | } | ||
1343 | return retval; | ||
1344 | |||
1345 | case RIO_HOST_RUP: | ||
1346 | /* | ||
1347 | ** The daemon want rup information | ||
1348 | ** (probably for debug reasons) | ||
1349 | */ | ||
1350 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); | ||
1351 | if (copyin((int)arg, (caddr_t)&RupReq, | ||
1352 | sizeof(RupReq) )==COPYFAIL ) { | ||
1353 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | ||
1354 | p->RIOError.Error = COPYIN_FAILED; | ||
1355 | return -EFAULT; | ||
1356 | } | ||
1357 | if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ | ||
1358 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", | ||
1359 | RupReq.HostNum); | ||
1360 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1361 | return -ENXIO; | ||
1362 | } | ||
1363 | if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */ | ||
1364 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", | ||
1365 | RupReq.RupNum); | ||
1366 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1367 | return -EINVAL; | ||
1368 | } | ||
1369 | HostP = &p->RIOHosts[RupReq.HostNum]; | ||
1370 | |||
1371 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | ||
1372 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", | ||
1373 | RupReq.HostNum); | ||
1374 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
1375 | return -EIO; | ||
1376 | } | ||
1377 | rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", | ||
1378 | RupReq.RupNum,RupReq.HostNum); | ||
1379 | |||
1380 | if (copyout((caddr_t)HostP->UnixRups[RupReq.RupNum].RupP, | ||
1381 | (int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) { | ||
1382 | p->RIOError.Error = COPYOUT_FAILED; | ||
1383 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); | ||
1384 | return -EFAULT; | ||
1385 | } | ||
1386 | return retval; | ||
1387 | |||
1388 | case RIO_HOST_LPB: | ||
1389 | /* | ||
1390 | ** The daemon want lpb information | ||
1391 | ** (probably for debug reasons) | ||
1392 | */ | ||
1393 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); | ||
1394 | if (copyin((int)arg, (caddr_t)&LpbReq, | ||
1395 | sizeof(LpbReq) )==COPYFAIL ) { | ||
1396 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); | ||
1397 | p->RIOError.Error = COPYIN_FAILED; | ||
1398 | return -EFAULT; | ||
1399 | } | ||
1400 | if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ | ||
1401 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", | ||
1402 | LpbReq.Host); | ||
1403 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1404 | return -ENXIO; | ||
1405 | } | ||
1406 | if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */ | ||
1407 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", | ||
1408 | LpbReq.Link); | ||
1409 | p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; | ||
1410 | return -EINVAL; | ||
1411 | } | ||
1412 | HostP = &p->RIOHosts[LpbReq.Host]; | ||
1413 | |||
1414 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { | ||
1415 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", | ||
1416 | LpbReq.Host ); | ||
1417 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
1418 | return -EIO; | ||
1419 | } | ||
1420 | rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", | ||
1421 | LpbReq.Link, LpbReq.Host); | ||
1422 | |||
1423 | if (copyout((caddr_t)&HostP->LinkStrP[LpbReq.Link], | ||
1424 | (int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) { | ||
1425 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); | ||
1426 | p->RIOError.Error = COPYOUT_FAILED; | ||
1427 | return -EFAULT; | ||
1428 | } | ||
1429 | return retval; | ||
1430 | |||
1431 | /* | ||
1432 | ** Here 3 IOCTL's that allow us to change the way in which | ||
1433 | ** rio logs errors. send them just to syslog or send them | ||
1434 | ** to both syslog and console or send them to just the console. | ||
1435 | ** | ||
1436 | ** See RioStrBuf() in util.c for the other half. | ||
1437 | */ | ||
1438 | case RIO_SYSLOG_ONLY: | ||
1439 | p->RIOPrintLogState = PRINT_TO_LOG; /* Just syslog */ | ||
1440 | return 0; | ||
1441 | |||
1442 | case RIO_SYSLOG_CONS: | ||
1443 | p->RIOPrintLogState = PRINT_TO_LOG_CONS;/* syslog and console */ | ||
1444 | return 0; | ||
1445 | |||
1446 | case RIO_CONS_ONLY: | ||
1447 | p->RIOPrintLogState = PRINT_TO_CONS; /* Just console */ | ||
1448 | return 0; | ||
1449 | |||
1450 | case RIO_SIGNALS_ON: | ||
1451 | if ( p->RIOSignalProcess ) { | ||
1452 | p->RIOError.Error = SIGNALS_ALREADY_SET; | ||
1453 | return -EBUSY; | ||
1454 | } | ||
1455 | p->RIOSignalProcess = getpid(); | ||
1456 | p->RIOPrintDisabled = DONT_PRINT; | ||
1457 | return retval; | ||
1458 | |||
1459 | case RIO_SIGNALS_OFF: | ||
1460 | if ( p->RIOSignalProcess != getpid() ) { | ||
1461 | p->RIOError.Error = NOT_RECEIVING_PROCESS; | ||
1462 | return -EPERM; | ||
1463 | } | ||
1464 | rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n"); | ||
1465 | p->RIOSignalProcess = 0; | ||
1466 | return retval; | ||
1467 | |||
1468 | case RIO_SET_BYTE_MODE: | ||
1469 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1470 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1471 | p->RIOHosts[Host].Mode &= ~WORD_OPERATION; | ||
1472 | return retval; | ||
1473 | |||
1474 | case RIO_SET_WORD_MODE: | ||
1475 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1476 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1477 | p->RIOHosts[Host].Mode |= WORD_OPERATION; | ||
1478 | return retval; | ||
1479 | |||
1480 | case RIO_SET_FAST_BUS: | ||
1481 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1482 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1483 | p->RIOHosts[Host].Mode |= FAST_AT_BUS; | ||
1484 | return retval; | ||
1485 | |||
1486 | case RIO_SET_SLOW_BUS: | ||
1487 | for ( Host=0; Host<p->RIONumHosts; Host++ ) | ||
1488 | if ( p->RIOHosts[Host].Type == RIO_AT ) | ||
1489 | p->RIOHosts[Host].Mode &= ~FAST_AT_BUS; | ||
1490 | return retval; | ||
1491 | |||
1492 | case RIO_MAP_B50_TO_50: | ||
1493 | case RIO_MAP_B50_TO_57600: | ||
1494 | case RIO_MAP_B110_TO_110: | ||
1495 | case RIO_MAP_B110_TO_115200: | ||
1496 | rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping\n"); | ||
1497 | port = (uint) arg; | ||
1498 | if ( port < 0 || port > 511 ) { | ||
1499 | rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | ||
1500 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1501 | return -EINVAL; | ||
1502 | } | ||
1503 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1504 | switch( cmd ) | ||
1505 | { | ||
1506 | case RIO_MAP_B50_TO_50 : | ||
1507 | p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50; | ||
1508 | break; | ||
1509 | case RIO_MAP_B50_TO_57600 : | ||
1510 | p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50; | ||
1511 | break; | ||
1512 | case RIO_MAP_B110_TO_110 : | ||
1513 | p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110; | ||
1514 | break; | ||
1515 | case RIO_MAP_B110_TO_115200 : | ||
1516 | p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110; | ||
1517 | break; | ||
1518 | } | ||
1519 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | ||
1520 | return retval; | ||
1521 | |||
1522 | case RIO_STREAM_INFO: | ||
1523 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); | ||
1524 | return -EINVAL; | ||
1525 | 1131 | ||
1526 | case RIO_SEND_PACKET: | 1132 | /* |
1527 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | 1133 | ** It is important that the product code is an unsigned object! |
1528 | if ( copyin( (int)arg, (caddr_t)&SendPack, | 1134 | */ |
1529 | sizeof(SendPack) )==COPYFAIL ) { | 1135 | if (DownLoad.ProductCode > MAX_PRODUCT) { |
1530 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | 1136 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode); |
1531 | p->RIOError.Error = COPYIN_FAILED; | 1137 | p->RIOError.Error = NO_SUCH_PRODUCT; |
1532 | return -EFAULT; | 1138 | return -ENXIO; |
1533 | } | 1139 | } |
1534 | if ( SendPack.PortNum >= 128 ) { | 1140 | /* |
1535 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 1141 | ** do something! |
1536 | return -ENXIO; | 1142 | */ |
1537 | } | 1143 | retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad); |
1538 | 1144 | /* <-- Panic */ | |
1539 | PortP = p->RIOPortp[SendPack.PortNum]; | 1145 | p->RIOHalted = 0; |
1540 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1146 | /* |
1541 | 1147 | ** and go back, content with a job well completed. | |
1542 | if ( !can_add_transmit(&PacketP,PortP) ) { | 1148 | */ |
1543 | p->RIOError.Error = UNIT_IS_IN_USE; | 1149 | return retval; |
1544 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1150 | |
1545 | return -ENOSPC; | 1151 | case RIO_PARMS: |
1546 | } | 1152 | { |
1547 | 1153 | uint host; | |
1548 | for ( loop=0; loop<(ushort)(SendPack.Len & 127); loop++ ) | 1154 | |
1549 | WBYTE(PacketP->data[loop], SendPack.Data[loop] ); | 1155 | if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) { |
1550 | 1156 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | |
1551 | WBYTE(PacketP->len, SendPack.Len); | 1157 | p->RIOError.Error = COPYIN_FAILED; |
1552 | 1158 | return -EFAULT; | |
1553 | add_transmit( PortP ); | 1159 | } |
1554 | /* | 1160 | /* |
1555 | ** Count characters transmitted for port statistics reporting | 1161 | ** Fetch the parmmap |
1556 | */ | 1162 | */ |
1557 | if (PortP->statsGather) | 1163 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); |
1558 | PortP->txchars += (SendPack.Len & 127); | 1164 | if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) { |
1559 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1165 | p->RIOError.Error = COPYOUT_FAILED; |
1560 | return retval; | 1166 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); |
1561 | 1167 | return -EFAULT; | |
1562 | case RIO_NO_MESG: | 1168 | } |
1563 | if ( su ) | 1169 | } |
1564 | p->RIONoMessage = 1; | 1170 | return retval; |
1565 | return su ? 0 : -EPERM; | 1171 | |
1566 | 1172 | case RIO_HOST_REQ: | |
1567 | case RIO_MESG: | 1173 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); |
1568 | if ( su ) | 1174 | if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) { |
1569 | p->RIONoMessage = 0; | 1175 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); |
1570 | return su ? 0 : -EPERM; | 1176 | p->RIOError.Error = COPYIN_FAILED; |
1571 | 1177 | return -EFAULT; | |
1572 | case RIO_WHAT_MESG: | 1178 | } |
1573 | if ( copyout( (caddr_t)&p->RIONoMessage, (int)arg, | 1179 | if (HostReq.HostNum >= p->RIONumHosts) { |
1574 | sizeof(p->RIONoMessage) )==COPYFAIL ) { | 1180 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1575 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | 1181 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum); |
1576 | p->RIOError.Error = COPYOUT_FAILED; | 1182 | return -ENXIO; |
1577 | return -EFAULT; | 1183 | } |
1578 | } | 1184 | rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); |
1579 | return 0; | 1185 | |
1580 | 1186 | if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) { | |
1581 | case RIO_MEM_DUMP : | 1187 | p->RIOError.Error = COPYOUT_FAILED; |
1582 | if (copyin((int)arg, (caddr_t)&SubCmd, | 1188 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); |
1583 | sizeof(struct SubCmdStruct)) == COPYFAIL) { | 1189 | return -EFAULT; |
1584 | p->RIOError.Error = COPYIN_FAILED; | 1190 | } |
1585 | return -EFAULT; | 1191 | return retval; |
1586 | } | 1192 | |
1587 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", | 1193 | case RIO_HOST_DPRAM: |
1588 | SubCmd.Host, SubCmd.Rup, SubCmd.Addr); | 1194 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); |
1589 | 1195 | if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) { | |
1590 | if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { | 1196 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); |
1591 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | 1197 | p->RIOError.Error = COPYIN_FAILED; |
1592 | return -EINVAL; | 1198 | return -EFAULT; |
1593 | } | 1199 | } |
1594 | 1200 | if (HostDpRam.HostNum >= p->RIONumHosts) { | |
1595 | if (SubCmd.Host >= p->RIONumHosts ) { | 1201 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1596 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | 1202 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum); |
1597 | return -EINVAL; | 1203 | return -ENXIO; |
1598 | } | 1204 | } |
1599 | 1205 | rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); | |
1600 | port = p->RIOHosts[SubCmd.Host]. | 1206 | |
1601 | UnixRups[SubCmd.Rup].BaseSysPort; | 1207 | if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { |
1602 | 1208 | int off; | |
1603 | PortP = p->RIOPortp[port]; | 1209 | /* It's hardware like this that really gets on my tits. */ |
1604 | 1210 | static unsigned char copy[sizeof(struct DpRam)]; | |
1605 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1211 | for (off = 0; off < sizeof(struct DpRam); off++) |
1606 | 1212 | copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; | |
1607 | if ( RIOPreemptiveCmd(p, PortP, MEMDUMP ) == RIO_FAIL ) { | 1213 | if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { |
1608 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); | 1214 | p->RIOError.Error = COPYOUT_FAILED; |
1609 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1215 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); |
1610 | return -EBUSY; | 1216 | return -EFAULT; |
1611 | } | 1217 | } |
1612 | else | 1218 | } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { |
1613 | PortP->State |= RIO_BUSY; | 1219 | p->RIOError.Error = COPYOUT_FAILED; |
1614 | 1220 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | |
1615 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1221 | return -EFAULT; |
1616 | if ( copyout( (caddr_t)p->RIOMemDump, (int)arg, | 1222 | } |
1617 | MEMDUMP_SIZE) == COPYFAIL ) { | 1223 | return retval; |
1618 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | 1224 | |
1619 | p->RIOError.Error = COPYOUT_FAILED; | 1225 | case RIO_SET_BUSY: |
1620 | return -EFAULT; | 1226 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); |
1621 | } | 1227 | if ((int) arg < 0 || (int) arg > 511) { |
1622 | return 0; | 1228 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg); |
1623 | 1229 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | |
1624 | case RIO_TICK: | 1230 | return -EINVAL; |
1625 | if ((int)arg < 0 || (int)arg >= p->RIONumHosts) | 1231 | } |
1626 | return -EINVAL; | 1232 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
1627 | rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg); | 1233 | p->RIOPortp[(int) arg]->State |= RIO_BUSY; |
1628 | WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff); | 1234 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1629 | return 0; | 1235 | return retval; |
1630 | 1236 | ||
1631 | case RIO_TOCK: | 1237 | case RIO_HOST_PORT: |
1632 | if ((int)arg < 0 || (int)arg >= p->RIONumHosts) | 1238 | /* |
1633 | return -EINVAL; | 1239 | ** The daemon want port information |
1634 | rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg); | 1240 | ** (probably for debug reasons) |
1635 | WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff); | 1241 | */ |
1636 | return 0; | 1242 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); |
1637 | 1243 | if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) { | |
1638 | case RIO_READ_CHECK: | 1244 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); |
1639 | /* Check reads for pkts with data[0] the same */ | 1245 | p->RIOError.Error = COPYIN_FAILED; |
1640 | p->RIOReadCheck = !p->RIOReadCheck; | 1246 | return -EFAULT; |
1641 | if (copyout((caddr_t)&p->RIOReadCheck,(int)arg, | 1247 | } |
1642 | sizeof(uint))== COPYFAIL) { | 1248 | |
1643 | p->RIOError.Error = COPYOUT_FAILED; | 1249 | if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ |
1644 | return -EFAULT; | 1250 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort); |
1645 | } | 1251 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
1646 | return 0; | 1252 | return -ENXIO; |
1647 | 1253 | } | |
1648 | case RIO_READ_REGISTER : | 1254 | rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); |
1649 | if (copyin((int)arg, (caddr_t)&SubCmd, | 1255 | if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) { |
1650 | sizeof(struct SubCmdStruct)) == COPYFAIL) { | 1256 | p->RIOError.Error = COPYOUT_FAILED; |
1651 | p->RIOError.Error = COPYIN_FAILED; | 1257 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); |
1652 | return -EFAULT; | 1258 | return -EFAULT; |
1653 | } | 1259 | } |
1654 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", | 1260 | return retval; |
1655 | SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr); | 1261 | |
1656 | 1262 | case RIO_HOST_RUP: | |
1657 | if (SubCmd.Port > 511) { | 1263 | /* |
1658 | rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", | 1264 | ** The daemon want rup information |
1659 | SubCmd.Port); | 1265 | ** (probably for debug reasons) |
1660 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 1266 | */ |
1661 | return -EINVAL; | 1267 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); |
1662 | } | 1268 | if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) { |
1663 | 1269 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | |
1664 | if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { | 1270 | p->RIOError.Error = COPYIN_FAILED; |
1665 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | 1271 | return -EFAULT; |
1666 | return -EINVAL; | 1272 | } |
1667 | } | 1273 | if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ |
1668 | 1274 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum); | |
1669 | if (SubCmd.Host >= p->RIONumHosts ) { | 1275 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1670 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | 1276 | return -ENXIO; |
1671 | return -EINVAL; | 1277 | } |
1672 | } | 1278 | if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) { /* eek! */ |
1673 | 1279 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum); | |
1674 | port = p->RIOHosts[SubCmd.Host]. | 1280 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; |
1675 | UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port; | 1281 | return -EINVAL; |
1676 | PortP = p->RIOPortp[port]; | 1282 | } |
1677 | 1283 | HostP = &p->RIOHosts[RupReq.HostNum]; | |
1678 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1284 | |
1679 | 1285 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { | |
1680 | if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { | 1286 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum); |
1681 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); | 1287 | p->RIOError.Error = HOST_NOT_RUNNING; |
1682 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1288 | return -EIO; |
1683 | return -EBUSY; | 1289 | } |
1684 | } | 1290 | rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); |
1685 | else | 1291 | |
1686 | PortP->State |= RIO_BUSY; | 1292 | if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) { |
1687 | 1293 | p->RIOError.Error = COPYOUT_FAILED; | |
1688 | rio_spin_unlock_irqrestore( &PortP->portSem , flags); | 1294 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); |
1689 | if (copyout((caddr_t)&p->CdRegister, (int)arg, | 1295 | return -EFAULT; |
1690 | sizeof(uint)) == COPYFAIL ) { | 1296 | } |
1691 | rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | 1297 | return retval; |
1692 | p->RIOError.Error = COPYOUT_FAILED; | 1298 | |
1693 | return -EFAULT; | 1299 | case RIO_HOST_LPB: |
1694 | } | 1300 | /* |
1695 | return 0; | 1301 | ** The daemon want lpb information |
1696 | /* | 1302 | ** (probably for debug reasons) |
1697 | ** rio_make_dev: given port number (0-511) ORed with port type | 1303 | */ |
1698 | ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t | 1304 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); |
1699 | ** value to pass to mknod to create the correct device node. | 1305 | if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) { |
1700 | */ | 1306 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); |
1701 | case RIO_MAKE_DEV: | 1307 | p->RIOError.Error = COPYIN_FAILED; |
1702 | { | 1308 | return -EFAULT; |
1703 | uint port = (uint)arg & RIO_MODEM_MASK; | 1309 | } |
1704 | 1310 | if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ | |
1705 | switch ( (uint)arg & RIO_DEV_MASK ) { | 1311 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host); |
1706 | case RIO_DEV_DIRECT: | 1312 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; |
1707 | arg = (caddr_t)drv_makedev(MAJOR(dev), port); | 1313 | return -ENXIO; |
1708 | rio_dprintk (RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n",port, (int)arg); | 1314 | } |
1709 | return (int)arg; | 1315 | if (LpbReq.Link >= LINKS_PER_UNIT) { /* eek! */ |
1710 | case RIO_DEV_MODEM: | 1316 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link); |
1711 | arg = (caddr_t)drv_makedev(MAJOR(dev), (port|RIO_MODEM_BIT) ); | 1317 | p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; |
1712 | rio_dprintk (RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n",port, (int)arg); | 1318 | return -EINVAL; |
1713 | return (int)arg; | 1319 | } |
1714 | case RIO_DEV_XPRINT: | 1320 | HostP = &p->RIOHosts[LpbReq.Host]; |
1715 | arg = (caddr_t)drv_makedev(MAJOR(dev), port); | 1321 | |
1716 | rio_dprintk (RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n",port, (int)arg); | 1322 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { |
1717 | return (int)arg; | 1323 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host); |
1718 | } | 1324 | p->RIOError.Error = HOST_NOT_RUNNING; |
1719 | rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n"); | 1325 | return -EIO; |
1720 | return -EINVAL; | 1326 | } |
1721 | } | 1327 | rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); |
1722 | /* | 1328 | |
1723 | ** rio_minor: given a dev_t from a stat() call, return | 1329 | if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) { |
1724 | ** the port number (0-511) ORed with the port type | 1330 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); |
1725 | ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT ) | 1331 | p->RIOError.Error = COPYOUT_FAILED; |
1726 | */ | 1332 | return -EFAULT; |
1727 | case RIO_MINOR: | 1333 | } |
1728 | { | 1334 | return retval; |
1729 | dev_t dv; | ||
1730 | int mino; | ||
1731 | |||
1732 | dv = (dev_t)((int)arg); | ||
1733 | mino = RIO_UNMODEM(dv); | ||
1734 | 1335 | ||
1735 | if ( RIO_ISMODEM(dv) ) { | 1336 | /* |
1736 | rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); | 1337 | ** Here 3 IOCTL's that allow us to change the way in which |
1737 | arg = (caddr_t)(mino | RIO_DEV_MODEM); | 1338 | ** rio logs errors. send them just to syslog or send them |
1738 | } | 1339 | ** to both syslog and console or send them to just the console. |
1739 | else { | 1340 | ** |
1740 | rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); | 1341 | ** See RioStrBuf() in util.c for the other half. |
1741 | arg = (caddr_t)(mino | RIO_DEV_DIRECT); | 1342 | */ |
1742 | } | 1343 | case RIO_SYSLOG_ONLY: |
1743 | return (int)arg; | 1344 | p->RIOPrintLogState = PRINT_TO_LOG; /* Just syslog */ |
1744 | } | 1345 | return 0; |
1346 | |||
1347 | case RIO_SYSLOG_CONS: | ||
1348 | p->RIOPrintLogState = PRINT_TO_LOG_CONS; /* syslog and console */ | ||
1349 | return 0; | ||
1350 | |||
1351 | case RIO_CONS_ONLY: | ||
1352 | p->RIOPrintLogState = PRINT_TO_CONS; /* Just console */ | ||
1353 | return 0; | ||
1354 | |||
1355 | case RIO_SIGNALS_ON: | ||
1356 | if (p->RIOSignalProcess) { | ||
1357 | p->RIOError.Error = SIGNALS_ALREADY_SET; | ||
1358 | return -EBUSY; | ||
1359 | } | ||
1360 | p->RIOSignalProcess = getpid(); | ||
1361 | p->RIOPrintDisabled = DONT_PRINT; | ||
1362 | return retval; | ||
1363 | |||
1364 | case RIO_SIGNALS_OFF: | ||
1365 | if (p->RIOSignalProcess != getpid()) { | ||
1366 | p->RIOError.Error = NOT_RECEIVING_PROCESS; | ||
1367 | return -EPERM; | ||
1368 | } | ||
1369 | rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n"); | ||
1370 | p->RIOSignalProcess = 0; | ||
1371 | return retval; | ||
1372 | |||
1373 | case RIO_SET_BYTE_MODE: | ||
1374 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1375 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1376 | p->RIOHosts[Host].Mode &= ~WORD_OPERATION; | ||
1377 | return retval; | ||
1378 | |||
1379 | case RIO_SET_WORD_MODE: | ||
1380 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1381 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1382 | p->RIOHosts[Host].Mode |= WORD_OPERATION; | ||
1383 | return retval; | ||
1384 | |||
1385 | case RIO_SET_FAST_BUS: | ||
1386 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1387 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1388 | p->RIOHosts[Host].Mode |= FAST_AT_BUS; | ||
1389 | return retval; | ||
1390 | |||
1391 | case RIO_SET_SLOW_BUS: | ||
1392 | for (Host = 0; Host < p->RIONumHosts; Host++) | ||
1393 | if (p->RIOHosts[Host].Type == RIO_AT) | ||
1394 | p->RIOHosts[Host].Mode &= ~FAST_AT_BUS; | ||
1395 | return retval; | ||
1396 | |||
1397 | case RIO_MAP_B50_TO_50: | ||
1398 | case RIO_MAP_B50_TO_57600: | ||
1399 | case RIO_MAP_B110_TO_110: | ||
1400 | case RIO_MAP_B110_TO_115200: | ||
1401 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); | ||
1402 | port = (uint) arg; | ||
1403 | if (port < 0 || port > 511) { | ||
1404 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | ||
1405 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1406 | return -EINVAL; | ||
1407 | } | ||
1408 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1409 | switch (cmd) { | ||
1410 | case RIO_MAP_B50_TO_50: | ||
1411 | p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50; | ||
1412 | break; | ||
1413 | case RIO_MAP_B50_TO_57600: | ||
1414 | p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50; | ||
1415 | break; | ||
1416 | case RIO_MAP_B110_TO_110: | ||
1417 | p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110; | ||
1418 | break; | ||
1419 | case RIO_MAP_B110_TO_115200: | ||
1420 | p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110; | ||
1421 | break; | ||
1422 | } | ||
1423 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1424 | return retval; | ||
1425 | |||
1426 | case RIO_STREAM_INFO: | ||
1427 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); | ||
1428 | return -EINVAL; | ||
1429 | |||
1430 | case RIO_SEND_PACKET: | ||
1431 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | ||
1432 | if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) { | ||
1433 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | ||
1434 | p->RIOError.Error = COPYIN_FAILED; | ||
1435 | return -EFAULT; | ||
1436 | } | ||
1437 | if (SendPack.PortNum >= 128) { | ||
1438 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1439 | return -ENXIO; | ||
1440 | } | ||
1441 | |||
1442 | PortP = p->RIOPortp[SendPack.PortNum]; | ||
1443 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1444 | |||
1445 | if (!can_add_transmit(&PacketP, PortP)) { | ||
1446 | p->RIOError.Error = UNIT_IS_IN_USE; | ||
1447 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1448 | return -ENOSPC; | ||
1449 | } | ||
1450 | |||
1451 | for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++) | ||
1452 | WBYTE(PacketP->data[loop], SendPack.Data[loop]); | ||
1453 | |||
1454 | WBYTE(PacketP->len, SendPack.Len); | ||
1455 | |||
1456 | add_transmit(PortP); | ||
1457 | /* | ||
1458 | ** Count characters transmitted for port statistics reporting | ||
1459 | */ | ||
1460 | if (PortP->statsGather) | ||
1461 | PortP->txchars += (SendPack.Len & 127); | ||
1462 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1463 | return retval; | ||
1464 | |||
1465 | case RIO_NO_MESG: | ||
1466 | if (su) | ||
1467 | p->RIONoMessage = 1; | ||
1468 | return su ? 0 : -EPERM; | ||
1469 | |||
1470 | case RIO_MESG: | ||
1471 | if (su) | ||
1472 | p->RIONoMessage = 0; | ||
1473 | return su ? 0 : -EPERM; | ||
1474 | |||
1475 | case RIO_WHAT_MESG: | ||
1476 | if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) { | ||
1477 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | ||
1478 | p->RIOError.Error = COPYOUT_FAILED; | ||
1479 | return -EFAULT; | ||
1480 | } | ||
1481 | return 0; | ||
1482 | |||
1483 | case RIO_MEM_DUMP: | ||
1484 | if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { | ||
1485 | p->RIOError.Error = COPYIN_FAILED; | ||
1486 | return -EFAULT; | ||
1487 | } | ||
1488 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr); | ||
1489 | |||
1490 | if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) { | ||
1491 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1492 | return -EINVAL; | ||
1493 | } | ||
1494 | |||
1495 | if (SubCmd.Host >= p->RIONumHosts) { | ||
1496 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1497 | return -EINVAL; | ||
1498 | } | ||
1499 | |||
1500 | port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort; | ||
1501 | |||
1502 | PortP = p->RIOPortp[port]; | ||
1503 | |||
1504 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1505 | |||
1506 | if (RIOPreemptiveCmd(p, PortP, MEMDUMP) == RIO_FAIL) { | ||
1507 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); | ||
1508 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1509 | return -EBUSY; | ||
1510 | } else | ||
1511 | PortP->State |= RIO_BUSY; | ||
1512 | |||
1513 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1514 | if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) { | ||
1515 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | ||
1516 | p->RIOError.Error = COPYOUT_FAILED; | ||
1517 | return -EFAULT; | ||
1518 | } | ||
1519 | return 0; | ||
1520 | |||
1521 | case RIO_TICK: | ||
1522 | if ((int) arg < 0 || (int) arg >= p->RIONumHosts) | ||
1523 | return -EINVAL; | ||
1524 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg); | ||
1525 | WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff); | ||
1526 | return 0; | ||
1527 | |||
1528 | case RIO_TOCK: | ||
1529 | if ((int) arg < 0 || (int) arg >= p->RIONumHosts) | ||
1530 | return -EINVAL; | ||
1531 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg); | ||
1532 | WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff); | ||
1533 | return 0; | ||
1534 | |||
1535 | case RIO_READ_CHECK: | ||
1536 | /* Check reads for pkts with data[0] the same */ | ||
1537 | p->RIOReadCheck = !p->RIOReadCheck; | ||
1538 | if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) { | ||
1539 | p->RIOError.Error = COPYOUT_FAILED; | ||
1540 | return -EFAULT; | ||
1541 | } | ||
1542 | return 0; | ||
1543 | |||
1544 | case RIO_READ_REGISTER: | ||
1545 | if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { | ||
1546 | p->RIOError.Error = COPYIN_FAILED; | ||
1547 | return -EFAULT; | ||
1548 | } | ||
1549 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr); | ||
1550 | |||
1551 | if (SubCmd.Port > 511) { | ||
1552 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port); | ||
1553 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | ||
1554 | return -EINVAL; | ||
1555 | } | ||
1556 | |||
1557 | if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) { | ||
1558 | p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; | ||
1559 | return -EINVAL; | ||
1560 | } | ||
1561 | |||
1562 | if (SubCmd.Host >= p->RIONumHosts) { | ||
1563 | p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; | ||
1564 | return -EINVAL; | ||
1565 | } | ||
1566 | |||
1567 | port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port; | ||
1568 | PortP = p->RIOPortp[port]; | ||
1569 | |||
1570 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
1571 | |||
1572 | if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { | ||
1573 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); | ||
1574 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1575 | return -EBUSY; | ||
1576 | } else | ||
1577 | PortP->State |= RIO_BUSY; | ||
1578 | |||
1579 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1580 | if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) { | ||
1581 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | ||
1582 | p->RIOError.Error = COPYOUT_FAILED; | ||
1583 | return -EFAULT; | ||
1584 | } | ||
1585 | return 0; | ||
1586 | /* | ||
1587 | ** rio_make_dev: given port number (0-511) ORed with port type | ||
1588 | ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t | ||
1589 | ** value to pass to mknod to create the correct device node. | ||
1590 | */ | ||
1591 | case RIO_MAKE_DEV: | ||
1592 | { | ||
1593 | uint port = (uint) arg & RIO_MODEM_MASK; | ||
1594 | |||
1595 | switch ((uint) arg & RIO_DEV_MASK) { | ||
1596 | case RIO_DEV_DIRECT: | ||
1597 | arg = (caddr_t) drv_makedev(MAJOR(dev), port); | ||
1598 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg); | ||
1599 | return (int) arg; | ||
1600 | case RIO_DEV_MODEM: | ||
1601 | arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT)); | ||
1602 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg); | ||
1603 | return (int) arg; | ||
1604 | case RIO_DEV_XPRINT: | ||
1605 | arg = (caddr_t) drv_makedev(MAJOR(dev), port); | ||
1606 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg); | ||
1607 | return (int) arg; | ||
1608 | } | ||
1609 | rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n"); | ||
1610 | return -EINVAL; | ||
1611 | } | ||
1612 | /* | ||
1613 | ** rio_minor: given a dev_t from a stat() call, return | ||
1614 | ** the port number (0-511) ORed with the port type | ||
1615 | ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT ) | ||
1616 | */ | ||
1617 | case RIO_MINOR: | ||
1618 | { | ||
1619 | dev_t dv; | ||
1620 | int mino; | ||
1621 | |||
1622 | dv = (dev_t) ((int) arg); | ||
1623 | mino = RIO_UNMODEM(dv); | ||
1624 | |||
1625 | if (RIO_ISMODEM(dv)) { | ||
1626 | rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); | ||
1627 | arg = (caddr_t) (mino | RIO_DEV_MODEM); | ||
1628 | } else { | ||
1629 | rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); | ||
1630 | arg = (caddr_t) (mino | RIO_DEV_DIRECT); | ||
1631 | } | ||
1632 | return (int) arg; | ||
1633 | } | ||
1745 | } | 1634 | } |
1746 | rio_dprintk (RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n",cmd); | 1635 | rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd); |
1747 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; | 1636 | p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; |
1748 | 1637 | ||
1749 | func_exit (); | 1638 | func_exit(); |
1750 | return -EINVAL; | 1639 | return -EINVAL; |
1751 | } | 1640 | } |
1752 | 1641 | ||
1753 | /* | 1642 | /* |
1754 | ** Pre-emptive commands go on RUPs and are only one byte long. | 1643 | ** Pre-emptive commands go on RUPs and are only one byte long. |
1755 | */ | 1644 | */ |
1756 | int | 1645 | int RIOPreemptiveCmd(p, PortP, Cmd) |
1757 | RIOPreemptiveCmd(p, PortP, Cmd) | 1646 | struct rio_info *p; |
1758 | struct rio_info * p; | ||
1759 | struct Port *PortP; | 1647 | struct Port *PortP; |
1760 | uchar Cmd; | 1648 | uchar Cmd; |
1761 | { | 1649 | { |
@@ -1766,104 +1654,99 @@ uchar Cmd; | |||
1766 | int port; | 1654 | int port; |
1767 | 1655 | ||
1768 | #ifdef CHECK | 1656 | #ifdef CHECK |
1769 | CheckPortP( PortP ); | 1657 | CheckPortP(PortP); |
1770 | #endif | 1658 | #endif |
1771 | 1659 | ||
1772 | if ( PortP->State & RIO_DELETED ) { | 1660 | if (PortP->State & RIO_DELETED) { |
1773 | rio_dprintk (RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); | 1661 | rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); |
1774 | return RIO_FAIL; | 1662 | return RIO_FAIL; |
1775 | } | 1663 | } |
1776 | 1664 | ||
1777 | if (((int)((char)PortP->InUse) == -1) || ! (CmdBlkP = RIOGetCmdBlk()) ) { | 1665 | if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) { |
1778 | rio_dprintk (RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", | 1666 | rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum); |
1779 | Cmd, PortP->PortNum); | ||
1780 | return RIO_FAIL; | 1667 | return RIO_FAIL; |
1781 | } | 1668 | } |
1782 | 1669 | ||
1783 | rio_dprintk (RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", | 1670 | rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse); |
1784 | (int)CmdBlkP,PortP->InUse); | ||
1785 | 1671 | ||
1786 | PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; | 1672 | PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; |
1787 | 1673 | ||
1788 | CmdBlkP->Packet.src_unit = 0; | 1674 | CmdBlkP->Packet.src_unit = 0; |
1789 | if (PortP->SecondBlock) | 1675 | if (PortP->SecondBlock) |
1790 | rup = PortP->ID2; | 1676 | rup = PortP->ID2; |
1791 | else | 1677 | else |
1792 | rup = PortP->RupNum; | 1678 | rup = PortP->RupNum; |
1793 | CmdBlkP->Packet.dest_unit = rup; | 1679 | CmdBlkP->Packet.dest_unit = rup; |
1794 | CmdBlkP->Packet.src_port = COMMAND_RUP; | 1680 | CmdBlkP->Packet.src_port = COMMAND_RUP; |
1795 | CmdBlkP->Packet.dest_port = COMMAND_RUP; | 1681 | CmdBlkP->Packet.dest_port = COMMAND_RUP; |
1796 | CmdBlkP->Packet.len = PKT_CMD_BIT | 2; | 1682 | CmdBlkP->Packet.len = PKT_CMD_BIT | 2; |
1797 | CmdBlkP->PostFuncP = RIOUnUse; | 1683 | CmdBlkP->PostFuncP = RIOUnUse; |
1798 | CmdBlkP->PostArg = (int)PortP; | 1684 | CmdBlkP->PostArg = (int) PortP; |
1799 | PktCmdP->Command = Cmd; | 1685 | PktCmdP->Command = Cmd; |
1800 | port = PortP->HostPort % (ushort)PORTS_PER_RTA; | 1686 | port = PortP->HostPort % (ushort) PORTS_PER_RTA; |
1801 | /* | 1687 | /* |
1802 | ** Index ports 8-15 for 2nd block of 16 port RTA. | 1688 | ** Index ports 8-15 for 2nd block of 16 port RTA. |
1803 | */ | 1689 | */ |
1804 | if (PortP->SecondBlock) | 1690 | if (PortP->SecondBlock) |
1805 | port += (ushort) PORTS_PER_RTA; | 1691 | port += (ushort) PORTS_PER_RTA; |
1806 | PktCmdP->PhbNum = port; | 1692 | PktCmdP->PhbNum = port; |
1807 | 1693 | ||
1808 | switch ( Cmd ) { | 1694 | switch (Cmd) { |
1809 | case MEMDUMP: | 1695 | case MEMDUMP: |
1810 | rio_dprintk (RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", | 1696 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr); |
1811 | (int)CmdBlkP, (int)SubCmd.Addr); | 1697 | PktCmdP->SubCommand = MEMDUMP; |
1812 | PktCmdP->SubCommand = MEMDUMP; | 1698 | PktCmdP->SubAddr = SubCmd.Addr; |
1813 | PktCmdP->SubAddr = SubCmd.Addr; | 1699 | break; |
1814 | break; | 1700 | case FCLOSE: |
1815 | case FCLOSE: | 1701 | rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP); |
1816 | rio_dprintk (RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n",(int)CmdBlkP); | 1702 | break; |
1817 | break; | 1703 | case READ_REGISTER: |
1818 | case READ_REGISTER: | 1704 | rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP); |
1819 | rio_dprintk (RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", | 1705 | PktCmdP->SubCommand = READ_REGISTER; |
1820 | (int)SubCmd.Addr, (int)CmdBlkP); | 1706 | PktCmdP->SubAddr = SubCmd.Addr; |
1821 | PktCmdP->SubCommand = READ_REGISTER; | 1707 | break; |
1822 | PktCmdP->SubAddr = SubCmd.Addr; | 1708 | case RESUME: |
1823 | break; | 1709 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP); |
1824 | case RESUME: | 1710 | break; |
1825 | rio_dprintk (RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n",(int)CmdBlkP); | 1711 | case RFLUSH: |
1826 | break; | 1712 | rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP); |
1827 | case RFLUSH: | 1713 | CmdBlkP->PostFuncP = RIORFlushEnable; |
1828 | rio_dprintk (RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n",(int)CmdBlkP); | 1714 | break; |
1829 | CmdBlkP->PostFuncP = RIORFlushEnable; | 1715 | case SUSPEND: |
1830 | break; | 1716 | rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP); |
1831 | case SUSPEND: | 1717 | break; |
1832 | rio_dprintk (RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n",(int)CmdBlkP); | 1718 | |
1833 | break; | 1719 | case MGET: |
1834 | 1720 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP); | |
1835 | case MGET : | 1721 | break; |
1836 | rio_dprintk (RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int)CmdBlkP); | 1722 | |
1837 | break; | 1723 | case MSET: |
1838 | 1724 | case MBIC: | |
1839 | case MSET : | 1725 | case MBIS: |
1840 | case MBIC : | 1726 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; |
1841 | case MBIS : | 1727 | rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP); |
1842 | CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; | 1728 | break; |
1843 | rio_dprintk (RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int)CmdBlkP); | 1729 | |
1844 | break; | 1730 | case WFLUSH: |
1845 | 1731 | /* | |
1846 | case WFLUSH: | 1732 | ** If we have queued up the maximum number of Write flushes |
1847 | /* | 1733 | ** allowed then we should not bother sending any more to the |
1848 | ** If we have queued up the maximum number of Write flushes | 1734 | ** RTA. |
1849 | ** allowed then we should not bother sending any more to the | 1735 | */ |
1850 | ** RTA. | 1736 | if ((int) ((char) PortP->WflushFlag) == (int) -1) { |
1851 | */ | 1737 | rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); |
1852 | if ((int)((char)PortP->WflushFlag) == (int)-1) { | 1738 | RIOFreeCmdBlk(CmdBlkP); |
1853 | rio_dprintk (RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); | 1739 | return (RIO_FAIL); |
1854 | RIOFreeCmdBlk(CmdBlkP); | 1740 | } else { |
1855 | return(RIO_FAIL); | 1741 | rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP); |
1856 | } else { | 1742 | CmdBlkP->PostFuncP = RIOWFlushMark; |
1857 | rio_dprintk (RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", | 1743 | } |
1858 | (int)CmdBlkP); | 1744 | break; |
1859 | CmdBlkP->PostFuncP = RIOWFlushMark; | ||
1860 | } | ||
1861 | break; | ||
1862 | } | 1745 | } |
1863 | 1746 | ||
1864 | PortP->InUse++; | 1747 | PortP->InUse++; |
1865 | 1748 | ||
1866 | Ret = RIOQueueCmdBlk( PortP->HostP, rup, CmdBlkP ); | 1749 | Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP); |
1867 | 1750 | ||
1868 | return Ret; | 1751 | return Ret; |
1869 | } | 1752 | } |
diff --git a/drivers/char/rio/riodrvr.h b/drivers/char/rio/riodrvr.h index bc38ac5dfbde..663ee0914ed7 100644 --- a/drivers/char/rio/riodrvr.h +++ b/drivers/char/rio/riodrvr.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #ifndef __riodrvr_h | 33 | #ifndef __riodrvr_h |
34 | #define __riodrvr_h | 34 | #define __riodrvr_h |
35 | 35 | ||
36 | #include <asm/param.h> /* for HZ */ | 36 | #include <asm/param.h> /* for HZ */ |
37 | 37 | ||
38 | #ifdef SCCS_LABELS | 38 | #ifdef SCCS_LABELS |
39 | static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; | 39 | static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; |
@@ -44,15 +44,15 @@ static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3"; | |||
44 | 44 | ||
45 | 45 | ||
46 | struct rio_info { | 46 | struct rio_info { |
47 | int mode; /* Intr or polled, word/byte */ | 47 | int mode; /* Intr or polled, word/byte */ |
48 | spinlock_t RIOIntrSem; /* Interrupt thread sem */ | 48 | spinlock_t RIOIntrSem; /* Interrupt thread sem */ |
49 | int current_chan; /* current channel */ | 49 | int current_chan; /* current channel */ |
50 | int RIOFailed; /* Not initialised ? */ | 50 | int RIOFailed; /* Not initialised ? */ |
51 | int RIOInstallAttempts; /* no. of rio-install() calls */ | 51 | int RIOInstallAttempts; /* no. of rio-install() calls */ |
52 | int RIOLastPCISearch; /* status of last search */ | 52 | int RIOLastPCISearch; /* status of last search */ |
53 | int RIONumHosts; /* Number of RIO Hosts */ | 53 | int RIONumHosts; /* Number of RIO Hosts */ |
54 | struct Host * RIOHosts; /* RIO Host values */ | 54 | struct Host *RIOHosts; /* RIO Host values */ |
55 | struct Port **RIOPortp; /* RIO port values */ | 55 | struct Port **RIOPortp; /* RIO port values */ |
56 | /* | 56 | /* |
57 | ** 02.03.1999 ARG - ESIL 0820 fix | 57 | ** 02.03.1999 ARG - ESIL 0820 fix |
58 | ** We no longer use RIOBootMode | 58 | ** We no longer use RIOBootMode |
@@ -60,9 +60,9 @@ struct rio_info { | |||
60 | int RIOBootMode; * RIO boot mode * | 60 | int RIOBootMode; * RIO boot mode * |
61 | ** | 61 | ** |
62 | */ | 62 | */ |
63 | int RIOPrintDisabled; /* RIO printing disabled ? */ | 63 | int RIOPrintDisabled; /* RIO printing disabled ? */ |
64 | int RIOPrintLogState; /* RIO printing state ? */ | 64 | int RIOPrintLogState; /* RIO printing state ? */ |
65 | int RIOPolling; /* Polling ? */ | 65 | int RIOPolling; /* Polling ? */ |
66 | /* | 66 | /* |
67 | ** 09.12.1998 ARG - ESIL 0776 part fix | 67 | ** 09.12.1998 ARG - ESIL 0776 part fix |
68 | ** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted. | 68 | ** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted. |
@@ -70,61 +70,61 @@ struct rio_info { | |||
70 | ** updated in RIOConCon() - to keep track of RTA connections/disconnections. | 70 | ** updated in RIOConCon() - to keep track of RTA connections/disconnections. |
71 | ** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons. | 71 | ** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons. |
72 | */ | 72 | */ |
73 | int RIOHalted; /* halted ? */ | 73 | int RIOHalted; /* halted ? */ |
74 | int RIORtaDisCons; /* RTA connections/disconnections */ | 74 | int RIORtaDisCons; /* RTA connections/disconnections */ |
75 | uint RIOReadCheck; /* Rio read check */ | 75 | uint RIOReadCheck; /* Rio read check */ |
76 | uint RIONoMessage; /* To display message or not */ | 76 | uint RIONoMessage; /* To display message or not */ |
77 | uint RIONumBootPkts; /* how many packets for an RTA */ | 77 | uint RIONumBootPkts; /* how many packets for an RTA */ |
78 | uint RIOBootCount; /* size of RTA code */ | 78 | uint RIOBootCount; /* size of RTA code */ |
79 | uint RIOBooting; /* count of outstanding boots */ | 79 | uint RIOBooting; /* count of outstanding boots */ |
80 | uint RIOSystemUp; /* Booted ?? */ | 80 | uint RIOSystemUp; /* Booted ?? */ |
81 | uint RIOCounting; /* for counting interrupts */ | 81 | uint RIOCounting; /* for counting interrupts */ |
82 | uint RIOIntCount; /* # of intr since last check */ | 82 | uint RIOIntCount; /* # of intr since last check */ |
83 | uint RIOTxCount; /* number of xmit intrs */ | 83 | uint RIOTxCount; /* number of xmit intrs */ |
84 | uint RIORxCount; /* number of rx intrs */ | 84 | uint RIORxCount; /* number of rx intrs */ |
85 | uint RIORupCount; /* number of rup intrs */ | 85 | uint RIORupCount; /* number of rup intrs */ |
86 | int RIXTimer; | 86 | int RIXTimer; |
87 | int RIOBufferSize; /* Buffersize */ | 87 | int RIOBufferSize; /* Buffersize */ |
88 | int RIOBufferMask; /* Buffersize */ | 88 | int RIOBufferMask; /* Buffersize */ |
89 | 89 | ||
90 | int RIOFirstMajor; /* First host card's major no */ | 90 | int RIOFirstMajor; /* First host card's major no */ |
91 | 91 | ||
92 | uint RIOLastPortsMapped; /* highest port number known */ | 92 | uint RIOLastPortsMapped; /* highest port number known */ |
93 | uint RIOFirstPortsMapped; /* lowest port number known */ | 93 | uint RIOFirstPortsMapped; /* lowest port number known */ |
94 | 94 | ||
95 | uint RIOLastPortsBooted; /* highest port number running */ | 95 | uint RIOLastPortsBooted; /* highest port number running */ |
96 | uint RIOFirstPortsBooted; /* lowest port number running */ | 96 | uint RIOFirstPortsBooted; /* lowest port number running */ |
97 | 97 | ||
98 | uint RIOLastPortsOpened; /* highest port number running */ | 98 | uint RIOLastPortsOpened; /* highest port number running */ |
99 | uint RIOFirstPortsOpened; /* lowest port number running */ | 99 | uint RIOFirstPortsOpened; /* lowest port number running */ |
100 | 100 | ||
101 | /* Flag to say that the topology information has been changed. */ | 101 | /* Flag to say that the topology information has been changed. */ |
102 | uint RIOQuickCheck; | 102 | uint RIOQuickCheck; |
103 | uint CdRegister; /* ??? */ | 103 | uint CdRegister; /* ??? */ |
104 | int RIOSignalProcess; /* Signalling process */ | 104 | int RIOSignalProcess; /* Signalling process */ |
105 | int rio_debug; /* To debug ... */ | 105 | int rio_debug; /* To debug ... */ |
106 | int RIODebugWait; /* For what ??? */ | 106 | int RIODebugWait; /* For what ??? */ |
107 | int tpri; /* Thread prio */ | 107 | int tpri; /* Thread prio */ |
108 | int tid; /* Thread id */ | 108 | int tid; /* Thread id */ |
109 | uint _RIO_Polled; /* Counter for polling */ | 109 | uint _RIO_Polled; /* Counter for polling */ |
110 | uint _RIO_Interrupted; /* Counter for interrupt */ | 110 | uint _RIO_Interrupted; /* Counter for interrupt */ |
111 | int intr_tid; /* iointset return value */ | 111 | int intr_tid; /* iointset return value */ |
112 | int TxEnSem; /* TxEnable Semaphore */ | 112 | int TxEnSem; /* TxEnable Semaphore */ |
113 | 113 | ||
114 | 114 | ||
115 | struct Error RIOError; /* to Identify what went wrong */ | 115 | struct Error RIOError; /* to Identify what went wrong */ |
116 | struct Conf RIOConf; /* Configuration ??? */ | 116 | struct Conf RIOConf; /* Configuration ??? */ |
117 | struct ttystatics channel[RIO_PORTS]; /* channel information */ | 117 | struct ttystatics channel[RIO_PORTS]; /* channel information */ |
118 | char RIOBootPackets[1+(SIXTY_FOUR_K/RTA_BOOT_DATA_SIZE)] | 118 | char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)] |
119 | [RTA_BOOT_DATA_SIZE]; | 119 | [RTA_BOOT_DATA_SIZE]; |
120 | struct Map RIOConnectTable[TOTAL_MAP_ENTRIES]; | 120 | struct Map RIOConnectTable[TOTAL_MAP_ENTRIES]; |
121 | struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; | 121 | struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; |
122 | 122 | ||
123 | /* RTA to host binding table for master/slave operation */ | 123 | /* RTA to host binding table for master/slave operation */ |
124 | ulong RIOBindTab[MAX_RTA_BINDINGS]; | 124 | ulong RIOBindTab[MAX_RTA_BINDINGS]; |
125 | /* RTA memory dump variable */ | 125 | /* RTA memory dump variable */ |
126 | uchar RIOMemDump[MEMDUMP_SIZE]; | 126 | uchar RIOMemDump[MEMDUMP_SIZE]; |
127 | struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; | 127 | struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; |
128 | 128 | ||
129 | }; | 129 | }; |
130 | 130 | ||
@@ -141,4 +141,4 @@ struct rio_info { | |||
141 | #define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \ | 141 | #define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \ |
142 | (unsigned char)(y) | 142 | (unsigned char)(y) |
143 | 143 | ||
144 | #endif /* __riodrvr.h */ | 144 | #endif /* __riodrvr.h */ |
diff --git a/drivers/char/rio/rioinfo.h b/drivers/char/rio/rioinfo.h index e08421c9558e..8de7966e603a 100644 --- a/drivers/char/rio/rioinfo.h +++ b/drivers/char/rio/rioinfo.h | |||
@@ -41,29 +41,29 @@ static char *_rioinfo_h_sccs_ = "@(#)rioinfo.h 1.2"; | |||
41 | ** Host card data structure | 41 | ** Host card data structure |
42 | */ | 42 | */ |
43 | struct RioHostInfo { | 43 | struct RioHostInfo { |
44 | long location; /* RIO Card Base I/O address */ | 44 | long location; /* RIO Card Base I/O address */ |
45 | long vector; /* RIO Card IRQ vector */ | 45 | long vector; /* RIO Card IRQ vector */ |
46 | int bus; /* ISA/EISA/MCA/PCI */ | 46 | int bus; /* ISA/EISA/MCA/PCI */ |
47 | int mode; /* pointer to host mode - INTERRUPT / POLLED */ | 47 | int mode; /* pointer to host mode - INTERRUPT / POLLED */ |
48 | struct old_sgttyb | 48 | struct old_sgttyb |
49 | * Sg; /* pointer to default term characteristics */ | 49 | *Sg; /* pointer to default term characteristics */ |
50 | }; | 50 | }; |
51 | 51 | ||
52 | 52 | ||
53 | /* Mode in rio device info */ | 53 | /* Mode in rio device info */ |
54 | #define INTERRUPTED_MODE 0x01 /* Interrupt is generated */ | 54 | #define INTERRUPTED_MODE 0x01 /* Interrupt is generated */ |
55 | #define POLLED_MODE 0x02 /* No interrupt */ | 55 | #define POLLED_MODE 0x02 /* No interrupt */ |
56 | #define AUTO_MODE 0x03 /* Auto mode */ | 56 | #define AUTO_MODE 0x03 /* Auto mode */ |
57 | 57 | ||
58 | #define WORD_ACCESS_MODE 0x10 /* Word Access Mode */ | 58 | #define WORD_ACCESS_MODE 0x10 /* Word Access Mode */ |
59 | #define BYTE_ACCESS_MODE 0x20 /* Byte Access Mode */ | 59 | #define BYTE_ACCESS_MODE 0x20 /* Byte Access Mode */ |
60 | 60 | ||
61 | 61 | ||
62 | /* Bus type that RIO supports */ | 62 | /* Bus type that RIO supports */ |
63 | #define ISA_BUS 0x01 /* The card is ISA */ | 63 | #define ISA_BUS 0x01 /* The card is ISA */ |
64 | #define EISA_BUS 0x02 /* The card is EISA */ | 64 | #define EISA_BUS 0x02 /* The card is EISA */ |
65 | #define MCA_BUS 0x04 /* The card is MCA */ | 65 | #define MCA_BUS 0x04 /* The card is MCA */ |
66 | #define PCI_BUS 0x08 /* The card is PCI */ | 66 | #define PCI_BUS 0x08 /* The card is PCI */ |
67 | 67 | ||
68 | /* | 68 | /* |
69 | ** 11.11.1998 ARG - ESIL ???? part fix | 69 | ** 11.11.1998 ARG - ESIL ???? part fix |
@@ -93,4 +93,4 @@ struct RioHostInfo { | |||
93 | 'V' - '@' /* literal next char */ \ | 93 | 'V' - '@' /* literal next char */ \ |
94 | } | 94 | } |
95 | 95 | ||
96 | #endif /* __rioinfo_h */ | 96 | #endif /* __rioinfo_h */ |
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index ddda9c14e059..34d8787557a1 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c | |||
@@ -88,99 +88,93 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; | |||
88 | static void RIOReceive(struct rio_info *, struct Port *); | 88 | static void RIOReceive(struct rio_info *, struct Port *); |
89 | 89 | ||
90 | 90 | ||
91 | static char *firstchars (char *p, int nch) | 91 | static char *firstchars(char *p, int nch) |
92 | { | 92 | { |
93 | static char buf[2][128]; | 93 | static char buf[2][128]; |
94 | static int t=0; | 94 | static int t = 0; |
95 | t = ! t; | 95 | t = !t; |
96 | memcpy (buf[t], p, nch); | 96 | memcpy(buf[t], p, nch); |
97 | buf[t][nch] = 0; | 97 | buf[t][nch] = 0; |
98 | return buf[t]; | 98 | return buf[t]; |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) | 102 | #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) |
103 | /* Enable and start the transmission of packets */ | 103 | /* Enable and start the transmission of packets */ |
104 | void | 104 | void RIOTxEnable(en) |
105 | RIOTxEnable(en) | 105 | char *en; |
106 | char * en; | ||
107 | { | 106 | { |
108 | struct Port * PortP; | 107 | struct Port *PortP; |
109 | struct rio_info *p; | 108 | struct rio_info *p; |
110 | struct tty_struct* tty; | 109 | struct tty_struct *tty; |
111 | int c; | 110 | int c; |
112 | struct PKT * PacketP; | 111 | struct PKT *PacketP; |
113 | unsigned long flags; | 112 | unsigned long flags; |
114 | 113 | ||
115 | PortP = (struct Port *)en; | 114 | PortP = (struct Port *) en; |
116 | p = (struct rio_info *)PortP->p; | 115 | p = (struct rio_info *) PortP->p; |
117 | tty = PortP->gs.tty; | 116 | tty = PortP->gs.tty; |
118 | 117 | ||
119 | 118 | ||
120 | rio_dprintk (RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", | 119 | rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); |
121 | PortP->PortNum, PortP->gs.xmit_cnt); | 120 | |
122 | 121 | if (!PortP->gs.xmit_cnt) | |
123 | if (!PortP->gs.xmit_cnt) return; | 122 | return; |
124 | 123 | ||
125 | 124 | ||
126 | /* This routine is an order of magnitude simpler than the specialix | 125 | /* This routine is an order of magnitude simpler than the specialix |
127 | version. One of the disadvantages is that this version will send | 126 | version. One of the disadvantages is that this version will send |
128 | an incomplete packet (usually 64 bytes instead of 72) once for | 127 | an incomplete packet (usually 64 bytes instead of 72) once for |
129 | every 4k worth of data. Let's just say that this won't influence | 128 | every 4k worth of data. Let's just say that this won't influence |
130 | performance significantly..... */ | 129 | performance significantly..... */ |
131 | 130 | ||
132 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 131 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
133 | 132 | ||
134 | while (can_add_transmit( &PacketP, PortP )) { | 133 | while (can_add_transmit(&PacketP, PortP)) { |
135 | c = PortP->gs.xmit_cnt; | 134 | c = PortP->gs.xmit_cnt; |
136 | if (c > PKT_MAX_DATA_LEN) c = PKT_MAX_DATA_LEN; | 135 | if (c > PKT_MAX_DATA_LEN) |
137 | 136 | c = PKT_MAX_DATA_LEN; | |
138 | /* Don't copy past the end of the source buffer */ | 137 | |
139 | if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) | 138 | /* Don't copy past the end of the source buffer */ |
140 | c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail; | 139 | if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) |
141 | 140 | c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail; | |
142 | { int t; | 141 | |
143 | t = (c > 10)?10:c; | 142 | { |
144 | 143 | int t; | |
145 | rio_dprintk (RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", | 144 | t = (c > 10) ? 10 : c; |
146 | PortP->PortNum, c, | 145 | |
147 | firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail , t), | 146 | rio_dprintk(RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", PortP->PortNum, c, firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail, t), firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail + c - t, t)); |
148 | firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail + c-t, t)); | 147 | } |
149 | } | 148 | /* If for one reason or another, we can't copy more data, |
150 | /* If for one reason or another, we can't copy more data, | 149 | we're done! */ |
151 | we're done! */ | 150 | if (c == 0) |
152 | if (c == 0) break; | 151 | break; |
153 | 152 | ||
154 | rio_memcpy_toio (PortP->HostP->Caddr, (caddr_t)PacketP->data, | 153 | rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); |
155 | PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); | 154 | /* udelay (1); */ |
156 | /* udelay (1); */ | 155 | |
157 | 156 | writeb(c, &(PacketP->len)); | |
158 | writeb (c, &(PacketP->len)); | 157 | if (!(PortP->State & RIO_DELETED)) { |
159 | if (!( PortP->State & RIO_DELETED ) ) { | 158 | add_transmit(PortP); |
160 | add_transmit ( PortP ); | 159 | /* |
161 | /* | 160 | ** Count chars tx'd for port statistics reporting |
162 | ** Count chars tx'd for port statistics reporting | 161 | */ |
163 | */ | 162 | if (PortP->statsGather) |
164 | if ( PortP->statsGather ) | 163 | PortP->txchars += c; |
165 | PortP->txchars += c; | 164 | } |
166 | } | 165 | PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1); |
167 | PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE-1); | 166 | PortP->gs.xmit_cnt -= c; |
168 | PortP->gs.xmit_cnt -= c; | 167 | } |
169 | } | 168 | |
170 | 169 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | |
171 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 170 | |
172 | 171 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) { | |
173 | if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2*PKT_MAX_DATA_LEN)) { | 172 | rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); |
174 | rio_dprintk (RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", | 173 | if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup) |
175 | (int)(PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), | 174 | (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty); |
176 | PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); | 175 | rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); |
177 | if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && | 176 | wake_up_interruptible(&PortP->gs.tty->write_wait); |
178 | PortP->gs.tty->ldisc.write_wakeup) | 177 | } |
179 | (PortP->gs.tty->ldisc.write_wakeup)(PortP->gs.tty); | ||
180 | rio_dprintk (RIO_DEBUG_INTR, "(%d/%d)\n", | ||
181 | PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); | ||
182 | wake_up_interruptible(&PortP->gs.tty->write_wait); | ||
183 | } | ||
184 | 178 | ||
185 | } | 179 | } |
186 | 180 | ||
@@ -189,361 +183,349 @@ char * en; | |||
189 | ** RIO Host Service routine. Does all the work traditionally associated with an | 183 | ** RIO Host Service routine. Does all the work traditionally associated with an |
190 | ** interrupt. | 184 | ** interrupt. |
191 | */ | 185 | */ |
192 | static int RupIntr; | 186 | static int RupIntr; |
193 | static int RxIntr; | 187 | static int RxIntr; |
194 | static int TxIntr; | 188 | static int TxIntr; |
195 | void | 189 | void RIOServiceHost(p, HostP, From) |
196 | RIOServiceHost(p, HostP, From) | 190 | struct rio_info *p; |
197 | struct rio_info * p; | ||
198 | struct Host *HostP; | 191 | struct Host *HostP; |
199 | int From; | 192 | int From; |
200 | { | 193 | { |
201 | rio_spin_lock (&HostP->HostLock); | 194 | rio_spin_lock(&HostP->HostLock); |
202 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { | 195 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { |
203 | static int t =0; | 196 | static int t = 0; |
204 | rio_spin_unlock (&HostP->HostLock); | 197 | rio_spin_unlock(&HostP->HostLock); |
205 | if ((t++ % 200) == 0) | 198 | if ((t++ % 200) == 0) |
206 | rio_dprintk (RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int)HostP->Flags); | 199 | rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags); |
207 | return; | 200 | return; |
208 | } | 201 | } |
209 | rio_spin_unlock (&HostP->HostLock); | 202 | rio_spin_unlock(&HostP->HostLock); |
210 | 203 | ||
211 | if ( RWORD( HostP->ParmMapP->rup_intr ) ) { | 204 | if (RWORD(HostP->ParmMapP->rup_intr)) { |
212 | WWORD( HostP->ParmMapP->rup_intr , 0 ); | 205 | WWORD(HostP->ParmMapP->rup_intr, 0); |
213 | p->RIORupCount++; | 206 | p->RIORupCount++; |
214 | RupIntr++; | 207 | RupIntr++; |
215 | rio_dprintk (RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP-p->RIOHosts); | 208 | rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts); |
216 | RIOPollHostCommands(p, HostP ); | 209 | RIOPollHostCommands(p, HostP); |
217 | } | 210 | } |
218 | 211 | ||
219 | if ( RWORD( HostP->ParmMapP->rx_intr ) ) { | 212 | if (RWORD(HostP->ParmMapP->rx_intr)) { |
220 | int port; | 213 | int port; |
221 | 214 | ||
222 | WWORD( HostP->ParmMapP->rx_intr , 0 ); | 215 | WWORD(HostP->ParmMapP->rx_intr, 0); |
223 | p->RIORxCount++; | 216 | p->RIORxCount++; |
224 | RxIntr++; | 217 | RxIntr++; |
225 | 218 | ||
226 | rio_dprintk (RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP-p->RIOHosts); | 219 | rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts); |
227 | /* | 220 | /* |
228 | ** Loop through every port. If the port is mapped into | 221 | ** Loop through every port. If the port is mapped into |
229 | ** the system ( i.e. has /dev/ttyXXXX associated ) then it is | 222 | ** the system ( i.e. has /dev/ttyXXXX associated ) then it is |
230 | ** worth checking. If the port isn't open, grab any packets | 223 | ** worth checking. If the port isn't open, grab any packets |
231 | ** hanging on its receive queue and stuff them on the free | 224 | ** hanging on its receive queue and stuff them on the free |
232 | ** list; check for commands on the way. | 225 | ** list; check for commands on the way. |
233 | */ | 226 | */ |
234 | for ( port=p->RIOFirstPortsBooted; | 227 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { |
235 | port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) { | 228 | struct Port *PortP = p->RIOPortp[port]; |
236 | struct Port *PortP = p->RIOPortp[port]; | 229 | struct tty_struct *ttyP; |
237 | struct tty_struct *ttyP; | 230 | struct PKT *PacketP; |
238 | struct PKT *PacketP; | 231 | |
239 | 232 | /* | |
240 | /* | 233 | ** not mapped in - most of the RIOPortp[] information |
241 | ** not mapped in - most of the RIOPortp[] information | 234 | ** has not been set up! |
242 | ** has not been set up! | 235 | ** Optimise: ports come in bundles of eight. |
243 | ** Optimise: ports come in bundles of eight. | 236 | */ |
244 | */ | 237 | if (!PortP->Mapped) { |
245 | if ( !PortP->Mapped ) { | 238 | port += 7; |
246 | port += 7; | 239 | continue; /* with the next port */ |
247 | continue; /* with the next port */ | 240 | } |
248 | } | 241 | |
249 | 242 | /* | |
250 | /* | 243 | ** If the host board isn't THIS host board, check the next one. |
251 | ** If the host board isn't THIS host board, check the next one. | 244 | ** optimise: ports come in bundles of eight. |
252 | ** optimise: ports come in bundles of eight. | 245 | */ |
253 | */ | 246 | if (PortP->HostP != HostP) { |
254 | if ( PortP->HostP != HostP ) { | 247 | port += 7; |
255 | port += 7; | 248 | continue; |
256 | continue; | 249 | } |
257 | } | 250 | |
258 | 251 | /* | |
259 | /* | 252 | ** Let us see - is the port open? If not, then don't service it. |
260 | ** Let us see - is the port open? If not, then don't service it. | 253 | */ |
261 | */ | 254 | if (!(PortP->PortState & PORT_ISOPEN)) { |
262 | if ( !( PortP->PortState & PORT_ISOPEN ) ) { | 255 | continue; |
263 | continue; | 256 | } |
264 | } | 257 | |
265 | 258 | /* | |
266 | /* | 259 | ** find corresponding tty structure. The process of mapping |
267 | ** find corresponding tty structure. The process of mapping | 260 | ** the ports puts these here. |
268 | ** the ports puts these here. | 261 | */ |
269 | */ | 262 | ttyP = PortP->gs.tty; |
270 | ttyP = PortP->gs.tty; | 263 | |
271 | 264 | /* | |
272 | /* | 265 | ** Lock the port before we begin working on it. |
273 | ** Lock the port before we begin working on it. | 266 | */ |
274 | */ | 267 | rio_spin_lock(&PortP->portSem); |
275 | rio_spin_lock(&PortP->portSem); | 268 | |
276 | 269 | /* | |
277 | /* | 270 | ** Process received data if there is any. |
278 | ** Process received data if there is any. | 271 | */ |
279 | */ | 272 | if (can_remove_receive(&PacketP, PortP)) |
280 | if ( can_remove_receive( &PacketP, PortP ) ) | 273 | RIOReceive(p, PortP); |
281 | RIOReceive(p, PortP); | 274 | |
282 | 275 | /* | |
283 | /* | 276 | ** If there is no data left to be read from the port, and |
284 | ** If there is no data left to be read from the port, and | 277 | ** it's handshake bit is set, then we must clear the handshake, |
285 | ** it's handshake bit is set, then we must clear the handshake, | 278 | ** so that that downstream RTA is re-enabled. |
286 | ** so that that downstream RTA is re-enabled. | 279 | */ |
287 | */ | 280 | if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) { |
288 | if ( !can_remove_receive( &PacketP, PortP ) && | ||
289 | ( RWORD( PortP->PhbP->handshake )==PHB_HANDSHAKE_SET ) ) { | ||
290 | /* | 281 | /* |
291 | ** MAGIC! ( Basically, handshake the RX buffer, so that | 282 | ** MAGIC! ( Basically, handshake the RX buffer, so that |
292 | ** the RTAs upstream can be re-enabled. ) | 283 | ** the RTAs upstream can be re-enabled. ) |
293 | */ | 284 | */ |
294 | rio_dprintk (RIO_DEBUG_INTR, "Set RX handshake bit\n"); | 285 | rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n"); |
295 | WWORD( PortP->PhbP->handshake, | 286 | WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); |
296 | PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET ); | 287 | } |
297 | } | 288 | rio_spin_unlock(&PortP->portSem); |
298 | rio_spin_unlock(&PortP->portSem); | 289 | } |
299 | } | ||
300 | } | ||
301 | |||
302 | if ( RWORD( HostP->ParmMapP->tx_intr ) ) { | ||
303 | int port; | ||
304 | |||
305 | WWORD( HostP->ParmMapP->tx_intr , 0); | ||
306 | |||
307 | p->RIOTxCount++; | ||
308 | TxIntr++; | ||
309 | rio_dprintk (RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP-p->RIOHosts); | ||
310 | |||
311 | /* | ||
312 | ** Loop through every port. | ||
313 | ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX | ||
314 | ** associated ) then it is worth checking. | ||
315 | */ | ||
316 | for ( port=p->RIOFirstPortsBooted; | ||
317 | port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) { | ||
318 | struct Port *PortP = p->RIOPortp[port]; | ||
319 | struct tty_struct *ttyP; | ||
320 | struct PKT *PacketP; | ||
321 | |||
322 | /* | ||
323 | ** not mapped in - most of the RIOPortp[] information | ||
324 | ** has not been set up! | ||
325 | */ | ||
326 | if ( !PortP->Mapped ) { | ||
327 | port += 7; | ||
328 | continue; /* with the next port */ | ||
329 | } | ||
330 | |||
331 | /* | ||
332 | ** If the host board isn't running, then its data structures | ||
333 | ** are no use to us - continue quietly. | ||
334 | */ | ||
335 | if ( PortP->HostP != HostP ) { | ||
336 | port += 7; | ||
337 | continue; /* with the next port */ | ||
338 | } | ||
339 | |||
340 | /* | ||
341 | ** Let us see - is the port open? If not, then don't service it. | ||
342 | */ | ||
343 | if ( !( PortP->PortState & PORT_ISOPEN ) ) { | ||
344 | continue; | ||
345 | } | ||
346 | |||
347 | rio_dprintk (RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); | ||
348 | /* | ||
349 | ** Lock the port before we begin working on it. | ||
350 | */ | ||
351 | rio_spin_lock(&PortP->portSem); | ||
352 | |||
353 | /* | ||
354 | ** If we can't add anything to the transmit queue, then | ||
355 | ** we need do none of this processing. | ||
356 | */ | ||
357 | if ( !can_add_transmit( &PacketP, PortP ) ) { | ||
358 | rio_dprintk (RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); | ||
359 | rio_spin_unlock(&PortP->portSem); | ||
360 | continue; | ||
361 | } | ||
362 | |||
363 | /* | ||
364 | ** find corresponding tty structure. The process of mapping | ||
365 | ** the ports puts these here. | ||
366 | */ | ||
367 | ttyP = PortP->gs.tty; | ||
368 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ | ||
369 | if (!ttyP) { | ||
370 | rio_dprintk (RIO_DEBUG_INTR, "no tty, so skipping.\n"); | ||
371 | rio_spin_unlock(&PortP->portSem); | ||
372 | continue; | ||
373 | } | ||
374 | /* | ||
375 | ** If there is more room available we start up the transmit | ||
376 | ** data process again. This can be direct I/O, if the cookmode | ||
377 | ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the | ||
378 | ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch | ||
379 | ** characters via the line discipline. We must always call | ||
380 | ** the line discipline, | ||
381 | ** so that user input characters can be echoed correctly. | ||
382 | ** | ||
383 | ** ++++ Update +++++ | ||
384 | ** With the advent of double buffering, we now see if | ||
385 | ** TxBufferOut-In is non-zero. If so, then we copy a packet | ||
386 | ** to the output place, and set it going. If this empties | ||
387 | ** the buffer, then we must issue a wakeup( ) on OUT. | ||
388 | ** If it frees space in the buffer then we must issue | ||
389 | ** a wakeup( ) on IN. | ||
390 | ** | ||
391 | ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we | ||
392 | ** have to send a WFLUSH command down the PHB, to mark the | ||
393 | ** end point of a WFLUSH. We also need to clear out any | ||
394 | ** data from the double buffer! ( note that WflushFlag is a | ||
395 | ** *count* of the number of WFLUSH commands outstanding! ) | ||
396 | ** | ||
397 | ** ++++ And there's more! | ||
398 | ** If an RTA is powered off, then on again, and rebooted, | ||
399 | ** whilst it has ports open, then we need to re-open the ports. | ||
400 | ** ( reasonable enough ). We can't do this when we spot the | ||
401 | ** re-boot, in interrupt time, because the queue is probably | ||
402 | ** full. So, when we come in here, we need to test if any | ||
403 | ** ports are in this condition, and re-open the port before | ||
404 | ** we try to send any more data to it. Now, the re-booted | ||
405 | ** RTA will be discarding packets from the PHB until it | ||
406 | ** receives this open packet, but don't worry tooo much | ||
407 | ** about that. The one thing that is interesting is the | ||
408 | ** combination of this effect and the WFLUSH effect! | ||
409 | */ | ||
410 | /* For now don't handle RTA reboots. -- REW. | ||
411 | Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ | ||
412 | if ( PortP->MagicFlags ) { | ||
413 | #if 1 | ||
414 | if ( PortP->MagicFlags & MAGIC_REBOOT ) { | ||
415 | /* | ||
416 | ** well, the RTA has been rebooted, and there is room | ||
417 | ** on its queue to add the open packet that is required. | ||
418 | ** | ||
419 | ** The messy part of this line is trying to decide if | ||
420 | ** we need to call the Param function as a tty or as | ||
421 | ** a modem. | ||
422 | ** DONT USE CLOCAL AS A TEST FOR THIS! | ||
423 | ** | ||
424 | ** If we can't param the port, then move on to the | ||
425 | ** next port. | ||
426 | */ | ||
427 | PortP->InUse = NOT_INUSE; | ||
428 | |||
429 | rio_spin_unlock(&PortP->portSem); | ||
430 | if ( RIOParam(PortP, OPEN, ((PortP->Cor2Copy & | ||
431 | (COR2_RTSFLOW|COR2_CTSFLOW ) )== | ||
432 | (COR2_RTSFLOW|COR2_CTSFLOW ) ) ? | ||
433 | TRUE : FALSE, DONT_SLEEP ) == RIO_FAIL ) { | ||
434 | continue; /* with next port */ | ||
435 | } | ||
436 | rio_spin_lock(&PortP->portSem); | ||
437 | PortP->MagicFlags &= ~MAGIC_REBOOT; | ||
438 | } | 290 | } |
291 | |||
292 | if (RWORD(HostP->ParmMapP->tx_intr)) { | ||
293 | int port; | ||
294 | |||
295 | WWORD(HostP->ParmMapP->tx_intr, 0); | ||
296 | |||
297 | p->RIOTxCount++; | ||
298 | TxIntr++; | ||
299 | rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts); | ||
300 | |||
301 | /* | ||
302 | ** Loop through every port. | ||
303 | ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX | ||
304 | ** associated ) then it is worth checking. | ||
305 | */ | ||
306 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { | ||
307 | struct Port *PortP = p->RIOPortp[port]; | ||
308 | struct tty_struct *ttyP; | ||
309 | struct PKT *PacketP; | ||
310 | |||
311 | /* | ||
312 | ** not mapped in - most of the RIOPortp[] information | ||
313 | ** has not been set up! | ||
314 | */ | ||
315 | if (!PortP->Mapped) { | ||
316 | port += 7; | ||
317 | continue; /* with the next port */ | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | ** If the host board isn't running, then its data structures | ||
322 | ** are no use to us - continue quietly. | ||
323 | */ | ||
324 | if (PortP->HostP != HostP) { | ||
325 | port += 7; | ||
326 | continue; /* with the next port */ | ||
327 | } | ||
328 | |||
329 | /* | ||
330 | ** Let us see - is the port open? If not, then don't service it. | ||
331 | */ | ||
332 | if (!(PortP->PortState & PORT_ISOPEN)) { | ||
333 | continue; | ||
334 | } | ||
335 | |||
336 | rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); | ||
337 | /* | ||
338 | ** Lock the port before we begin working on it. | ||
339 | */ | ||
340 | rio_spin_lock(&PortP->portSem); | ||
341 | |||
342 | /* | ||
343 | ** If we can't add anything to the transmit queue, then | ||
344 | ** we need do none of this processing. | ||
345 | */ | ||
346 | if (!can_add_transmit(&PacketP, PortP)) { | ||
347 | rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); | ||
348 | rio_spin_unlock(&PortP->portSem); | ||
349 | continue; | ||
350 | } | ||
351 | |||
352 | /* | ||
353 | ** find corresponding tty structure. The process of mapping | ||
354 | ** the ports puts these here. | ||
355 | */ | ||
356 | ttyP = PortP->gs.tty; | ||
357 | /* If ttyP is NULL, the port is getting closed. Forget about it. */ | ||
358 | if (!ttyP) { | ||
359 | rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); | ||
360 | rio_spin_unlock(&PortP->portSem); | ||
361 | continue; | ||
362 | } | ||
363 | /* | ||
364 | ** If there is more room available we start up the transmit | ||
365 | ** data process again. This can be direct I/O, if the cookmode | ||
366 | ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the | ||
367 | ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch | ||
368 | ** characters via the line discipline. We must always call | ||
369 | ** the line discipline, | ||
370 | ** so that user input characters can be echoed correctly. | ||
371 | ** | ||
372 | ** ++++ Update +++++ | ||
373 | ** With the advent of double buffering, we now see if | ||
374 | ** TxBufferOut-In is non-zero. If so, then we copy a packet | ||
375 | ** to the output place, and set it going. If this empties | ||
376 | ** the buffer, then we must issue a wakeup( ) on OUT. | ||
377 | ** If it frees space in the buffer then we must issue | ||
378 | ** a wakeup( ) on IN. | ||
379 | ** | ||
380 | ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we | ||
381 | ** have to send a WFLUSH command down the PHB, to mark the | ||
382 | ** end point of a WFLUSH. We also need to clear out any | ||
383 | ** data from the double buffer! ( note that WflushFlag is a | ||
384 | ** *count* of the number of WFLUSH commands outstanding! ) | ||
385 | ** | ||
386 | ** ++++ And there's more! | ||
387 | ** If an RTA is powered off, then on again, and rebooted, | ||
388 | ** whilst it has ports open, then we need to re-open the ports. | ||
389 | ** ( reasonable enough ). We can't do this when we spot the | ||
390 | ** re-boot, in interrupt time, because the queue is probably | ||
391 | ** full. So, when we come in here, we need to test if any | ||
392 | ** ports are in this condition, and re-open the port before | ||
393 | ** we try to send any more data to it. Now, the re-booted | ||
394 | ** RTA will be discarding packets from the PHB until it | ||
395 | ** receives this open packet, but don't worry tooo much | ||
396 | ** about that. The one thing that is interesting is the | ||
397 | ** combination of this effect and the WFLUSH effect! | ||
398 | */ | ||
399 | /* For now don't handle RTA reboots. -- REW. | ||
400 | Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ | ||
401 | if (PortP->MagicFlags) { | ||
402 | #if 1 | ||
403 | if (PortP->MagicFlags & MAGIC_REBOOT) { | ||
404 | /* | ||
405 | ** well, the RTA has been rebooted, and there is room | ||
406 | ** on its queue to add the open packet that is required. | ||
407 | ** | ||
408 | ** The messy part of this line is trying to decide if | ||
409 | ** we need to call the Param function as a tty or as | ||
410 | ** a modem. | ||
411 | ** DONT USE CLOCAL AS A TEST FOR THIS! | ||
412 | ** | ||
413 | ** If we can't param the port, then move on to the | ||
414 | ** next port. | ||
415 | */ | ||
416 | PortP->InUse = NOT_INUSE; | ||
417 | |||
418 | rio_spin_unlock(&PortP->portSem); | ||
419 | if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) { | ||
420 | continue; /* with next port */ | ||
421 | } | ||
422 | rio_spin_lock(&PortP->portSem); | ||
423 | PortP->MagicFlags &= ~MAGIC_REBOOT; | ||
424 | } | ||
439 | #endif | 425 | #endif |
440 | 426 | ||
441 | /* | 427 | /* |
442 | ** As mentioned above, this is a tacky hack to cope | 428 | ** As mentioned above, this is a tacky hack to cope |
443 | ** with WFLUSH | 429 | ** with WFLUSH |
444 | */ | 430 | */ |
445 | if ( PortP->WflushFlag ) { | 431 | if (PortP->WflushFlag) { |
446 | rio_dprintk (RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); | 432 | rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); |
447 | 433 | ||
448 | if ( PortP->InUse ) | 434 | if (PortP->InUse) |
449 | rio_dprintk (RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); | 435 | rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); |
450 | } | 436 | } |
451 | 437 | ||
452 | while ( PortP->WflushFlag && | 438 | while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) { |
453 | can_add_transmit( &PacketP, PortP ) && | 439 | int p; |
454 | ( PortP->InUse == NOT_INUSE ) ) { | 440 | struct PktCmd *PktCmdP; |
455 | int p; | 441 | |
456 | struct PktCmd *PktCmdP; | 442 | rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); |
457 | 443 | /* | |
458 | rio_dprintk (RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); | 444 | ** make it look just like a WFLUSH command |
459 | /* | 445 | */ |
460 | ** make it look just like a WFLUSH command | 446 | PktCmdP = (struct PktCmd *) &PacketP->data[0]; |
461 | */ | 447 | |
462 | PktCmdP = ( struct PktCmd * )&PacketP->data[0]; | 448 | WBYTE(PktCmdP->Command, WFLUSH); |
463 | 449 | ||
464 | WBYTE( PktCmdP->Command , WFLUSH ); | 450 | p = PortP->HostPort % (ushort) PORTS_PER_RTA; |
465 | 451 | ||
466 | p = PortP->HostPort % ( ushort )PORTS_PER_RTA; | 452 | /* |
467 | 453 | ** If second block of ports for 16 port RTA, add 8 | |
468 | /* | 454 | ** to index 8-15. |
469 | ** If second block of ports for 16 port RTA, add 8 | 455 | */ |
470 | ** to index 8-15. | 456 | if (PortP->SecondBlock) |
471 | */ | 457 | p += PORTS_PER_RTA; |
472 | if ( PortP->SecondBlock ) | 458 | |
473 | p += PORTS_PER_RTA; | 459 | WBYTE(PktCmdP->PhbNum, p); |
474 | 460 | ||
475 | WBYTE( PktCmdP->PhbNum, p ); | 461 | /* |
476 | 462 | ** to make debuggery easier | |
477 | /* | 463 | */ |
478 | ** to make debuggery easier | 464 | WBYTE(PacketP->data[2], 'W'); |
479 | */ | 465 | WBYTE(PacketP->data[3], 'F'); |
480 | WBYTE( PacketP->data[ 2], 'W' ); | 466 | WBYTE(PacketP->data[4], 'L'); |
481 | WBYTE( PacketP->data[ 3], 'F' ); | 467 | WBYTE(PacketP->data[5], 'U'); |
482 | WBYTE( PacketP->data[ 4], 'L' ); | 468 | WBYTE(PacketP->data[6], 'S'); |
483 | WBYTE( PacketP->data[ 5], 'U' ); | 469 | WBYTE(PacketP->data[7], 'H'); |
484 | WBYTE( PacketP->data[ 6], 'S' ); | 470 | WBYTE(PacketP->data[8], ' '); |
485 | WBYTE( PacketP->data[ 7], 'H' ); | 471 | WBYTE(PacketP->data[9], '0' + PortP->WflushFlag); |
486 | WBYTE( PacketP->data[ 8], ' ' ); | 472 | WBYTE(PacketP->data[10], ' '); |
487 | WBYTE( PacketP->data[ 9], '0'+PortP->WflushFlag ); | 473 | WBYTE(PacketP->data[11], ' '); |
488 | WBYTE( PacketP->data[10], ' ' ); | 474 | WBYTE(PacketP->data[12], '\0'); |
489 | WBYTE( PacketP->data[11], ' ' ); | 475 | |
490 | WBYTE( PacketP->data[12], '\0' ); | 476 | /* |
491 | 477 | ** its two bytes long! | |
492 | /* | 478 | */ |
493 | ** its two bytes long! | 479 | WBYTE(PacketP->len, PKT_CMD_BIT | 2); |
494 | */ | 480 | |
495 | WBYTE( PacketP->len , PKT_CMD_BIT | 2 ); | 481 | /* |
496 | 482 | ** queue it! | |
497 | /* | 483 | */ |
498 | ** queue it! | 484 | if (!(PortP->State & RIO_DELETED)) { |
499 | */ | 485 | add_transmit(PortP); |
500 | if ( !( PortP->State & RIO_DELETED ) ) { | 486 | /* |
501 | add_transmit( PortP ); | 487 | ** Count chars tx'd for port statistics reporting |
502 | /* | 488 | */ |
503 | ** Count chars tx'd for port statistics reporting | 489 | if (PortP->statsGather) |
504 | */ | 490 | PortP->txchars += 2; |
505 | if ( PortP->statsGather ) | 491 | } |
506 | PortP->txchars += 2; | 492 | |
507 | } | 493 | if (--(PortP->WflushFlag) == 0) { |
508 | 494 | PortP->MagicFlags &= ~MAGIC_FLUSH; | |
509 | if ( --( PortP->WflushFlag ) == 0 ) { | 495 | } |
510 | PortP->MagicFlags &= ~MAGIC_FLUSH; | 496 | |
511 | } | 497 | rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag); |
512 | 498 | } | |
513 | rio_dprintk (RIO_DEBUG_INTR, "Wflush count now stands at %d\n", | 499 | if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) { |
514 | PortP->WflushFlag); | 500 | if (PortP->MagicFlags & MAGIC_FLUSH) { |
515 | } | 501 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; |
516 | if ( PortP->MagicFlags & MORE_OUTPUT_EYGOR ) { | 502 | } else { |
517 | if ( PortP->MagicFlags & MAGIC_FLUSH ) { | 503 | if (!can_add_transmit(&PacketP, PortP)) { |
518 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | 504 | rio_spin_unlock(&PortP->portSem); |
519 | } | 505 | continue; |
520 | else { | 506 | } |
521 | if ( !can_add_transmit( &PacketP, PortP ) ) { | 507 | rio_spin_unlock(&PortP->portSem); |
522 | rio_spin_unlock(&PortP->portSem); | 508 | RIOTxEnable((char *) PortP); |
523 | continue; | 509 | rio_spin_lock(&PortP->portSem); |
524 | } | 510 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; |
525 | rio_spin_unlock(&PortP->portSem); | 511 | } |
526 | RIOTxEnable((char *)PortP); | 512 | } |
527 | rio_spin_lock(&PortP->portSem); | 513 | } |
528 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | 514 | |
529 | } | 515 | |
516 | /* | ||
517 | ** If we can't add anything to the transmit queue, then | ||
518 | ** we need do none of the remaining processing. | ||
519 | */ | ||
520 | if (!can_add_transmit(&PacketP, PortP)) { | ||
521 | rio_spin_unlock(&PortP->portSem); | ||
522 | continue; | ||
523 | } | ||
524 | |||
525 | rio_spin_unlock(&PortP->portSem); | ||
526 | RIOTxEnable((char *) PortP); | ||
527 | } | ||
530 | } | 528 | } |
531 | } | ||
532 | |||
533 | |||
534 | /* | ||
535 | ** If we can't add anything to the transmit queue, then | ||
536 | ** we need do none of the remaining processing. | ||
537 | */ | ||
538 | if (!can_add_transmit( &PacketP, PortP ) ) { | ||
539 | rio_spin_unlock(&PortP->portSem); | ||
540 | continue; | ||
541 | } | ||
542 | |||
543 | rio_spin_unlock(&PortP->portSem); | ||
544 | RIOTxEnable((char *)PortP); | ||
545 | } | ||
546 | } | ||
547 | } | 529 | } |
548 | 530 | ||
549 | /* | 531 | /* |
@@ -551,176 +533,162 @@ int From; | |||
551 | ** NB: Called with the tty locked. The spl from the lockb( ) is passed. | 533 | ** NB: Called with the tty locked. The spl from the lockb( ) is passed. |
552 | ** we return the ttySpl level that we re-locked at. | 534 | ** we return the ttySpl level that we re-locked at. |
553 | */ | 535 | */ |
554 | static void | 536 | static void RIOReceive(p, PortP) |
555 | RIOReceive(p, PortP) | 537 | struct rio_info *p; |
556 | struct rio_info * p; | 538 | struct Port *PortP; |
557 | struct Port * PortP; | ||
558 | { | 539 | { |
559 | struct tty_struct *TtyP; | 540 | struct tty_struct *TtyP; |
560 | register ushort transCount; | 541 | register ushort transCount; |
561 | struct PKT *PacketP; | 542 | struct PKT *PacketP; |
562 | register uint DataCnt; | 543 | register uint DataCnt; |
563 | uchar * ptr; | 544 | uchar *ptr; |
564 | unsigned char *buf; | 545 | unsigned char *buf; |
565 | int copied =0; | 546 | int copied = 0; |
566 | 547 | ||
567 | static int intCount, RxIntCnt; | 548 | static int intCount, RxIntCnt; |
568 | 549 | ||
569 | /* | 550 | /* |
570 | ** The receive data process is to remove packets from the | 551 | ** The receive data process is to remove packets from the |
571 | ** PHB until there aren't any more or the current cblock | 552 | ** PHB until there aren't any more or the current cblock |
572 | ** is full. When this occurs, there will be some left over | 553 | ** is full. When this occurs, there will be some left over |
573 | ** data in the packet, that we must do something with. | 554 | ** data in the packet, that we must do something with. |
574 | ** As we haven't unhooked the packet from the read list | 555 | ** As we haven't unhooked the packet from the read list |
575 | ** yet, we can just leave the packet there, having first | 556 | ** yet, we can just leave the packet there, having first |
576 | ** made a note of how far we got. This means that we need | 557 | ** made a note of how far we got. This means that we need |
577 | ** a pointer per port saying where we start taking the | 558 | ** a pointer per port saying where we start taking the |
578 | ** data from - this will normally be zero, but when we | 559 | ** data from - this will normally be zero, but when we |
579 | ** run out of space it will be set to the offset of the | 560 | ** run out of space it will be set to the offset of the |
580 | ** next byte to copy from the packet data area. The packet | 561 | ** next byte to copy from the packet data area. The packet |
581 | ** length field is decremented by the number of bytes that | 562 | ** length field is decremented by the number of bytes that |
582 | ** we succesfully removed from the packet. When this reaches | 563 | ** we succesfully removed from the packet. When this reaches |
583 | ** zero, we reset the offset pointer to be zero, and free | 564 | ** zero, we reset the offset pointer to be zero, and free |
584 | ** the packet from the front of the queue. | 565 | ** the packet from the front of the queue. |
585 | */ | 566 | */ |
586 | 567 | ||
587 | intCount++; | 568 | intCount++; |
588 | 569 | ||
589 | TtyP = PortP->gs.tty; | 570 | TtyP = PortP->gs.tty; |
590 | if (!TtyP) { | 571 | if (!TtyP) { |
591 | rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); | 572 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); |
592 | return; | 573 | return; |
593 | } | ||
594 | |||
595 | if (PortP->State & RIO_THROTTLE_RX) { | ||
596 | rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); | ||
597 | return; | ||
598 | } | ||
599 | |||
600 | if ( PortP->State & RIO_DELETED ) | ||
601 | { | ||
602 | while ( can_remove_receive( &PacketP, PortP ) ) | ||
603 | { | ||
604 | remove_receive( PortP ); | ||
605 | put_free_end( PortP->HostP, PacketP ); | ||
606 | } | 574 | } |
607 | } | 575 | |
608 | else | 576 | if (PortP->State & RIO_THROTTLE_RX) { |
609 | { | 577 | rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); |
610 | /* | 578 | return; |
611 | ** loop, just so long as: | 579 | } |
612 | ** i ) there's some data ( i.e. can_remove_receive ) | 580 | |
613 | ** ii ) we haven't been blocked | 581 | if (PortP->State & RIO_DELETED) { |
614 | ** iii ) there's somewhere to put the data | 582 | while (can_remove_receive(&PacketP, PortP)) { |
615 | ** iv ) we haven't outstayed our welcome | 583 | remove_receive(PortP); |
616 | */ | 584 | put_free_end(PortP->HostP, PacketP); |
617 | transCount = 1; | 585 | } |
618 | while ( can_remove_receive(&PacketP, PortP) | 586 | } else { |
619 | && transCount) | 587 | /* |
620 | { | 588 | ** loop, just so long as: |
589 | ** i ) there's some data ( i.e. can_remove_receive ) | ||
590 | ** ii ) we haven't been blocked | ||
591 | ** iii ) there's somewhere to put the data | ||
592 | ** iv ) we haven't outstayed our welcome | ||
593 | */ | ||
594 | transCount = 1; | ||
595 | while (can_remove_receive(&PacketP, PortP) | ||
596 | && transCount) { | ||
621 | #ifdef STATS | 597 | #ifdef STATS |
622 | PortP->Stat.RxIntCnt++; | 598 | PortP->Stat.RxIntCnt++; |
623 | #endif /* STATS */ | 599 | #endif /* STATS */ |
624 | RxIntCnt++; | 600 | RxIntCnt++; |
625 | 601 | ||
626 | /* | 602 | /* |
627 | ** check that it is not a command! | 603 | ** check that it is not a command! |
628 | */ | 604 | */ |
629 | if ( PacketP->len & PKT_CMD_BIT ) { | 605 | if (PacketP->len & PKT_CMD_BIT) { |
630 | rio_dprintk (RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); | 606 | rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); |
631 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ | 607 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ |
632 | rio_dprintk (RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); | 608 | rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); |
633 | rio_dprintk (RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); | 609 | rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); |
634 | rio_dprintk (RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); | 610 | rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); |
635 | rio_dprintk (RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); | 611 | rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); |
636 | rio_dprintk (RIO_DEBUG_INTR, " len = %d\n", PacketP->len); | 612 | rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", PacketP->len); |
637 | rio_dprintk (RIO_DEBUG_INTR, " control = %d\n", PacketP->control); | 613 | rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", PacketP->control); |
638 | rio_dprintk (RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); | 614 | rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); |
639 | rio_dprintk (RIO_DEBUG_INTR, " data bytes: "); | 615 | rio_dprintk(RIO_DEBUG_INTR, " data bytes: "); |
640 | for ( DataCnt=0; DataCnt<PKT_MAX_DATA_LEN; DataCnt++ ) | 616 | for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++) |
641 | rio_dprintk (RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); | 617 | rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); |
642 | remove_receive( PortP ); | 618 | remove_receive(PortP); |
643 | put_free_end( PortP->HostP, PacketP ); | 619 | put_free_end(PortP->HostP, PacketP); |
644 | continue; /* with next packet */ | 620 | continue; /* with next packet */ |
645 | } | 621 | } |
646 | 622 | ||
647 | /* | 623 | /* |
648 | ** How many characters can we move 'upstream' ? | 624 | ** How many characters can we move 'upstream' ? |
649 | ** | 625 | ** |
650 | ** Determine the minimum of the amount of data | 626 | ** Determine the minimum of the amount of data |
651 | ** available and the amount of space in which to | 627 | ** available and the amount of space in which to |
652 | ** put it. | 628 | ** put it. |
653 | ** | 629 | ** |
654 | ** 1. Get the packet length by masking 'len' | 630 | ** 1. Get the packet length by masking 'len' |
655 | ** for only the length bits. | 631 | ** for only the length bits. |
656 | ** 2. Available space is [buffer size] - [space used] | 632 | ** 2. Available space is [buffer size] - [space used] |
657 | ** | 633 | ** |
658 | ** Transfer count is the minimum of packet length | 634 | ** Transfer count is the minimum of packet length |
659 | ** and available space. | 635 | ** and available space. |
660 | */ | 636 | */ |
661 | 637 | ||
662 | transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); | 638 | transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); |
663 | rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", | 639 | rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); |
664 | PortP->PortNum, transCount); | 640 | /* |
665 | /* | 641 | ** To use the following 'kkprintfs' for debugging - change the '#undef' |
666 | ** To use the following 'kkprintfs' for debugging - change the '#undef' | 642 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the |
667 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the | 643 | ** driver). |
668 | ** driver). | 644 | */ |
669 | */ | ||
670 | #undef ___DEBUG_IT___ | 645 | #undef ___DEBUG_IT___ |
671 | #ifdef ___DEBUG_IT___ | 646 | #ifdef ___DEBUG_IT___ |
672 | kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", | 647 | kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags); |
673 | intCount, | ||
674 | RxIntCnt, | ||
675 | PortP->PortNum, | ||
676 | TtyP->rxqueue.count, | ||
677 | transCount, | ||
678 | TtyP->flags ); | ||
679 | #endif | 648 | #endif |
680 | ptr = (uchar *) PacketP->data + PortP->RxDataStart; | 649 | ptr = (uchar *) PacketP->data + PortP->RxDataStart; |
681 | 650 | ||
682 | tty_prepare_flip_string(TtyP, &buf, transCount); | 651 | tty_prepare_flip_string(TtyP, &buf, transCount); |
683 | rio_memcpy_fromio (buf, ptr, transCount); | 652 | rio_memcpy_fromio(buf, ptr, transCount); |
684 | #ifdef STATS | 653 | #ifdef STATS |
685 | /* | 654 | /* |
686 | ** keep a count for statistical purposes | 655 | ** keep a count for statistical purposes |
687 | */ | 656 | */ |
688 | PortP->Stat.RxCharCnt += transCount; | 657 | PortP->Stat.RxCharCnt += transCount; |
689 | #endif | 658 | #endif |
690 | PortP->RxDataStart += transCount; | 659 | PortP->RxDataStart += transCount; |
691 | PacketP->len -= transCount; | 660 | PacketP->len -= transCount; |
692 | copied += transCount; | 661 | copied += transCount; |
693 | 662 | ||
694 | 663 | ||
695 | #ifdef ___DEBUG_IT___ | 664 | #ifdef ___DEBUG_IT___ |
696 | kkprintf("T:%d L:%d\n", DataCnt, PacketP->len ); | 665 | kkprintf("T:%d L:%d\n", DataCnt, PacketP->len); |
697 | #endif | 666 | #endif |
698 | 667 | ||
699 | if ( PacketP->len == 0 ) | 668 | if (PacketP->len == 0) { |
700 | { | ||
701 | /* | 669 | /* |
702 | ** If we have emptied the packet, then we can | 670 | ** If we have emptied the packet, then we can |
703 | ** free it, and reset the start pointer for | 671 | ** free it, and reset the start pointer for |
704 | ** the next packet. | 672 | ** the next packet. |
705 | */ | 673 | */ |
706 | remove_receive( PortP ); | 674 | remove_receive(PortP); |
707 | put_free_end( PortP->HostP, PacketP ); | 675 | put_free_end(PortP->HostP, PacketP); |
708 | PortP->RxDataStart = 0; | 676 | PortP->RxDataStart = 0; |
709 | #ifdef STATS | 677 | #ifdef STATS |
710 | /* | 678 | /* |
711 | ** more lies ( oops, I mean statistics ) | 679 | ** more lies ( oops, I mean statistics ) |
712 | */ | 680 | */ |
713 | PortP->Stat.RxPktCnt++; | 681 | PortP->Stat.RxPktCnt++; |
714 | #endif /* STATS */ | 682 | #endif /* STATS */ |
715 | } | 683 | } |
684 | } | ||
685 | } | ||
686 | if (copied) { | ||
687 | rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); | ||
688 | tty_flip_buffer_push(TtyP); | ||
716 | } | 689 | } |
717 | } | ||
718 | if (copied) { | ||
719 | rio_dprintk (RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); | ||
720 | tty_flip_buffer_push (TtyP); | ||
721 | } | ||
722 | 690 | ||
723 | return; | 691 | return; |
724 | } | 692 | } |
725 | 693 | ||
726 | #ifdef FUTURE_RELEASE | 694 | #ifdef FUTURE_RELEASE |
@@ -728,221 +696,210 @@ struct Port * PortP; | |||
728 | ** The proc routine called by the line discipline to do the work for it. | 696 | ** The proc routine called by the line discipline to do the work for it. |
729 | ** The proc routine works hand in hand with the interrupt routine. | 697 | ** The proc routine works hand in hand with the interrupt routine. |
730 | */ | 698 | */ |
731 | int | 699 | int riotproc(p, tp, cmd, port) |
732 | riotproc(p, tp, cmd, port) | 700 | struct rio_info *p; |
733 | struct rio_info * p; | ||
734 | register struct ttystatics *tp; | 701 | register struct ttystatics *tp; |
735 | int cmd; | 702 | int cmd; |
736 | int port; | 703 | int port; |
737 | { | 704 | { |
738 | register struct Port *PortP; | 705 | register struct Port *PortP; |
739 | int SysPort; | 706 | int SysPort; |
740 | struct PKT *PacketP; | 707 | struct PKT *PacketP; |
741 | 708 | ||
742 | SysPort = port; /* Believe me, it works. */ | 709 | SysPort = port; /* Believe me, it works. */ |
743 | 710 | ||
744 | if ( SysPort < 0 || SysPort >= RIO_PORTS ) { | 711 | if (SysPort < 0 || SysPort >= RIO_PORTS) { |
745 | rio_dprintk (RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n",SysPort); | 712 | rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort); |
746 | return 0; | 713 | return 0; |
747 | } | 714 | } |
748 | PortP = p->RIOPortp[SysPort]; | 715 | PortP = p->RIOPortp[SysPort]; |
749 | 716 | ||
750 | if ((uint)PortP->PhbP < (uint)PortP->Caddr || | 717 | if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) { |
751 | (uint)PortP->PhbP >= (uint)PortP->Caddr+SIXTY_FOUR_K ) { | 718 | rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort); |
752 | rio_dprintk (RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", | 719 | rio_dprintk(RIO_DEBUG_INTR, " PortP = 0x%x\n", PortP); |
753 | SysPort); | 720 | rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP); |
754 | rio_dprintk (RIO_DEBUG_INTR, " PortP = 0x%x\n",PortP); | 721 | rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP); |
755 | rio_dprintk (RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n",PortP->PhbP); | 722 | rio_dprintk(RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n", PortP->HostPort); |
756 | rio_dprintk (RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n",PortP->PhbP); | ||
757 | rio_dprintk (RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n",PortP->HostPort); | ||
758 | return 0; | 723 | return 0; |
759 | } | 724 | } |
760 | 725 | ||
761 | switch(cmd) { | 726 | switch (cmd) { |
762 | case T_WFLUSH: | 727 | case T_WFLUSH: |
763 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH\n"); | 728 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n"); |
729 | /* | ||
730 | ** Because of the spooky way the RIO works, we don't need | ||
731 | ** to issue a flush command on any of the SET*F commands, | ||
732 | ** as that causes trouble with getty and login, which issue | ||
733 | ** these commands to incur a READ flush, and rely on the fact | ||
734 | ** that the line discipline does a wait for drain for them. | ||
735 | ** As the rio doesn't wait for drain, the write flush would | ||
736 | ** destroy the Password: prompt. This isn't very friendly, so | ||
737 | ** here we only issue a WFLUSH command if we are in the interrupt | ||
738 | ** routine, or we aren't executing a SET*F command. | ||
739 | */ | ||
740 | if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) { | ||
764 | /* | 741 | /* |
765 | ** Because of the spooky way the RIO works, we don't need | 742 | ** form a wflush packet - 1 byte long, no data |
766 | ** to issue a flush command on any of the SET*F commands, | 743 | */ |
767 | ** as that causes trouble with getty and login, which issue | 744 | if (PortP->State & RIO_DELETED) { |
768 | ** these commands to incur a READ flush, and rely on the fact | 745 | rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); |
769 | ** that the line discipline does a wait for drain for them. | 746 | } else { |
770 | ** As the rio doesn't wait for drain, the write flush would | 747 | if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) { |
771 | ** destroy the Password: prompt. This isn't very friendly, so | 748 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); |
772 | ** here we only issue a WFLUSH command if we are in the interrupt | 749 | } else |
773 | ** routine, or we aren't executing a SET*F command. | 750 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n"); |
774 | */ | ||
775 | if ( PortP->HostP->InIntr || !PortP->FlushCmdBodge ) { | ||
776 | /* | ||
777 | ** form a wflush packet - 1 byte long, no data | ||
778 | */ | ||
779 | if ( PortP->State & RIO_DELETED ) { | ||
780 | rio_dprintk (RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); | ||
781 | } | ||
782 | else { | ||
783 | if ( RIOPreemptiveCmd(p, PortP, WFLUSH ) == RIO_FAIL ) { | ||
784 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); | ||
785 | } | ||
786 | else | ||
787 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command\n"); | ||
788 | } | ||
789 | /* | ||
790 | ** WFLUSH operation - flush the data! | ||
791 | */ | ||
792 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | ||
793 | } | ||
794 | else { | ||
795 | rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n"); | ||
796 | } | 751 | } |
797 | /* | 752 | /* |
798 | ** sort out the line discipline | 753 | ** WFLUSH operation - flush the data! |
799 | */ | 754 | */ |
800 | if (PortP->CookMode == COOK_WELL) | 755 | PortP->TxBufferIn = PortP->TxBufferOut = 0; |
801 | goto start; | 756 | } else { |
802 | break; | 757 | rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n"); |
803 | 758 | } | |
804 | case T_RESUME: | 759 | /* |
805 | rio_dprintk (RIO_DEBUG_INTR, "T_RESUME\n"); | 760 | ** sort out the line discipline |
806 | /* | 761 | */ |
807 | ** send pre-emptive resume packet | 762 | if (PortP->CookMode == COOK_WELL) |
808 | */ | 763 | goto start; |
809 | if ( PortP->State & RIO_DELETED ) { | 764 | break; |
810 | rio_dprintk (RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); | 765 | |
766 | case T_RESUME: | ||
767 | rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n"); | ||
768 | /* | ||
769 | ** send pre-emptive resume packet | ||
770 | */ | ||
771 | if (PortP->State & RIO_DELETED) { | ||
772 | rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); | ||
773 | } else { | ||
774 | if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) { | ||
775 | rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n"); | ||
811 | } | 776 | } |
812 | else { | 777 | } |
813 | if ( RIOPreemptiveCmd(p, PortP, RESUME ) == RIO_FAIL ) { | 778 | /* |
814 | rio_dprintk (RIO_DEBUG_INTR, "T_RESUME Command failed\n"); | 779 | ** and re-start the sender software! |
815 | } | 780 | */ |
781 | if (PortP->CookMode == COOK_WELL) | ||
782 | goto start; | ||
783 | break; | ||
784 | |||
785 | case T_TIME: | ||
786 | rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n"); | ||
787 | /* | ||
788 | ** T_TIME is called when xDLY is set in oflags and | ||
789 | ** the line discipline timeout has expired. It's | ||
790 | ** function in life is to clear the TIMEOUT flag | ||
791 | ** and to re-start output to the port. | ||
792 | */ | ||
793 | /* | ||
794 | ** Fall through and re-start output | ||
795 | */ | ||
796 | case T_OUTPUT: | ||
797 | start: | ||
798 | if (PortP->MagicFlags & MAGIC_FLUSH) { | ||
799 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | ||
800 | return 0; | ||
801 | } | ||
802 | RIOTxEnable((char *) PortP); | ||
803 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | ||
804 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */ | ||
805 | break; | ||
806 | |||
807 | case T_SUSPEND: | ||
808 | rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n"); | ||
809 | /* | ||
810 | ** send a suspend pre-emptive packet. | ||
811 | */ | ||
812 | if (PortP->State & RIO_DELETED) { | ||
813 | rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); | ||
814 | } else { | ||
815 | if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) { | ||
816 | rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n"); | ||
816 | } | 817 | } |
817 | /* | 818 | } |
818 | ** and re-start the sender software! | 819 | /* |
819 | */ | 820 | ** done! |
820 | if (PortP->CookMode == COOK_WELL) | 821 | */ |
821 | goto start; | 822 | break; |
822 | break; | 823 | |
823 | 824 | case T_BLOCK: | |
824 | case T_TIME: | 825 | rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n"); |
825 | rio_dprintk (RIO_DEBUG_INTR, "T_TIME\n"); | 826 | break; |
826 | /* | 827 | |
827 | ** T_TIME is called when xDLY is set in oflags and | 828 | case T_RFLUSH: |
828 | ** the line discipline timeout has expired. It's | 829 | rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n"); |
829 | ** function in life is to clear the TIMEOUT flag | 830 | if (PortP->State & RIO_DELETED) { |
830 | ** and to re-start output to the port. | 831 | rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); |
831 | */ | 832 | PortP->RxDataStart = 0; |
832 | /* | 833 | } else { |
833 | ** Fall through and re-start output | 834 | if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) { |
834 | */ | 835 | rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n"); |
835 | case T_OUTPUT: | ||
836 | start: | ||
837 | if ( PortP->MagicFlags & MAGIC_FLUSH ) { | ||
838 | PortP->MagicFlags |= MORE_OUTPUT_EYGOR; | ||
839 | return 0; | 836 | return 0; |
840 | } | 837 | } |
841 | RIOTxEnable((char *)PortP); | 838 | PortP->RxDataStart = 0; |
842 | PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; | 839 | while (can_remove_receive(&PacketP, PortP)) { |
843 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n");*/ | 840 | remove_receive(PortP); |
844 | break; | 841 | ShowPacket(DBG_PROC, PacketP); |
845 | 842 | put_free_end(PortP->HostP, PacketP); | |
846 | case T_SUSPEND: | ||
847 | rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND\n"); | ||
848 | /* | ||
849 | ** send a suspend pre-emptive packet. | ||
850 | */ | ||
851 | if ( PortP->State & RIO_DELETED ) { | ||
852 | rio_dprintk (RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); | ||
853 | } | ||
854 | else { | ||
855 | if ( RIOPreemptiveCmd(p, PortP, SUSPEND ) == RIO_FAIL ) { | ||
856 | rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND Command failed\n"); | ||
857 | } | ||
858 | } | 843 | } |
859 | /* | 844 | if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) { |
860 | ** done! | 845 | /* |
861 | */ | 846 | ** MAGIC! |
862 | break; | 847 | */ |
863 | 848 | rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n"); | |
864 | case T_BLOCK: | 849 | PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; |
865 | rio_dprintk (RIO_DEBUG_INTR, "T_BLOCK\n"); | ||
866 | break; | ||
867 | |||
868 | case T_RFLUSH: | ||
869 | rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH\n"); | ||
870 | if ( PortP->State & RIO_DELETED ) { | ||
871 | rio_dprintk (RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); | ||
872 | PortP->RxDataStart = 0; | ||
873 | } | ||
874 | else { | ||
875 | if ( RIOPreemptiveCmd( p, PortP, RFLUSH ) == RIO_FAIL ) { | ||
876 | rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH Command failed\n"); | ||
877 | return 0; | ||
878 | } | ||
879 | PortP->RxDataStart = 0; | ||
880 | while ( can_remove_receive(&PacketP, PortP) ) { | ||
881 | remove_receive(PortP); | ||
882 | ShowPacket(DBG_PROC, PacketP ); | ||
883 | put_free_end(PortP->HostP, PacketP ); | ||
884 | } | ||
885 | if ( PortP->PhbP->handshake == PHB_HANDSHAKE_SET ) { | ||
886 | /* | ||
887 | ** MAGIC! | ||
888 | */ | ||
889 | rio_dprintk (RIO_DEBUG_INTR, "Set receive handshake bit\n"); | ||
890 | PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; | ||
891 | } | ||
892 | } | ||
893 | break; | ||
894 | /* FALLTHROUGH */ | ||
895 | case T_UNBLOCK: | ||
896 | rio_dprintk (RIO_DEBUG_INTR, "T_UNBLOCK\n"); | ||
897 | /* | ||
898 | ** If there is any data to receive set a timeout to service it. | ||
899 | */ | ||
900 | RIOReceive(p, PortP); | ||
901 | break; | ||
902 | |||
903 | case T_BREAK: | ||
904 | rio_dprintk (RIO_DEBUG_INTR, "T_BREAK\n"); | ||
905 | /* | ||
906 | ** Send a break command. For Sys V | ||
907 | ** this is a timed break, so we | ||
908 | ** send a SBREAK[time] packet | ||
909 | */ | ||
910 | /* | ||
911 | ** Build a BREAK command | ||
912 | */ | ||
913 | if ( PortP->State & RIO_DELETED ) { | ||
914 | rio_dprintk (RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); | ||
915 | } | 850 | } |
916 | else { | 851 | } |
917 | if (RIOShortCommand(PortP,SBREAK,2, | 852 | break; |
918 | p->RIOConf.BreakInterval)==RIO_FAIL) { | 853 | /* FALLTHROUGH */ |
919 | rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | 854 | case T_UNBLOCK: |
920 | } | 855 | rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n"); |
856 | /* | ||
857 | ** If there is any data to receive set a timeout to service it. | ||
858 | */ | ||
859 | RIOReceive(p, PortP); | ||
860 | break; | ||
861 | |||
862 | case T_BREAK: | ||
863 | rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n"); | ||
864 | /* | ||
865 | ** Send a break command. For Sys V | ||
866 | ** this is a timed break, so we | ||
867 | ** send a SBREAK[time] packet | ||
868 | */ | ||
869 | /* | ||
870 | ** Build a BREAK command | ||
871 | */ | ||
872 | if (PortP->State & RIO_DELETED) { | ||
873 | rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); | ||
874 | } else { | ||
875 | if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) { | ||
876 | rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); | ||
921 | } | 877 | } |
922 | 878 | } | |
923 | /* | 879 | |
924 | ** done! | 880 | /* |
925 | */ | 881 | ** done! |
926 | break; | 882 | */ |
927 | 883 | break; | |
928 | case T_INPUT: | 884 | |
929 | rio_dprintk (RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); | 885 | case T_INPUT: |
930 | break; | 886 | rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); |
931 | case T_PARM: | 887 | break; |
932 | rio_dprintk (RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); | 888 | case T_PARM: |
933 | break; | 889 | rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); |
934 | 890 | break; | |
935 | case T_SWTCH: | 891 | |
936 | rio_dprintk (RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); | 892 | case T_SWTCH: |
937 | break; | 893 | rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); |
938 | 894 | break; | |
939 | default: | 895 | |
940 | rio_dprintk (RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n",cmd); | 896 | default: |
897 | rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd); | ||
941 | } | 898 | } |
942 | /* | 899 | /* |
943 | ** T_OUTPUT returns without passing through this point! | 900 | ** T_OUTPUT returns without passing through this point! |
944 | */ | 901 | */ |
945 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n");*/ | 902 | /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */ |
946 | return(0); | 903 | return (0); |
947 | } | 904 | } |
948 | #endif | 905 | #endif |
diff --git a/drivers/char/rio/rioioctl.h b/drivers/char/rio/rioioctl.h index c3d679733c9a..14b83fae75c8 100644 --- a/drivers/char/rio/rioioctl.h +++ b/drivers/char/rio/rioioctl.h | |||
@@ -42,14 +42,14 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2"; | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | struct portStats { | 44 | struct portStats { |
45 | int port; | 45 | int port; |
46 | int gather; | 46 | int gather; |
47 | ulong txchars; | 47 | ulong txchars; |
48 | ulong rxchars; | 48 | ulong rxchars; |
49 | ulong opens; | 49 | ulong opens; |
50 | ulong closes; | 50 | ulong closes; |
51 | ulong ioctls; | 51 | ulong ioctls; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | 54 | ||
55 | #define rIOC ('r'<<8) | 55 | #define rIOC ('r'<<8) |
@@ -100,4 +100,4 @@ struct portStats { | |||
100 | #define RIO_RESET_PORT_STATS (RIOC | 194) | 100 | #define RIO_RESET_PORT_STATS (RIOC | 194) |
101 | #define RIO_GET_PORT_STATS (RIOC | 195) | 101 | #define RIO_GET_PORT_STATS (RIOC | 195) |
102 | 102 | ||
103 | #endif /* __rioioctl_h__ */ | 103 | #endif /* __rioioctl_h__ */ |
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index f10916326ecc..4cc7f4942bfc 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c | |||
@@ -157,46 +157,44 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; | |||
157 | ** NB. for MPX | 157 | ** NB. for MPX |
158 | ** tty lock must NOT have been previously acquired. | 158 | ** tty lock must NOT have been previously acquired. |
159 | */ | 159 | */ |
160 | int | 160 | int RIOParam(PortP, cmd, Modem, SleepFlag) |
161 | RIOParam(PortP, cmd, Modem, SleepFlag) | ||
162 | struct Port *PortP; | 161 | struct Port *PortP; |
163 | int cmd; | 162 | int cmd; |
164 | int Modem; | 163 | int Modem; |
165 | int SleepFlag; | 164 | int SleepFlag; |
166 | { | 165 | { |
167 | register struct tty_struct *TtyP; | 166 | register struct tty_struct *TtyP; |
168 | int retval; | 167 | int retval; |
169 | register struct phb_param *phb_param_ptr; | 168 | register struct phb_param *phb_param_ptr; |
170 | PKT *PacketP; | 169 | PKT *PacketP; |
171 | int res; | 170 | int res; |
172 | uchar Cor1=0, Cor2=0, Cor4=0, Cor5=0; | 171 | uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; |
173 | uchar TxXon=0, TxXoff=0, RxXon=0, RxXoff=0; | 172 | uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; |
174 | uchar LNext=0, TxBaud=0, RxBaud=0; | 173 | uchar LNext = 0, TxBaud = 0, RxBaud = 0; |
175 | int retries = 0xff; | 174 | int retries = 0xff; |
176 | unsigned long flags; | 175 | unsigned long flags; |
177 | 176 | ||
178 | func_enter (); | 177 | func_enter(); |
179 | 178 | ||
180 | TtyP = PortP->gs.tty; | 179 | TtyP = PortP->gs.tty; |
181 | 180 | ||
182 | rio_dprintk (RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", | 181 | rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); |
183 | PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); | ||
184 | 182 | ||
185 | if (!TtyP) { | 183 | if (!TtyP) { |
186 | rio_dprintk (RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); | 184 | rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); |
187 | 185 | ||
188 | func_exit (); | 186 | func_exit(); |
189 | 187 | ||
190 | return RIO_FAIL; | 188 | return RIO_FAIL; |
191 | } | 189 | } |
192 | rio_spin_lock_irqsave(&PortP->portSem, flags ); | 190 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
193 | 191 | ||
194 | if (cmd == OPEN) { | 192 | if (cmd == OPEN) { |
195 | /* | 193 | /* |
196 | ** If the port is set to store or lock the parameters, and it is | 194 | ** If the port is set to store or lock the parameters, and it is |
197 | ** paramed with OPEN, we want to restore the saved port termio, but | 195 | ** paramed with OPEN, we want to restore the saved port termio, but |
198 | ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. | 196 | ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot. |
199 | */ | 197 | */ |
200 | #if 0 | 198 | #if 0 |
201 | if (PortP->FirstOpen) { | 199 | if (PortP->FirstOpen) { |
202 | PortP->StoredTty.iflag = TtyP->tm.c_iflag; | 200 | PortP->StoredTty.iflag = TtyP->tm.c_iflag; |
@@ -207,9 +205,8 @@ int SleepFlag; | |||
207 | for (i = 0; i < NCC + 5; i++) | 205 | for (i = 0; i < NCC + 5; i++) |
208 | PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i]; | 206 | PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i]; |
209 | PortP->FirstOpen = 0; | 207 | PortP->FirstOpen = 0; |
210 | } | 208 | } else if (PortP->Store || PortP->Lock) { |
211 | else if (PortP->Store || PortP->Lock) { | 209 | rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n"); |
212 | rio_dprintk (RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n"); | ||
213 | TtyP->tm.c_iflag = PortP->StoredTty.iflag; | 210 | TtyP->tm.c_iflag = PortP->StoredTty.iflag; |
214 | TtyP->tm.c_oflag = PortP->StoredTty.oflag; | 211 | TtyP->tm.c_oflag = PortP->StoredTty.oflag; |
215 | TtyP->tm.c_cflag = PortP->StoredTty.cflag; | 212 | TtyP->tm.c_cflag = PortP->StoredTty.cflag; |
@@ -222,230 +219,222 @@ int SleepFlag; | |||
222 | } | 219 | } |
223 | 220 | ||
224 | /* | 221 | /* |
225 | ** wait for space | 222 | ** wait for space |
226 | */ | 223 | */ |
227 | while ( !(res=can_add_transmit(&PacketP,PortP)) || | 224 | while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) { |
228 | (PortP->InUse != NOT_INUSE) ) { | 225 | if (retries-- <= 0) { |
229 | if (retries -- <= 0) { | ||
230 | break; | 226 | break; |
231 | } | 227 | } |
232 | if ( PortP->InUse != NOT_INUSE ) { | 228 | if (PortP->InUse != NOT_INUSE) { |
233 | rio_dprintk (RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); | 229 | rio_dprintk(RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); |
234 | } | 230 | } |
235 | 231 | ||
236 | if ( !res ) { | 232 | if (!res) { |
237 | rio_dprintk (RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); | 233 | rio_dprintk(RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); |
238 | } | 234 | } |
239 | 235 | ||
240 | if ( SleepFlag != OK_TO_SLEEP ) { | 236 | if (SleepFlag != OK_TO_SLEEP) { |
241 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 237 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
242 | func_exit(); | 238 | func_exit(); |
243 | 239 | ||
244 | return RIO_FAIL; | 240 | return RIO_FAIL; |
245 | } | 241 | } |
246 | 242 | ||
247 | rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); | 243 | rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); |
248 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 244 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
249 | retval = RIODelay(PortP, HUNDRED_MS); | 245 | retval = RIODelay(PortP, HUNDRED_MS); |
250 | rio_spin_lock_irqsave( &PortP->portSem, flags); | 246 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
251 | if (retval == RIO_FAIL) { | 247 | if (retval == RIO_FAIL) { |
252 | rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); | 248 | rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); |
253 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 249 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
254 | pseterr(EINTR); | 250 | pseterr(EINTR); |
255 | func_exit(); | 251 | func_exit(); |
256 | 252 | ||
257 | return RIO_FAIL; | 253 | return RIO_FAIL; |
258 | } | 254 | } |
259 | if ( PortP->State & RIO_DELETED ) { | 255 | if (PortP->State & RIO_DELETED) { |
260 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 256 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
261 | func_exit (); | 257 | func_exit(); |
262 | 258 | ||
263 | return RIO_SUCCESS; | 259 | return RIO_SUCCESS; |
264 | } | 260 | } |
265 | } | 261 | } |
266 | 262 | ||
267 | if (!res) { | 263 | if (!res) { |
268 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 264 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
269 | func_exit (); | 265 | func_exit(); |
270 | 266 | ||
271 | return RIO_FAIL; | 267 | return RIO_FAIL; |
272 | } | 268 | } |
273 | 269 | ||
274 | rio_dprintk (RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n",res); | 270 | rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); |
275 | rio_dprintk (RIO_DEBUG_PARAM, "Packet is 0x%x\n",(int) PacketP); | 271 | rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP); |
276 | 272 | ||
277 | phb_param_ptr = (struct phb_param *)PacketP->data; | 273 | phb_param_ptr = (struct phb_param *) PacketP->data; |
278 | 274 | ||
279 | 275 | ||
280 | #if 0 | 276 | #if 0 |
281 | /* | 277 | /* |
282 | ** COR 1 | 278 | ** COR 1 |
283 | */ | 279 | */ |
284 | if ( TtyP->tm.c_iflag & INPCK ) { | 280 | if (TtyP->tm.c_iflag & INPCK) { |
285 | rio_dprintk (RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); | 281 | rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); |
286 | Cor1 |= COR1_INPCK; | 282 | Cor1 |= COR1_INPCK; |
287 | } | 283 | } |
288 | #endif | 284 | #endif |
289 | 285 | ||
290 | switch ( TtyP->termios->c_cflag & CSIZE ) { | 286 | switch (TtyP->termios->c_cflag & CSIZE) { |
291 | case CS5: | 287 | case CS5: |
292 | { | 288 | { |
293 | rio_dprintk (RIO_DEBUG_PARAM, "5 bit data\n"); | 289 | rio_dprintk(RIO_DEBUG_PARAM, "5 bit data\n"); |
294 | Cor1 |= COR1_5BITS; | 290 | Cor1 |= COR1_5BITS; |
295 | break; | 291 | break; |
296 | } | 292 | } |
297 | case CS6: | 293 | case CS6: |
298 | { | 294 | { |
299 | rio_dprintk (RIO_DEBUG_PARAM, "6 bit data\n"); | 295 | rio_dprintk(RIO_DEBUG_PARAM, "6 bit data\n"); |
300 | Cor1 |= COR1_6BITS; | 296 | Cor1 |= COR1_6BITS; |
301 | break; | 297 | break; |
302 | } | 298 | } |
303 | case CS7: | 299 | case CS7: |
304 | { | 300 | { |
305 | rio_dprintk (RIO_DEBUG_PARAM, "7 bit data\n"); | 301 | rio_dprintk(RIO_DEBUG_PARAM, "7 bit data\n"); |
306 | Cor1 |= COR1_7BITS; | 302 | Cor1 |= COR1_7BITS; |
307 | break; | 303 | break; |
308 | } | 304 | } |
309 | case CS8: | 305 | case CS8: |
310 | { | 306 | { |
311 | rio_dprintk (RIO_DEBUG_PARAM, "8 bit data\n"); | 307 | rio_dprintk(RIO_DEBUG_PARAM, "8 bit data\n"); |
312 | Cor1 |= COR1_8BITS; | 308 | Cor1 |= COR1_8BITS; |
313 | break; | 309 | break; |
314 | } | 310 | } |
315 | } | 311 | } |
316 | 312 | ||
317 | if ( TtyP->termios->c_cflag & CSTOPB ) { | 313 | if (TtyP->termios->c_cflag & CSTOPB) { |
318 | rio_dprintk (RIO_DEBUG_PARAM, "2 stop bits\n"); | 314 | rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n"); |
319 | Cor1 |= COR1_2STOP; | 315 | Cor1 |= COR1_2STOP; |
320 | } | 316 | } else { |
321 | else { | 317 | rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n"); |
322 | rio_dprintk (RIO_DEBUG_PARAM, "1 stop bit\n"); | ||
323 | Cor1 |= COR1_1STOP; | 318 | Cor1 |= COR1_1STOP; |
324 | } | 319 | } |
325 | 320 | ||
326 | if ( TtyP->termios->c_cflag & PARENB ) { | 321 | if (TtyP->termios->c_cflag & PARENB) { |
327 | rio_dprintk (RIO_DEBUG_PARAM, "Enable parity\n"); | 322 | rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n"); |
328 | Cor1 |= COR1_NORMAL; | 323 | Cor1 |= COR1_NORMAL; |
329 | } | 324 | } else { |
330 | else { | 325 | rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n"); |
331 | rio_dprintk (RIO_DEBUG_PARAM, "Disable parity\n"); | ||
332 | Cor1 |= COR1_NOP; | 326 | Cor1 |= COR1_NOP; |
333 | } | 327 | } |
334 | if ( TtyP->termios->c_cflag & PARODD ) { | 328 | if (TtyP->termios->c_cflag & PARODD) { |
335 | rio_dprintk (RIO_DEBUG_PARAM, "Odd parity\n"); | 329 | rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n"); |
336 | Cor1 |= COR1_ODD; | 330 | Cor1 |= COR1_ODD; |
337 | } | 331 | } else { |
338 | else { | 332 | rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n"); |
339 | rio_dprintk (RIO_DEBUG_PARAM, "Even parity\n"); | 333 | Cor1 |= COR1_EVEN; |
340 | Cor1 |= COR1_EVEN; | ||
341 | } | 334 | } |
342 | 335 | ||
343 | /* | 336 | /* |
344 | ** COR 2 | 337 | ** COR 2 |
345 | */ | 338 | */ |
346 | if ( TtyP->termios->c_iflag & IXON ) { | 339 | if (TtyP->termios->c_iflag & IXON) { |
347 | rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop output control\n"); | 340 | rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n"); |
348 | Cor2 |= COR2_IXON; | 341 | Cor2 |= COR2_IXON; |
349 | } | 342 | } else { |
350 | else { | 343 | if (PortP->Config & RIO_IXON) { |
351 | if ( PortP->Config & RIO_IXON ) { | 344 | rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n"); |
352 | rio_dprintk (RIO_DEBUG_PARAM, "Force enable start/stop output control\n"); | ||
353 | Cor2 |= COR2_IXON; | 345 | Cor2 |= COR2_IXON; |
354 | } | 346 | } else |
355 | else | 347 | rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n"); |
356 | rio_dprintk (RIO_DEBUG_PARAM, "IXON has been disabled.\n"); | ||
357 | } | 348 | } |
358 | 349 | ||
359 | if (TtyP->termios->c_iflag & IXANY) { | 350 | if (TtyP->termios->c_iflag & IXANY) { |
360 | if ( PortP->Config & RIO_IXANY ) { | 351 | if (PortP->Config & RIO_IXANY) { |
361 | rio_dprintk (RIO_DEBUG_PARAM, "Enable any key to restart output\n"); | 352 | rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n"); |
362 | Cor2 |= COR2_IXANY; | 353 | Cor2 |= COR2_IXANY; |
363 | } | 354 | } else |
364 | else | 355 | rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n"); |
365 | rio_dprintk (RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n"); | ||
366 | } | 356 | } |
367 | 357 | ||
368 | if ( TtyP->termios->c_iflag & IXOFF ) { | 358 | if (TtyP->termios->c_iflag & IXOFF) { |
369 | rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); | 359 | rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); |
370 | Cor2 |= COR2_IXOFF; | 360 | Cor2 |= COR2_IXOFF; |
371 | } | 361 | } |
372 | 362 | ||
373 | if ( TtyP->termios->c_cflag & HUPCL ) { | 363 | if (TtyP->termios->c_cflag & HUPCL) { |
374 | rio_dprintk (RIO_DEBUG_PARAM, "Hangup on last close\n"); | 364 | rio_dprintk(RIO_DEBUG_PARAM, "Hangup on last close\n"); |
375 | Cor2 |= COR2_HUPCL; | 365 | Cor2 |= COR2_HUPCL; |
376 | } | 366 | } |
377 | 367 | ||
378 | if ( C_CRTSCTS (TtyP)) { | 368 | if (C_CRTSCTS(TtyP)) { |
379 | rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); | 369 | rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); |
380 | Cor2 |= COR2_CTSFLOW; | 370 | Cor2 |= COR2_CTSFLOW; |
381 | Cor2 |= COR2_RTSFLOW; | 371 | Cor2 |= COR2_RTSFLOW; |
382 | } else { | 372 | } else { |
383 | rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); | 373 | rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); |
384 | Cor2 &= ~COR2_CTSFLOW; | 374 | Cor2 &= ~COR2_CTSFLOW; |
385 | Cor2 &= ~COR2_RTSFLOW; | 375 | Cor2 &= ~COR2_RTSFLOW; |
386 | } | 376 | } |
387 | 377 | ||
388 | 378 | ||
389 | if ( TtyP->termios->c_cflag & CLOCAL ) { | 379 | if (TtyP->termios->c_cflag & CLOCAL) { |
390 | rio_dprintk (RIO_DEBUG_PARAM, "Local line\n"); | 380 | rio_dprintk(RIO_DEBUG_PARAM, "Local line\n"); |
391 | } | 381 | } else { |
392 | else { | 382 | rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n"); |
393 | rio_dprintk (RIO_DEBUG_PARAM, "Possible Modem line\n"); | ||
394 | } | 383 | } |
395 | 384 | ||
396 | /* | 385 | /* |
397 | ** COR 4 (there is no COR 3) | 386 | ** COR 4 (there is no COR 3) |
398 | */ | 387 | */ |
399 | if ( TtyP->termios->c_iflag & IGNBRK ) { | 388 | if (TtyP->termios->c_iflag & IGNBRK) { |
400 | rio_dprintk (RIO_DEBUG_PARAM, "Ignore break condition\n"); | 389 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore break condition\n"); |
401 | Cor4 |= COR4_IGNBRK; | 390 | Cor4 |= COR4_IGNBRK; |
402 | } | 391 | } |
403 | if ( !(TtyP->termios->c_iflag & BRKINT) ) { | 392 | if (!(TtyP->termios->c_iflag & BRKINT)) { |
404 | rio_dprintk (RIO_DEBUG_PARAM, "Break generates NULL condition\n"); | 393 | rio_dprintk(RIO_DEBUG_PARAM, "Break generates NULL condition\n"); |
405 | Cor4 |= COR4_NBRKINT; | 394 | Cor4 |= COR4_NBRKINT; |
406 | } else { | 395 | } else { |
407 | rio_dprintk (RIO_DEBUG_PARAM, "Interrupt on break condition\n"); | 396 | rio_dprintk(RIO_DEBUG_PARAM, "Interrupt on break condition\n"); |
408 | } | 397 | } |
409 | 398 | ||
410 | if ( TtyP->termios->c_iflag & INLCR ) { | 399 | if (TtyP->termios->c_iflag & INLCR) { |
411 | rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); | 400 | rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); |
412 | Cor4 |= COR4_INLCR; | 401 | Cor4 |= COR4_INLCR; |
413 | } | 402 | } |
414 | 403 | ||
415 | if ( TtyP->termios->c_iflag & IGNCR ) { | 404 | if (TtyP->termios->c_iflag & IGNCR) { |
416 | rio_dprintk (RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); | 405 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); |
417 | Cor4 |= COR4_IGNCR; | 406 | Cor4 |= COR4_IGNCR; |
418 | } | 407 | } |
419 | 408 | ||
420 | if ( TtyP->termios->c_iflag & ICRNL ) { | 409 | if (TtyP->termios->c_iflag & ICRNL) { |
421 | rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); | 410 | rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); |
422 | Cor4 |= COR4_ICRNL; | 411 | Cor4 |= COR4_ICRNL; |
423 | } | 412 | } |
424 | if ( TtyP->termios->c_iflag & IGNPAR ) { | 413 | if (TtyP->termios->c_iflag & IGNPAR) { |
425 | rio_dprintk (RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); | 414 | rio_dprintk(RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); |
426 | Cor4 |= COR4_IGNPAR; | 415 | Cor4 |= COR4_IGNPAR; |
427 | } | 416 | } |
428 | if ( TtyP->termios->c_iflag & PARMRK ) { | 417 | if (TtyP->termios->c_iflag & PARMRK) { |
429 | rio_dprintk (RIO_DEBUG_PARAM, "Mark parity errors\n"); | 418 | rio_dprintk(RIO_DEBUG_PARAM, "Mark parity errors\n"); |
430 | Cor4 |= COR4_PARMRK; | 419 | Cor4 |= COR4_PARMRK; |
431 | } | 420 | } |
432 | 421 | ||
433 | /* | 422 | /* |
434 | ** Set the RAISEMOD flag to ensure that the modem lines are raised | 423 | ** Set the RAISEMOD flag to ensure that the modem lines are raised |
435 | ** on reception of a config packet. | 424 | ** on reception of a config packet. |
436 | ** The download code handles the zero baud condition. | 425 | ** The download code handles the zero baud condition. |
437 | */ | 426 | */ |
438 | Cor4 |= COR4_RAISEMOD; | 427 | Cor4 |= COR4_RAISEMOD; |
439 | 428 | ||
440 | /* | 429 | /* |
441 | ** COR 5 | 430 | ** COR 5 |
442 | */ | 431 | */ |
443 | 432 | ||
444 | Cor5 = COR5_CMOE; | 433 | Cor5 = COR5_CMOE; |
445 | 434 | ||
446 | /* | 435 | /* |
447 | ** Set to monitor tbusy/tstop (or not). | 436 | ** Set to monitor tbusy/tstop (or not). |
448 | */ | 437 | */ |
449 | 438 | ||
450 | if (PortP->MonitorTstate) | 439 | if (PortP->MonitorTstate) |
451 | Cor5 |= COR5_TSTATE_ON; | 440 | Cor5 |= COR5_TSTATE_ON; |
@@ -453,182 +442,195 @@ int SleepFlag; | |||
453 | Cor5 |= COR5_TSTATE_OFF; | 442 | Cor5 |= COR5_TSTATE_OFF; |
454 | 443 | ||
455 | /* | 444 | /* |
456 | ** Could set LNE here if you wanted LNext processing. SVR4 will use it. | 445 | ** Could set LNE here if you wanted LNext processing. SVR4 will use it. |
457 | */ | 446 | */ |
458 | if ( TtyP->termios->c_iflag & ISTRIP ) { | 447 | if (TtyP->termios->c_iflag & ISTRIP) { |
459 | rio_dprintk (RIO_DEBUG_PARAM, "Strip input characters\n"); | 448 | rio_dprintk(RIO_DEBUG_PARAM, "Strip input characters\n"); |
460 | if (! (PortP->State & RIO_TRIAD_MODE)) { | 449 | if (!(PortP->State & RIO_TRIAD_MODE)) { |
461 | Cor5 |= COR5_ISTRIP; | 450 | Cor5 |= COR5_ISTRIP; |
462 | } | 451 | } |
463 | } | 452 | } |
464 | 453 | ||
465 | if ( TtyP->termios->c_oflag & ONLCR ) { | 454 | if (TtyP->termios->c_oflag & ONLCR) { |
466 | rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); | 455 | rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); |
467 | if ( PortP->CookMode == COOK_MEDIUM ) | 456 | if (PortP->CookMode == COOK_MEDIUM) |
468 | Cor5 |= COR5_ONLCR; | 457 | Cor5 |= COR5_ONLCR; |
469 | } | 458 | } |
470 | if ( TtyP->termios->c_oflag & OCRNL ) { | 459 | if (TtyP->termios->c_oflag & OCRNL) { |
471 | rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); | 460 | rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); |
472 | if ( PortP->CookMode == COOK_MEDIUM ) | 461 | if (PortP->CookMode == COOK_MEDIUM) |
473 | Cor5 |= COR5_OCRNL; | 462 | Cor5 |= COR5_OCRNL; |
474 | } | 463 | } |
475 | if ( ( TtyP->termios->c_oflag & TABDLY) == TAB3 ) { | 464 | if ((TtyP->termios->c_oflag & TABDLY) == TAB3) { |
476 | rio_dprintk (RIO_DEBUG_PARAM, "Tab delay 3 set\n"); | 465 | rio_dprintk(RIO_DEBUG_PARAM, "Tab delay 3 set\n"); |
477 | if ( PortP->CookMode == COOK_MEDIUM ) | 466 | if (PortP->CookMode == COOK_MEDIUM) |
478 | Cor5 |= COR5_TAB3; | 467 | Cor5 |= COR5_TAB3; |
479 | } | 468 | } |
480 | 469 | ||
481 | /* | 470 | /* |
482 | ** Flow control bytes. | 471 | ** Flow control bytes. |
483 | */ | 472 | */ |
484 | TxXon = TtyP->termios->c_cc[VSTART]; | 473 | TxXon = TtyP->termios->c_cc[VSTART]; |
485 | TxXoff = TtyP->termios->c_cc[VSTOP]; | 474 | TxXoff = TtyP->termios->c_cc[VSTOP]; |
486 | RxXon = TtyP->termios->c_cc[VSTART]; | 475 | RxXon = TtyP->termios->c_cc[VSTART]; |
487 | RxXoff = TtyP->termios->c_cc[VSTOP]; | 476 | RxXoff = TtyP->termios->c_cc[VSTOP]; |
488 | /* | 477 | /* |
489 | ** LNEXT byte | 478 | ** LNEXT byte |
490 | */ | 479 | */ |
491 | LNext = 0; | 480 | LNext = 0; |
492 | 481 | ||
493 | /* | 482 | /* |
494 | ** Baud rate bytes | 483 | ** Baud rate bytes |
495 | */ | 484 | */ |
496 | rio_dprintk (RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", | 485 | rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD); |
497 | TtyP->termios->c_cflag, CBAUD); | ||
498 | 486 | ||
499 | switch (TtyP->termios->c_cflag & CBAUD) { | 487 | switch (TtyP->termios->c_cflag & CBAUD) { |
500 | #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break | 488 | #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break |
501 | e(50);e(75);e(110);e(134);e(150);e(200);e(300);e(600);e(1200); | 489 | e(50); |
502 | e(1800);e(2400);e(4800);e(9600);e(19200);e(38400);e(57600); | 490 | e(75); |
503 | e(115200); /* e(230400);e(460800); e(921600); */ | 491 | e(110); |
492 | e(134); | ||
493 | e(150); | ||
494 | e(200); | ||
495 | e(300); | ||
496 | e(600); | ||
497 | e(1200); | ||
498 | e(1800); | ||
499 | e(2400); | ||
500 | e(4800); | ||
501 | e(9600); | ||
502 | e(19200); | ||
503 | e(38400); | ||
504 | e(57600); | ||
505 | e(115200); /* e(230400);e(460800); e(921600); */ | ||
504 | } | 506 | } |
505 | 507 | ||
506 | /* XXX MIssing conversion table. XXX */ | 508 | /* XXX MIssing conversion table. XXX */ |
507 | /* (TtyP->termios->c_cflag & V_CBAUD); */ | 509 | /* (TtyP->termios->c_cflag & V_CBAUD); */ |
508 | 510 | ||
509 | rio_dprintk (RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); | 511 | rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); |
510 | 512 | ||
511 | 513 | ||
512 | /* | 514 | /* |
513 | ** Leftovers | 515 | ** Leftovers |
514 | */ | 516 | */ |
515 | if ( TtyP->termios->c_cflag & CREAD ) | 517 | if (TtyP->termios->c_cflag & CREAD) |
516 | rio_dprintk (RIO_DEBUG_PARAM, "Enable receiver\n"); | 518 | rio_dprintk(RIO_DEBUG_PARAM, "Enable receiver\n"); |
517 | #ifdef RCV1EN | 519 | #ifdef RCV1EN |
518 | if ( TtyP->termios->c_cflag & RCV1EN ) | 520 | if (TtyP->termios->c_cflag & RCV1EN) |
519 | rio_dprintk (RIO_DEBUG_PARAM, "RCV1EN (?)\n"); | 521 | rio_dprintk(RIO_DEBUG_PARAM, "RCV1EN (?)\n"); |
520 | #endif | 522 | #endif |
521 | #ifdef XMT1EN | 523 | #ifdef XMT1EN |
522 | if ( TtyP->termios->c_cflag & XMT1EN ) | 524 | if (TtyP->termios->c_cflag & XMT1EN) |
523 | rio_dprintk (RIO_DEBUG_PARAM, "XMT1EN (?)\n"); | 525 | rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n"); |
524 | #endif | 526 | #endif |
525 | #if 0 | 527 | #if 0 |
526 | if ( TtyP->termios->c_cflag & LOBLK ) | 528 | if (TtyP->termios->c_cflag & LOBLK) |
527 | rio_dprintk (RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); | 529 | rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); |
528 | #endif | 530 | #endif |
529 | if ( TtyP->termios->c_lflag & ISIG ) | 531 | if (TtyP->termios->c_lflag & ISIG) |
530 | rio_dprintk (RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); | 532 | rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); |
531 | if ( TtyP->termios->c_lflag & ICANON ) | 533 | if (TtyP->termios->c_lflag & ICANON) |
532 | rio_dprintk (RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); | 534 | rio_dprintk(RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); |
533 | if ( TtyP->termios->c_lflag & XCASE ) | 535 | if (TtyP->termios->c_lflag & XCASE) |
534 | rio_dprintk (RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); | 536 | rio_dprintk(RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); |
535 | if ( TtyP->termios->c_lflag & ECHO ) | 537 | if (TtyP->termios->c_lflag & ECHO) |
536 | rio_dprintk (RIO_DEBUG_PARAM, "Enable input echo\n"); | 538 | rio_dprintk(RIO_DEBUG_PARAM, "Enable input echo\n"); |
537 | if ( TtyP->termios->c_lflag & ECHOE ) | 539 | if (TtyP->termios->c_lflag & ECHOE) |
538 | rio_dprintk (RIO_DEBUG_PARAM, "Enable echo erase\n"); | 540 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo erase\n"); |
539 | if ( TtyP->termios->c_lflag & ECHOK ) | 541 | if (TtyP->termios->c_lflag & ECHOK) |
540 | rio_dprintk (RIO_DEBUG_PARAM, "Enable echo kill\n"); | 542 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo kill\n"); |
541 | if ( TtyP->termios->c_lflag & ECHONL ) | 543 | if (TtyP->termios->c_lflag & ECHONL) |
542 | rio_dprintk (RIO_DEBUG_PARAM, "Enable echo newline\n"); | 544 | rio_dprintk(RIO_DEBUG_PARAM, "Enable echo newline\n"); |
543 | if ( TtyP->termios->c_lflag & NOFLSH ) | 545 | if (TtyP->termios->c_lflag & NOFLSH) |
544 | rio_dprintk (RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); | 546 | rio_dprintk(RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); |
545 | #ifdef TOSTOP | 547 | #ifdef TOSTOP |
546 | if ( TtyP->termios->c_lflag & TOSTOP ) | 548 | if (TtyP->termios->c_lflag & TOSTOP) |
547 | rio_dprintk (RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); | 549 | rio_dprintk(RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); |
548 | #endif | 550 | #endif |
549 | #ifdef XCLUDE | 551 | #ifdef XCLUDE |
550 | if ( TtyP->termios->c_lflag & XCLUDE ) | 552 | if (TtyP->termios->c_lflag & XCLUDE) |
551 | rio_dprintk (RIO_DEBUG_PARAM, "Exclusive use of this line\n"); | 553 | rio_dprintk(RIO_DEBUG_PARAM, "Exclusive use of this line\n"); |
552 | #endif | 554 | #endif |
553 | if ( TtyP->termios->c_iflag & IUCLC ) | 555 | if (TtyP->termios->c_iflag & IUCLC) |
554 | rio_dprintk (RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); | 556 | rio_dprintk(RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); |
555 | if ( TtyP->termios->c_oflag & OPOST ) | 557 | if (TtyP->termios->c_oflag & OPOST) |
556 | rio_dprintk (RIO_DEBUG_PARAM, "Enable output post-processing\n"); | 558 | rio_dprintk(RIO_DEBUG_PARAM, "Enable output post-processing\n"); |
557 | if ( TtyP->termios->c_oflag & OLCUC ) | 559 | if (TtyP->termios->c_oflag & OLCUC) |
558 | rio_dprintk (RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); | 560 | rio_dprintk(RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); |
559 | if ( TtyP->termios->c_oflag & ONOCR ) | 561 | if (TtyP->termios->c_oflag & ONOCR) |
560 | rio_dprintk (RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); | 562 | rio_dprintk(RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); |
561 | if ( TtyP->termios->c_oflag & ONLRET ) | 563 | if (TtyP->termios->c_oflag & ONLRET) |
562 | rio_dprintk (RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); | 564 | rio_dprintk(RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); |
563 | if ( TtyP->termios->c_oflag & OFILL ) | 565 | if (TtyP->termios->c_oflag & OFILL) |
564 | rio_dprintk (RIO_DEBUG_PARAM, "Use fill characters for delay\n"); | 566 | rio_dprintk(RIO_DEBUG_PARAM, "Use fill characters for delay\n"); |
565 | if ( TtyP->termios->c_oflag & OFDEL ) | 567 | if (TtyP->termios->c_oflag & OFDEL) |
566 | rio_dprintk (RIO_DEBUG_PARAM, "Fill character is DEL\n"); | 568 | rio_dprintk(RIO_DEBUG_PARAM, "Fill character is DEL\n"); |
567 | if ( TtyP->termios->c_oflag & NLDLY ) | 569 | if (TtyP->termios->c_oflag & NLDLY) |
568 | rio_dprintk (RIO_DEBUG_PARAM, "Newline delay set\n"); | 570 | rio_dprintk(RIO_DEBUG_PARAM, "Newline delay set\n"); |
569 | if ( TtyP->termios->c_oflag & CRDLY ) | 571 | if (TtyP->termios->c_oflag & CRDLY) |
570 | rio_dprintk (RIO_DEBUG_PARAM, "Carriage return delay set\n"); | 572 | rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n"); |
571 | if ( TtyP->termios->c_oflag & TABDLY ) | 573 | if (TtyP->termios->c_oflag & TABDLY) |
572 | rio_dprintk (RIO_DEBUG_PARAM, "Tab delay set\n"); | 574 | rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n"); |
573 | #if 0 | 575 | #if 0 |
574 | if ( TtyP->termios->c_oflag & BSDLY ) | 576 | if (TtyP->termios->c_oflag & BSDLY) |
575 | rio_dprintk (RIO_DEBUG_PARAM, "Back-space delay set\n"); | 577 | rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n"); |
576 | if ( TtyP->termios->c_oflag & VTDLY ) | 578 | if (TtyP->termios->c_oflag & VTDLY) |
577 | rio_dprintk (RIO_DEBUG_PARAM, "Vertical tab delay set\n"); | 579 | rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n"); |
578 | if ( TtyP->termios->c_oflag & FFDLY ) | 580 | if (TtyP->termios->c_oflag & FFDLY) |
579 | rio_dprintk (RIO_DEBUG_PARAM, "Form-feed delay set\n"); | 581 | rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n"); |
580 | #endif | 582 | #endif |
581 | /* | 583 | /* |
582 | ** These things are kind of useful in a later life! | 584 | ** These things are kind of useful in a later life! |
583 | */ | 585 | */ |
584 | PortP->Cor2Copy = Cor2; | 586 | PortP->Cor2Copy = Cor2; |
585 | 587 | ||
586 | if ( PortP->State & RIO_DELETED ) { | 588 | if (PortP->State & RIO_DELETED) { |
587 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 589 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
588 | func_exit (); | 590 | func_exit(); |
589 | 591 | ||
590 | return RIO_FAIL; | 592 | return RIO_FAIL; |
591 | } | 593 | } |
592 | 594 | ||
593 | /* | 595 | /* |
594 | ** Actually write the info into the packet to be sent | 596 | ** Actually write the info into the packet to be sent |
595 | */ | 597 | */ |
596 | WBYTE(phb_param_ptr->Cmd, cmd); | 598 | WBYTE(phb_param_ptr->Cmd, cmd); |
597 | WBYTE(phb_param_ptr->Cor1, Cor1); | 599 | WBYTE(phb_param_ptr->Cor1, Cor1); |
598 | WBYTE(phb_param_ptr->Cor2, Cor2); | 600 | WBYTE(phb_param_ptr->Cor2, Cor2); |
599 | WBYTE(phb_param_ptr->Cor4, Cor4); | 601 | WBYTE(phb_param_ptr->Cor4, Cor4); |
600 | WBYTE(phb_param_ptr->Cor5, Cor5); | 602 | WBYTE(phb_param_ptr->Cor5, Cor5); |
601 | WBYTE(phb_param_ptr->TxXon, TxXon); | 603 | WBYTE(phb_param_ptr->TxXon, TxXon); |
602 | WBYTE(phb_param_ptr->RxXon, RxXon); | 604 | WBYTE(phb_param_ptr->RxXon, RxXon); |
603 | WBYTE(phb_param_ptr->TxXoff, TxXoff); | 605 | WBYTE(phb_param_ptr->TxXoff, TxXoff); |
604 | WBYTE(phb_param_ptr->RxXoff, RxXoff); | 606 | WBYTE(phb_param_ptr->RxXoff, RxXoff); |
605 | WBYTE(phb_param_ptr->LNext, LNext); | 607 | WBYTE(phb_param_ptr->LNext, LNext); |
606 | WBYTE(phb_param_ptr->TxBaud, TxBaud); | 608 | WBYTE(phb_param_ptr->TxBaud, TxBaud); |
607 | WBYTE(phb_param_ptr->RxBaud, RxBaud); | 609 | WBYTE(phb_param_ptr->RxBaud, RxBaud); |
608 | 610 | ||
609 | /* | 611 | /* |
610 | ** Set the length/command field | 612 | ** Set the length/command field |
611 | */ | 613 | */ |
612 | WBYTE(PacketP->len , 12 | PKT_CMD_BIT); | 614 | WBYTE(PacketP->len, 12 | PKT_CMD_BIT); |
613 | 615 | ||
614 | /* | 616 | /* |
615 | ** The packet is formed - now, whack it off | 617 | ** The packet is formed - now, whack it off |
616 | ** to its final destination: | 618 | ** to its final destination: |
617 | */ | 619 | */ |
618 | add_transmit(PortP); | 620 | add_transmit(PortP); |
619 | /* | 621 | /* |
620 | ** Count characters transmitted for port statistics reporting | 622 | ** Count characters transmitted for port statistics reporting |
621 | */ | 623 | */ |
622 | if (PortP->statsGather) | 624 | if (PortP->statsGather) |
623 | PortP->txchars += 12; | 625 | PortP->txchars += 12; |
624 | 626 | ||
625 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 627 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
626 | 628 | ||
627 | rio_dprintk (RIO_DEBUG_PARAM, "add_transmit returned.\n"); | 629 | rio_dprintk(RIO_DEBUG_PARAM, "add_transmit returned.\n"); |
628 | /* | 630 | /* |
629 | ** job done. | 631 | ** job done. |
630 | */ | 632 | */ |
631 | func_exit (); | 633 | func_exit(); |
632 | 634 | ||
633 | return RIO_SUCCESS; | 635 | return RIO_SUCCESS; |
634 | } | 636 | } |
@@ -638,16 +640,15 @@ int SleepFlag; | |||
638 | ** We can add another packet to a transmit queue if the packet pointer pointed | 640 | ** We can add another packet to a transmit queue if the packet pointer pointed |
639 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. | 641 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. |
640 | */ | 642 | */ |
641 | int | 643 | int can_add_transmit(PktP, PortP) |
642 | can_add_transmit(PktP, PortP) | ||
643 | PKT **PktP; | 644 | PKT **PktP; |
644 | struct Port *PortP; | 645 | struct Port *PortP; |
645 | { | 646 | { |
646 | register PKT *tp; | 647 | register PKT *tp; |
647 | 648 | ||
648 | *PktP = tp = (PKT *)RIO_PTR(PortP->Caddr,RWORD(*PortP->TxAdd)); | 649 | *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd)); |
649 | 650 | ||
650 | return !((uint)tp & PKT_IN_USE); | 651 | return !((uint) tp & PKT_IN_USE); |
651 | } | 652 | } |
652 | 653 | ||
653 | /* | 654 | /* |
@@ -655,25 +656,22 @@ struct Port *PortP; | |||
655 | ** and then move the TxAdd pointer along one position to point to the next | 656 | ** and then move the TxAdd pointer along one position to point to the next |
656 | ** packet pointer. You must wrap the pointer from the end back to the start. | 657 | ** packet pointer. You must wrap the pointer from the end back to the start. |
657 | */ | 658 | */ |
658 | void | 659 | void add_transmit(PortP) |
659 | add_transmit(PortP) | 660 | struct Port *PortP; |
660 | struct Port *PortP; | ||
661 | { | 661 | { |
662 | if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { | 662 | if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { |
663 | rio_dprintk (RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); | 663 | rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); |
664 | } | 664 | } |
665 | WWORD( *(ushort *)PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); | 665 | WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); |
666 | PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : | 666 | PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1; |
667 | PortP->TxAdd + 1; | 667 | WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd)); |
668 | WWORD( PortP->PhbP->tx_add , RIO_OFF(PortP->Caddr,PortP->TxAdd) ); | ||
669 | } | 668 | } |
670 | 669 | ||
671 | /**************************************** | 670 | /**************************************** |
672 | * Put a packet onto the end of the | 671 | * Put a packet onto the end of the |
673 | * free list | 672 | * free list |
674 | ****************************************/ | 673 | ****************************************/ |
675 | void | 674 | void put_free_end(HostP, PktP) |
676 | put_free_end(HostP, PktP) | ||
677 | struct Host *HostP; | 675 | struct Host *HostP; |
678 | PKT *PktP; | 676 | PKT *PktP; |
679 | { | 677 | { |
@@ -688,24 +686,23 @@ PKT *PktP; | |||
688 | * | 686 | * |
689 | ************************************************/ | 687 | ************************************************/ |
690 | 688 | ||
691 | rio_dprintk (RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n",(int)PktP); | 689 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP); |
692 | 690 | ||
693 | if ((old_end=RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { | 691 | if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { |
694 | new_end = RIO_OFF(HostP->Caddr,PktP); | 692 | new_end = RIO_OFF(HostP->Caddr, PktP); |
695 | tmp_pointer = (FREE_LIST *)RIO_PTR(HostP->Caddr,old_end); | 693 | tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end); |
696 | WWORD(tmp_pointer->next , new_end ); | 694 | WWORD(tmp_pointer->next, new_end); |
697 | WWORD(((FREE_LIST *)PktP)->prev , old_end); | 695 | WWORD(((FREE_LIST *) PktP)->prev, old_end); |
698 | WWORD(((FREE_LIST *)PktP)->next , TPNULL); | 696 | WWORD(((FREE_LIST *) PktP)->next, TPNULL); |
699 | WWORD(HostP->ParmMapP->free_list_end, new_end); | 697 | WWORD(HostP->ParmMapP->free_list_end, new_end); |
700 | } | 698 | } else { /* First packet on the free list this should never happen! */ |
701 | else { /* First packet on the free list this should never happen! */ | 699 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); |
702 | rio_dprintk (RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); | 700 | WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP)); |
703 | WWORD(HostP->ParmMapP->free_list_end , RIO_OFF(HostP->Caddr,PktP)); | 701 | tmp_pointer = (FREE_LIST *) PktP; |
704 | tmp_pointer = (FREE_LIST *)PktP; | 702 | WWORD(tmp_pointer->prev, TPNULL); |
705 | WWORD(tmp_pointer->prev , TPNULL); | 703 | WWORD(tmp_pointer->next, TPNULL); |
706 | WWORD(tmp_pointer->next , TPNULL); | 704 | } |
707 | } | 705 | rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); |
708 | rio_dprintk (RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); | ||
709 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | 706 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); |
710 | } | 707 | } |
711 | 708 | ||
@@ -715,14 +712,12 @@ PKT *PktP; | |||
715 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, | 712 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, |
716 | ** then can_remove_receive() returns 0. | 713 | ** then can_remove_receive() returns 0. |
717 | */ | 714 | */ |
718 | int | 715 | int can_remove_receive(PktP, PortP) |
719 | can_remove_receive(PktP, PortP) | ||
720 | PKT **PktP; | 716 | PKT **PktP; |
721 | struct Port *PortP; | 717 | struct Port *PortP; |
722 | { | 718 | { |
723 | if ( RWORD(*PortP->RxRemove) & PKT_IN_USE) { | 719 | if (RWORD(*PortP->RxRemove) & PKT_IN_USE) { |
724 | *PktP = (PKT *)RIO_PTR(PortP->Caddr, | 720 | *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); |
725 | RWORD(*PortP->RxRemove) & ~PKT_IN_USE); | ||
726 | return 1; | 721 | return 1; |
727 | } | 722 | } |
728 | return 0; | 723 | return 0; |
@@ -733,12 +728,10 @@ struct Port *PortP; | |||
733 | ** and then bump the pointers. Once the pointers get to the end, they must | 728 | ** and then bump the pointers. Once the pointers get to the end, they must |
734 | ** be wrapped back to the start. | 729 | ** be wrapped back to the start. |
735 | */ | 730 | */ |
736 | void | 731 | void remove_receive(PortP) |
737 | remove_receive(PortP) | 732 | struct Port *PortP; |
738 | struct Port *PortP; | ||
739 | { | 733 | { |
740 | WWORD( *PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE ); | 734 | WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); |
741 | PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : | 735 | PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1; |
742 | PortP->RxRemove + 1; | 736 | WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove)); |
743 | WWORD( PortP->PhbP->rx_remove , RIO_OFF(PortP->Caddr, PortP->RxRemove) ); | ||
744 | } | 737 | } |
diff --git a/drivers/char/rio/riopcicopy.c b/drivers/char/rio/riopcicopy.c index 2ea99a60aa32..535afaa51ca5 100644 --- a/drivers/char/rio/riopcicopy.c +++ b/drivers/char/rio/riopcicopy.c | |||
@@ -1,8 +1,8 @@ | |||
1 | 1 | ||
2 | /* Yeah. We have copyright on this one. Sure. */ | 2 | /* Yeah. We have copyright on this one. Sure. */ |
3 | 3 | ||
4 | void rio_pcicopy( char *from, char *to, int amount) | 4 | void rio_pcicopy(char *from, char *to, int amount) |
5 | { | 5 | { |
6 | while ( amount-- ) | 6 | while (amount--) |
7 | *to++ = *from++; | 7 | *to++ = *from++; |
8 | } | 8 | } |
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index e9564c9fb37c..0f4cd33ba641 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c | |||
@@ -93,625 +93,517 @@ static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, | |||
93 | ** Incoming on the ROUTE_RUP | 93 | ** Incoming on the ROUTE_RUP |
94 | ** I wrote this while I was tired. Forgive me. | 94 | ** I wrote this while I was tired. Forgive me. |
95 | */ | 95 | */ |
96 | int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ) | 96 | int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) |
97 | { | 97 | { |
98 | struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; | 98 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; |
99 | struct PktCmd_M *PktReplyP; | 99 | struct PktCmd_M *PktReplyP; |
100 | struct CmdBlk *CmdBlkP; | 100 | struct CmdBlk *CmdBlkP; |
101 | struct Port *PortP; | 101 | struct Port *PortP; |
102 | struct Map *MapP; | 102 | struct Map *MapP; |
103 | struct Top *TopP; | 103 | struct Top *TopP; |
104 | int ThisLink, ThisLinkMin, ThisLinkMax; | 104 | int ThisLink, ThisLinkMin, ThisLinkMax; |
105 | int port; | 105 | int port; |
106 | int Mod, Mod1, Mod2; | 106 | int Mod, Mod1, Mod2; |
107 | ushort RtaType; | 107 | ushort RtaType; |
108 | uint RtaUniq; | 108 | uint RtaUniq; |
109 | uint ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ | 109 | uint ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ |
110 | uint OldUnit, NewUnit, OldLink, NewLink; | 110 | uint OldUnit, NewUnit, OldLink, NewLink; |
111 | char *MyType, *MyName; | 111 | char *MyType, *MyName; |
112 | int Lies; | 112 | int Lies; |
113 | unsigned long flags; | 113 | unsigned long flags; |
114 | 114 | ||
115 | #ifdef STACK | 115 | #ifdef STACK |
116 | RIOStackCheck("RIORouteRup"); | 116 | RIOStackCheck("RIORouteRup"); |
117 | #endif | 117 | #endif |
118 | #ifdef CHECK | 118 | #ifdef CHECK |
119 | CheckPacketP(PacketP); | 119 | CheckPacketP(PacketP); |
120 | CheckHostP(HostP); | 120 | CheckHostP(HostP); |
121 | CheckRup(Rup); | 121 | CheckRup(Rup); |
122 | CheckHost(Host); | 122 | CheckHost(Host); |
123 | #endif | 123 | #endif |
124 | /* | ||
125 | ** Is this unit telling us it's current link topology? | ||
126 | */ | ||
127 | if ( RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY ) | ||
128 | { | ||
129 | MapP = HostP->Mapping; | ||
130 | |||
131 | /* | ||
132 | ** The packet can be sent either by the host or by an RTA. | ||
133 | ** If it comes from the host, then we need to fill in the | ||
134 | ** Topology array in the host structure. If it came in | ||
135 | ** from an RTA then we need to fill in the Mapping structure's | ||
136 | ** Topology array for the unit. | ||
137 | */ | ||
138 | if ( Rup >= (ushort)MAX_RUP ) | ||
139 | { | ||
140 | ThisUnit = HOST_ID; | ||
141 | TopP = HostP->Topology; | ||
142 | MyType = "Host"; | ||
143 | MyName = HostP->Name; | ||
144 | ThisLinkMin = ThisLinkMax = Rup - MAX_RUP; | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | ThisUnit = Rup+1; | ||
149 | TopP = HostP->Mapping[Rup].Topology; | ||
150 | MyType = "RTA"; | ||
151 | MyName = HostP->Mapping[Rup].Name; | ||
152 | ThisLinkMin = 0; | ||
153 | ThisLinkMax = LINKS_PER_UNIT - 1; | ||
154 | } | ||
155 | |||
156 | /* | ||
157 | ** Lies will not be tolerated. | ||
158 | ** If any pair of links claim to be connected to the same | ||
159 | ** place, then ignore this packet completely. | ||
160 | */ | ||
161 | Lies = 0; | ||
162 | for ( ThisLink=ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) | ||
163 | { | ||
164 | /* | ||
165 | ** it won't lie about network interconnect, total disconnects | ||
166 | ** and no-IDs. (or at least, it doesn't *matter* if it does) | ||
167 | */ | ||
168 | if ( RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort)MAX_RUP ) | ||
169 | continue; | ||
170 | |||
171 | for ( NewLink=ThisLinkMin; NewLink < ThisLink; NewLink++ ) | ||
172 | { | ||
173 | if ( (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == | ||
174 | RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && | ||
175 | (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == | ||
176 | RBYTE(PktCmdP->RouteTopology[NewLink].Link)) ) | ||
177 | { | ||
178 | Lies++; | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | if ( Lies ) | ||
184 | { | ||
185 | rio_dprintk (RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n",Lies); | ||
186 | rio_dprintk (RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", | ||
187 | RBYTE(PktCmdP->RouteTopology[0].Unit), | ||
188 | 'A'+RBYTE(PktCmdP->RouteTopology[0].Link), | ||
189 | RBYTE(PktCmdP->RouteTopology[1].Unit), | ||
190 | 'A'+RBYTE(PktCmdP->RouteTopology[1].Link), | ||
191 | RBYTE(PktCmdP->RouteTopology[2].Unit), | ||
192 | 'A'+RBYTE(PktCmdP->RouteTopology[2].Link), | ||
193 | RBYTE(PktCmdP->RouteTopology[3].Unit), | ||
194 | 'A'+RBYTE(PktCmdP->RouteTopology[3].Link)); | ||
195 | return TRUE; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | ** now, process each link. | ||
200 | */ | ||
201 | for ( ThisLink=ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) | ||
202 | { | ||
203 | /* | ||
204 | ** this is what it was connected to | ||
205 | */ | ||
206 | OldUnit = TopP[ThisLink].Unit; | ||
207 | OldLink = TopP[ThisLink].Link; | ||
208 | |||
209 | /* | ||
210 | ** this is what it is now connected to | ||
211 | */ | ||
212 | NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); | ||
213 | NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); | ||
214 | |||
215 | if ( OldUnit != NewUnit || OldLink != NewLink ) | ||
216 | { | ||
217 | /* | 124 | /* |
218 | ** something has changed! | 125 | ** Is this unit telling us it's current link topology? |
219 | */ | 126 | */ |
220 | 127 | if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) { | |
221 | if ( NewUnit > MAX_RUP && | 128 | MapP = HostP->Mapping; |
222 | NewUnit != ROUTE_DISCONNECT && | 129 | |
223 | NewUnit != ROUTE_NO_ID && | 130 | /* |
224 | NewUnit != ROUTE_INTERCONNECT ) | 131 | ** The packet can be sent either by the host or by an RTA. |
225 | { | 132 | ** If it comes from the host, then we need to fill in the |
226 | rio_dprintk (RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", | 133 | ** Topology array in the host structure. If it came in |
227 | MyType, | 134 | ** from an RTA then we need to fill in the Mapping structure's |
228 | MyName, | 135 | ** Topology array for the unit. |
229 | NewUnit, | 136 | */ |
230 | NewLink); | 137 | if (Rup >= (ushort) MAX_RUP) { |
231 | } | 138 | ThisUnit = HOST_ID; |
232 | else | 139 | TopP = HostP->Topology; |
233 | { | 140 | MyType = "Host"; |
234 | /* | 141 | MyName = HostP->Name; |
235 | ** put the new values in | 142 | ThisLinkMin = ThisLinkMax = Rup - MAX_RUP; |
236 | */ | 143 | } else { |
237 | TopP[ThisLink].Unit = NewUnit; | 144 | ThisUnit = Rup + 1; |
238 | TopP[ThisLink].Link = NewLink; | 145 | TopP = HostP->Mapping[Rup].Topology; |
239 | 146 | MyType = "RTA"; | |
240 | RIOSetChange(p); | 147 | MyName = HostP->Mapping[Rup].Name; |
241 | 148 | ThisLinkMin = 0; | |
242 | if ( OldUnit <= MAX_RUP ) | 149 | ThisLinkMax = LINKS_PER_UNIT - 1; |
243 | { | 150 | } |
244 | /* | 151 | |
245 | ** If something has become bust, then re-enable them messages | 152 | /* |
246 | */ | 153 | ** Lies will not be tolerated. |
247 | if (! p->RIONoMessage) | 154 | ** If any pair of links claim to be connected to the same |
248 | RIOConCon(p,HostP,ThisUnit,ThisLink,OldUnit,OldLink,DISCONNECT); | 155 | ** place, then ignore this packet completely. |
249 | } | 156 | */ |
250 | 157 | Lies = 0; | |
251 | if ( ( NewUnit <= MAX_RUP ) && !p->RIONoMessage ) | 158 | for (ThisLink = ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) { |
252 | RIOConCon(p,HostP,ThisUnit,ThisLink,NewUnit,NewLink,CONNECT); | 159 | /* |
253 | 160 | ** it won't lie about network interconnect, total disconnects | |
254 | if ( NewUnit == ROUTE_NO_ID ) | 161 | ** and no-IDs. (or at least, it doesn't *matter* if it does) |
255 | rio_dprintk (RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", | 162 | */ |
256 | MyType,MyName,'A'+ThisLink); | 163 | if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP) |
257 | 164 | continue; | |
258 | if ( NewUnit == ROUTE_INTERCONNECT ) | 165 | |
259 | { | 166 | for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) { |
260 | if (! p->RIONoMessage) | 167 | if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) { |
261 | cprintf("%s '%s' (%c) is connected to another network.\n", MyType,MyName,'A'+ThisLink); | 168 | Lies++; |
262 | } | 169 | } |
263 | 170 | } | |
264 | /* | 171 | } |
265 | ** perform an update for 'the other end', so that these messages | 172 | |
266 | ** only appears once. Only disconnect the other end if it is pointing | 173 | if (Lies) { |
267 | ** at us! | 174 | rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies); |
268 | */ | 175 | rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", |
269 | if ( OldUnit == HOST_ID ) | 176 | RBYTE(PktCmdP->RouteTopology[0].Unit), |
270 | { | 177 | 'A' + RBYTE(PktCmdP->RouteTopology[0].Link), |
271 | if ( HostP->Topology[OldLink].Unit == ThisUnit && | 178 | RBYTE(PktCmdP->RouteTopology[1].Unit), |
272 | HostP->Topology[OldLink].Link == ThisLink ) | 179 | 'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link)); |
273 | { | 180 | return TRUE; |
274 | rio_dprintk (RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink+'A'); | 181 | } |
275 | HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; | 182 | |
276 | HostP->Topology[OldLink].Link = NO_LINK; | 183 | /* |
277 | } | 184 | ** now, process each link. |
278 | else | 185 | */ |
279 | { | 186 | for (ThisLink = ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) { |
280 | rio_dprintk (RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", | 187 | /* |
281 | OldLink+'A',HostP->Mapping[ThisUnit-1].Name,ThisLink+'A'); | 188 | ** this is what it was connected to |
282 | } | 189 | */ |
283 | } | 190 | OldUnit = TopP[ThisLink].Unit; |
284 | else if ( OldUnit <= MAX_RUP ) | 191 | OldLink = TopP[ThisLink].Link; |
285 | { | 192 | |
286 | if ( HostP->Mapping[OldUnit-1].Topology[OldLink].Unit == ThisUnit && | 193 | /* |
287 | HostP->Mapping[OldUnit-1].Topology[OldLink].Link == ThisLink ) | 194 | ** this is what it is now connected to |
288 | { | 195 | */ |
289 | rio_dprintk (RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", | 196 | NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); |
290 | HostP->Mapping[OldUnit-1].Name,OldLink+'A'); | 197 | NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); |
291 | HostP->Mapping[OldUnit-1].Topology[OldLink].Unit=ROUTE_DISCONNECT; | 198 | |
292 | HostP->Mapping[OldUnit-1].Topology[OldLink].Link=NO_LINK; | 199 | if (OldUnit != NewUnit || OldLink != NewLink) { |
293 | } | 200 | /* |
294 | else | 201 | ** something has changed! |
295 | { | 202 | */ |
296 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", | 203 | |
297 | HostP->Mapping[OldUnit-1].Name,OldLink+'A', | 204 | if (NewUnit > MAX_RUP && NewUnit != ROUTE_DISCONNECT && NewUnit != ROUTE_NO_ID && NewUnit != ROUTE_INTERCONNECT) { |
298 | HostP->Mapping[ThisUnit-1].Name,ThisLink+'A'); | 205 | rio_dprintk(RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", MyType, MyName, NewUnit, NewLink); |
299 | } | 206 | } else { |
300 | } | 207 | /* |
301 | if ( NewUnit == HOST_ID ) | 208 | ** put the new values in |
302 | { | 209 | */ |
303 | rio_dprintk (RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", | 210 | TopP[ThisLink].Unit = NewUnit; |
304 | NewLink+'A',MyName,ThisLink+'A'); | 211 | TopP[ThisLink].Link = NewLink; |
305 | HostP->Topology[NewLink].Unit = ThisUnit; | 212 | |
306 | HostP->Topology[NewLink].Link = ThisLink; | 213 | RIOSetChange(p); |
307 | } | 214 | |
308 | else if ( NewUnit <= MAX_RUP ) | 215 | if (OldUnit <= MAX_RUP) { |
309 | { | 216 | /* |
310 | rio_dprintk (RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", | 217 | ** If something has become bust, then re-enable them messages |
311 | HostP->Mapping[NewUnit-1].Name,NewLink+'A',MyName,ThisLink+'A'); | 218 | */ |
312 | HostP->Mapping[NewUnit-1].Topology[NewLink].Unit=ThisUnit; | 219 | if (!p->RIONoMessage) |
313 | HostP->Mapping[NewUnit-1].Topology[NewLink].Link=ThisLink; | 220 | RIOConCon(p, HostP, ThisUnit, ThisLink, OldUnit, OldLink, DISCONNECT); |
314 | } | 221 | } |
222 | |||
223 | if ((NewUnit <= MAX_RUP) && !p->RIONoMessage) | ||
224 | RIOConCon(p, HostP, ThisUnit, ThisLink, NewUnit, NewLink, CONNECT); | ||
225 | |||
226 | if (NewUnit == ROUTE_NO_ID) | ||
227 | rio_dprintk(RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", MyType, MyName, 'A' + ThisLink); | ||
228 | |||
229 | if (NewUnit == ROUTE_INTERCONNECT) { | ||
230 | if (!p->RIONoMessage) | ||
231 | cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | ** perform an update for 'the other end', so that these messages | ||
236 | ** only appears once. Only disconnect the other end if it is pointing | ||
237 | ** at us! | ||
238 | */ | ||
239 | if (OldUnit == HOST_ID) { | ||
240 | if (HostP->Topology[OldLink].Unit == ThisUnit && HostP->Topology[OldLink].Link == ThisLink) { | ||
241 | rio_dprintk(RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink + 'A'); | ||
242 | HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; | ||
243 | HostP->Topology[OldLink].Link = NO_LINK; | ||
244 | } else { | ||
245 | rio_dprintk(RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A'); | ||
246 | } | ||
247 | } else if (OldUnit <= MAX_RUP) { | ||
248 | if (HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit == ThisUnit && HostP->Mapping[OldUnit - 1].Topology[OldLink].Link == ThisLink) { | ||
249 | rio_dprintk(RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A'); | ||
250 | HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit = ROUTE_DISCONNECT; | ||
251 | HostP->Mapping[OldUnit - 1].Topology[OldLink].Link = NO_LINK; | ||
252 | } else { | ||
253 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A'); | ||
254 | } | ||
255 | } | ||
256 | if (NewUnit == HOST_ID) { | ||
257 | rio_dprintk(RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", NewLink + 'A', MyName, ThisLink + 'A'); | ||
258 | HostP->Topology[NewLink].Unit = ThisUnit; | ||
259 | HostP->Topology[NewLink].Link = ThisLink; | ||
260 | } else if (NewUnit <= MAX_RUP) { | ||
261 | rio_dprintk(RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", HostP->Mapping[NewUnit - 1].Name, NewLink + 'A', MyName, ThisLink + 'A'); | ||
262 | HostP->Mapping[NewUnit - 1].Topology[NewLink].Unit = ThisUnit; | ||
263 | HostP->Mapping[NewUnit - 1].Topology[NewLink].Link = ThisLink; | ||
264 | } | ||
265 | } | ||
266 | RIOSetChange(p); | ||
267 | RIOCheckIsolated(p, HostP, OldUnit); | ||
268 | } | ||
269 | } | ||
270 | return TRUE; | ||
315 | } | 271 | } |
316 | RIOSetChange(p); | 272 | |
317 | RIOCheckIsolated(p, HostP, OldUnit ); | 273 | /* |
318 | } | 274 | ** The only other command we recognise is a route_request command |
319 | } | 275 | */ |
320 | return TRUE; | 276 | if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) { |
321 | } | 277 | rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP); |
322 | 278 | return TRUE; | |
323 | /* | ||
324 | ** The only other command we recognise is a route_request command | ||
325 | */ | ||
326 | if ( RBYTE(PktCmdP->Command) != ROUTE_REQUEST ) | ||
327 | { | ||
328 | rio_dprintk (RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", | ||
329 | RBYTE(PktCmdP->Command),Rup,(int)HostP); | ||
330 | return TRUE; | ||
331 | } | ||
332 | |||
333 | RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + | ||
334 | (RBYTE(PktCmdP->UniqNum[1]) << 8) + | ||
335 | (RBYTE(PktCmdP->UniqNum[2]) << 16) + | ||
336 | (RBYTE(PktCmdP->UniqNum[3]) << 24); | ||
337 | |||
338 | /* | ||
339 | ** Determine if 8 or 16 port RTA | ||
340 | */ | ||
341 | RtaType = GetUnitType(RtaUniq); | ||
342 | |||
343 | rio_dprintk (RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); | ||
344 | |||
345 | Mod = RBYTE(PktCmdP->ModuleTypes); | ||
346 | Mod1 = LONYBLE(Mod); | ||
347 | if (RtaType == TYPE_RTA16) | ||
348 | { | ||
349 | /* | ||
350 | ** Only one ident is set for a 16 port RTA. To make compatible | ||
351 | ** with 8 port, set 2nd ident in Mod2 to the same as Mod1. | ||
352 | */ | ||
353 | Mod2 = Mod1; | ||
354 | rio_dprintk (RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", | ||
355 | p->RIOModuleTypes[Mod1].Name); | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | Mod2 = HINYBLE(Mod); | ||
360 | rio_dprintk (RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", | ||
361 | p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name); | ||
362 | } | ||
363 | |||
364 | if ( RtaUniq == 0xffffffff ) | ||
365 | { | ||
366 | ShowPacket( DBG_SPECIAL, PacketP ); | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | ** try to unhook a command block from the command free list. | ||
371 | */ | ||
372 | if ( !(CmdBlkP = RIOGetCmdBlk()) ) | ||
373 | { | ||
374 | rio_dprintk (RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n"); | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | /* | ||
379 | ** Fill in the default info on the command block | ||
380 | */ | ||
381 | CmdBlkP->Packet.dest_unit = Rup; | ||
382 | CmdBlkP->Packet.dest_port = ROUTE_RUP; | ||
383 | CmdBlkP->Packet.src_unit = HOST_ID; | ||
384 | CmdBlkP->Packet.src_port = ROUTE_RUP; | ||
385 | CmdBlkP->Packet.len = PKT_CMD_BIT | 1; | ||
386 | CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; | ||
387 | PktReplyP = (struct PktCmd_M *)CmdBlkP->Packet.data; | ||
388 | |||
389 | if (! RIOBootOk(p, HostP, RtaUniq)) | ||
390 | { | ||
391 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", | ||
392 | RtaUniq); | ||
393 | PktReplyP->Command = ROUTE_FOAD; | ||
394 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | ||
395 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
396 | return TRUE; | ||
397 | } | ||
398 | |||
399 | /* | ||
400 | ** Check to see if the RTA is configured for this host | ||
401 | */ | ||
402 | for ( ThisUnit=0; ThisUnit<MAX_RUP; ThisUnit++ ) | ||
403 | { | ||
404 | rio_dprintk (RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n", | ||
405 | ThisUnit, | ||
406 | HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ? | ||
407 | "Slot-In-Use":"Not In Use", | ||
408 | HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? | ||
409 | "Slot-Tentative":"Not Tentative", | ||
410 | HostP->Mapping[ThisUnit].RtaUniqueNum); | ||
411 | |||
412 | /* | ||
413 | ** We have an entry for it. | ||
414 | */ | ||
415 | if ( (HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && | ||
416 | (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq) ) | ||
417 | { | ||
418 | if (RtaType == TYPE_RTA16) | ||
419 | { | ||
420 | ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; | ||
421 | rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", | ||
422 | RtaUniq,ThisUnit,ThisUnit2); | ||
423 | } | ||
424 | else | ||
425 | rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", | ||
426 | RtaUniq,ThisUnit); | ||
427 | /* | ||
428 | ** If we have no knowledge of booting it, then the host has | ||
429 | ** been re-booted, and so we must kill the RTA, so that it | ||
430 | ** will be booted again (potentially with new bins) | ||
431 | ** and it will then re-ask for an ID, which we will service. | ||
432 | */ | ||
433 | if ( (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && | ||
434 | !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED) ) | ||
435 | { | ||
436 | if ( !(HostP->Mapping[ThisUnit].Flags & MSG_DONE) ) | ||
437 | { | ||
438 | if ( !p->RIONoMessage ) | ||
439 | cprintf("RTA '%s' is being updated.\n",HostP->Mapping[ThisUnit].Name); | ||
440 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; | ||
441 | } | 279 | } |
442 | PktReplyP->Command = ROUTE_FOAD; | 280 | |
443 | HostP->Copy("RT_FOAD",PktReplyP->CommandText,7); | 281 | RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24); |
444 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | 282 | |
445 | return TRUE; | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | ** Send the ID (entry) to this RTA. The ID number is implicit as | ||
450 | ** the offset into the table. It is worth noting at this stage | ||
451 | ** that offset zero in the table contains the entries for the | ||
452 | ** RTA with ID 1!!!! | ||
453 | */ | ||
454 | PktReplyP->Command = ROUTE_ALLOCATE; | ||
455 | PktReplyP->IDNum = ThisUnit+1; | ||
456 | if (RtaType == TYPE_RTA16) | ||
457 | { | ||
458 | if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) | ||
459 | /* | ||
460 | ** Adjust the phb and tx pkt dest_units for 2nd block of 8 | ||
461 | ** only if the RTA has ports associated (SLOT_IN_USE) | ||
462 | */ | ||
463 | RIOFixPhbs(p, HostP, ThisUnit2); | ||
464 | PktReplyP->IDNum2 = ThisUnit2+1; | ||
465 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", | ||
466 | HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | PktReplyP->IDNum2 = ROUTE_NO_ID; | ||
471 | rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", | ||
472 | HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum); | ||
473 | } | ||
474 | HostP->Copy("RT_ALLOCAT",PktReplyP->CommandText,10); | ||
475 | |||
476 | RIOQueueCmdBlk( HostP, Rup, CmdBlkP); | ||
477 | |||
478 | /* | ||
479 | ** If this is a freshly booted RTA, then we need to re-open | ||
480 | ** the ports, if any where open, so that data may once more | ||
481 | ** flow around the system! | ||
482 | */ | ||
483 | if ( (HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && | ||
484 | (HostP->Mapping[ThisUnit].SysPort != NO_PORT) ) | ||
485 | { | ||
486 | /* | 283 | /* |
487 | ** look at the ports associated with this beast and | 284 | ** Determine if 8 or 16 port RTA |
488 | ** see if any where open. If they was, then re-open | 285 | */ |
489 | ** them, using the info from the tty flags. | 286 | RtaType = GetUnitType(RtaUniq); |
490 | */ | 287 | |
491 | for ( port=0; port<PORTS_PER_RTA; port++ ) | 288 | rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); |
492 | { | 289 | |
493 | PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]; | 290 | Mod = RBYTE(PktCmdP->ModuleTypes); |
494 | if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) | 291 | Mod1 = LONYBLE(Mod); |
495 | { | 292 | if (RtaType == TYPE_RTA16) { |
496 | rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n"); | 293 | /* |
497 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 294 | ** Only one ident is set for a 16 port RTA. To make compatible |
498 | PortP->MagicFlags |= MAGIC_REBOOT; | 295 | ** with 8 port, set 2nd ident in Mod2 to the same as Mod1. |
499 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 296 | */ |
500 | } | 297 | Mod2 = Mod1; |
298 | rio_dprintk(RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", p->RIOModuleTypes[Mod1].Name); | ||
299 | } else { | ||
300 | Mod2 = HINYBLE(Mod); | ||
301 | rio_dprintk(RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name); | ||
501 | } | 302 | } |
502 | if (RtaType == TYPE_RTA16) | 303 | |
503 | { | 304 | if (RtaUniq == 0xffffffff) { |
504 | for ( port=0; port<PORTS_PER_RTA; port++ ) | 305 | ShowPacket(DBG_SPECIAL, PacketP); |
505 | { | ||
506 | PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]; | ||
507 | if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) | ||
508 | { | ||
509 | rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
510 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
511 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
512 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
513 | } | ||
514 | } | ||
515 | } | 306 | } |
516 | } | 307 | |
517 | 308 | /* | |
518 | /* | 309 | ** try to unhook a command block from the command free list. |
519 | ** keep a copy of the module types! | 310 | */ |
520 | */ | 311 | if (!(CmdBlkP = RIOGetCmdBlk())) { |
521 | HostP->UnixRups[ThisUnit].ModTypes = Mod; | 312 | rio_dprintk(RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n"); |
522 | if (RtaType == TYPE_RTA16) | 313 | return 0; |
523 | HostP->UnixRups[ThisUnit2].ModTypes = Mod; | ||
524 | |||
525 | /* | ||
526 | ** If either of the modules on this unit is read-only or write-only | ||
527 | ** or none-xprint, then we need to transfer that info over to the | ||
528 | ** relevant ports. | ||
529 | */ | ||
530 | if ( HostP->Mapping[ThisUnit].SysPort != NO_PORT ) | ||
531 | { | ||
532 | for ( port=0; port<PORTS_PER_MODULE; port++ ) | ||
533 | { | ||
534 | p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
535 | p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config |= | ||
536 | p->RIOModuleTypes[Mod1].Flags[port]; | ||
537 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
538 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
539 | } | 314 | } |
540 | if (RtaType == TYPE_RTA16) | 315 | |
541 | { | 316 | /* |
542 | for ( port=0; port<PORTS_PER_MODULE; port++ ) | 317 | ** Fill in the default info on the command block |
543 | { | 318 | */ |
544 | p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | 319 | CmdBlkP->Packet.dest_unit = Rup; |
545 | p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | 320 | CmdBlkP->Packet.dest_port = ROUTE_RUP; |
546 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | 321 | CmdBlkP->Packet.src_unit = HOST_ID; |
547 | p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | 322 | CmdBlkP->Packet.src_port = ROUTE_RUP; |
548 | } | 323 | CmdBlkP->Packet.len = PKT_CMD_BIT | 1; |
324 | CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; | ||
325 | PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data; | ||
326 | |||
327 | if (!RIOBootOk(p, HostP, RtaUniq)) { | ||
328 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq); | ||
329 | PktReplyP->Command = ROUTE_FOAD; | ||
330 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | ||
331 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
332 | return TRUE; | ||
549 | } | 333 | } |
550 | } | 334 | |
551 | 335 | /* | |
552 | /* | 336 | ** Check to see if the RTA is configured for this host |
553 | ** Job done, get on with the interrupts! | 337 | */ |
554 | */ | 338 | for (ThisUnit = 0; ThisUnit < MAX_RUP; ThisUnit++) { |
555 | return TRUE; | 339 | rio_dprintk(RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n", |
556 | } | 340 | ThisUnit, HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ? "Slot-In-Use" : "Not In Use", HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? "Slot-Tentative" : "Not Tentative", HostP->Mapping[ThisUnit].RtaUniqueNum); |
557 | } | 341 | |
558 | /* | 342 | /* |
559 | ** There is no table entry for this RTA at all. | 343 | ** We have an entry for it. |
560 | ** | 344 | */ |
561 | ** Lets check to see if we actually booted this unit - if not, | 345 | if ((HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq)) { |
562 | ** then we reset it and it will go round the loop of being booted | 346 | if (RtaType == TYPE_RTA16) { |
563 | ** we can then worry about trying to fit it into the table. | 347 | ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; |
564 | */ | 348 | rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", RtaUniq, ThisUnit, ThisUnit2); |
565 | for ( ThisUnit=0; ThisUnit<HostP->NumExtraBooted; ThisUnit++ ) | 349 | } else |
566 | if ( HostP->ExtraUnits[ThisUnit] == RtaUniq ) | 350 | rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", RtaUniq, ThisUnit); |
567 | break; | 351 | /* |
568 | if ( ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS ) | 352 | ** If we have no knowledge of booting it, then the host has |
569 | { | 353 | ** been re-booted, and so we must kill the RTA, so that it |
570 | /* | 354 | ** will be booted again (potentially with new bins) |
571 | ** if the unit wasn't in the table, and the table wasn't full, then | 355 | ** and it will then re-ask for an ID, which we will service. |
572 | ** we reset the unit, because we didn't boot it. | 356 | */ |
573 | ** However, if the table is full, it could be that we did boot | 357 | if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) { |
574 | ** this unit, and so we won't reboot it, because it isn't really | 358 | if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) { |
575 | ** all that disasterous to keep the old bins in most cases. This | 359 | if (!p->RIONoMessage) |
576 | ** is a rather tacky feature, but we are on the edge of reallity | 360 | cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name); |
577 | ** here, because the implication is that someone has connected | 361 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; |
578 | ** 16+MAX_EXTRA_UNITS onto one host. | 362 | } |
579 | */ | 363 | PktReplyP->Command = ROUTE_FOAD; |
580 | static int UnknownMesgDone = 0; | 364 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); |
581 | 365 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | |
582 | if ( !UnknownMesgDone ) | 366 | return TRUE; |
583 | { | 367 | } |
584 | if (! p->RIONoMessage) | 368 | |
585 | cprintf("One or more unknown RTAs are being updated.\n"); | 369 | /* |
586 | UnknownMesgDone = 1; | 370 | ** Send the ID (entry) to this RTA. The ID number is implicit as |
587 | } | 371 | ** the offset into the table. It is worth noting at this stage |
588 | 372 | ** that offset zero in the table contains the entries for the | |
589 | PktReplyP->Command = ROUTE_FOAD; | 373 | ** RTA with ID 1!!!! |
590 | HostP->Copy("RT_FOAD",PktReplyP->CommandText,7); | 374 | */ |
591 | } | 375 | PktReplyP->Command = ROUTE_ALLOCATE; |
592 | else | 376 | PktReplyP->IDNum = ThisUnit + 1; |
593 | { | 377 | if (RtaType == TYPE_RTA16) { |
594 | /* | 378 | if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) |
595 | ** we did boot it (as an extra), and there may now be a table | 379 | /* |
596 | ** slot free (because of a delete), so we will try to make | 380 | ** Adjust the phb and tx pkt dest_units for 2nd block of 8 |
597 | ** a tentative entry for it, so that the configurator can see it | 381 | ** only if the RTA has ports associated (SLOT_IN_USE) |
598 | ** and fill in the details for us. | 382 | */ |
599 | */ | 383 | RIOFixPhbs(p, HostP, ThisUnit2); |
600 | if (RtaType == TYPE_RTA16) | 384 | PktReplyP->IDNum2 = ThisUnit2 + 1; |
601 | { | 385 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); |
602 | if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) | 386 | } else { |
603 | { | 387 | PktReplyP->IDNum2 = ROUTE_NO_ID; |
604 | RIODefaultName(p, HostP, ThisUnit); | 388 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum); |
605 | FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP); | 389 | } |
390 | HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10); | ||
391 | |||
392 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | ||
393 | |||
394 | /* | ||
395 | ** If this is a freshly booted RTA, then we need to re-open | ||
396 | ** the ports, if any where open, so that data may once more | ||
397 | ** flow around the system! | ||
398 | */ | ||
399 | if ((HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && (HostP->Mapping[ThisUnit].SysPort != NO_PORT)) { | ||
400 | /* | ||
401 | ** look at the ports associated with this beast and | ||
402 | ** see if any where open. If they was, then re-open | ||
403 | ** them, using the info from the tty flags. | ||
404 | */ | ||
405 | for (port = 0; port < PORTS_PER_RTA; port++) { | ||
406 | PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]; | ||
407 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
408 | rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
409 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
410 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
411 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
412 | } | ||
413 | } | ||
414 | if (RtaType == TYPE_RTA16) { | ||
415 | for (port = 0; port < PORTS_PER_RTA; port++) { | ||
416 | PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]; | ||
417 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { | ||
418 | rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n"); | ||
419 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
420 | PortP->MagicFlags |= MAGIC_REBOOT; | ||
421 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | } | ||
426 | |||
427 | /* | ||
428 | ** keep a copy of the module types! | ||
429 | */ | ||
430 | HostP->UnixRups[ThisUnit].ModTypes = Mod; | ||
431 | if (RtaType == TYPE_RTA16) | ||
432 | HostP->UnixRups[ThisUnit2].ModTypes = Mod; | ||
433 | |||
434 | /* | ||
435 | ** If either of the modules on this unit is read-only or write-only | ||
436 | ** or none-xprint, then we need to transfer that info over to the | ||
437 | ** relevant ports. | ||
438 | */ | ||
439 | if (HostP->Mapping[ThisUnit].SysPort != NO_PORT) { | ||
440 | for (port = 0; port < PORTS_PER_MODULE; port++) { | ||
441 | p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
442 | p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | ||
443 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK; | ||
444 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
445 | } | ||
446 | if (RtaType == TYPE_RTA16) { | ||
447 | for (port = 0; port < PORTS_PER_MODULE; port++) { | ||
448 | p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | ||
449 | p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port]; | ||
450 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK; | ||
451 | p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port]; | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
456 | /* | ||
457 | ** Job done, get on with the interrupts! | ||
458 | */ | ||
459 | return TRUE; | ||
460 | } | ||
606 | } | 461 | } |
607 | } | 462 | /* |
608 | else | 463 | ** There is no table entry for this RTA at all. |
609 | { | 464 | ** |
610 | if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) | 465 | ** Lets check to see if we actually booted this unit - if not, |
611 | { | 466 | ** then we reset it and it will go round the loop of being booted |
612 | RIODefaultName(p, HostP, ThisUnit); | 467 | ** we can then worry about trying to fit it into the table. |
613 | FillSlot(ThisUnit, 0, RtaUniq, HostP); | 468 | */ |
469 | for (ThisUnit = 0; ThisUnit < HostP->NumExtraBooted; ThisUnit++) | ||
470 | if (HostP->ExtraUnits[ThisUnit] == RtaUniq) | ||
471 | break; | ||
472 | if (ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS) { | ||
473 | /* | ||
474 | ** if the unit wasn't in the table, and the table wasn't full, then | ||
475 | ** we reset the unit, because we didn't boot it. | ||
476 | ** However, if the table is full, it could be that we did boot | ||
477 | ** this unit, and so we won't reboot it, because it isn't really | ||
478 | ** all that disasterous to keep the old bins in most cases. This | ||
479 | ** is a rather tacky feature, but we are on the edge of reallity | ||
480 | ** here, because the implication is that someone has connected | ||
481 | ** 16+MAX_EXTRA_UNITS onto one host. | ||
482 | */ | ||
483 | static int UnknownMesgDone = 0; | ||
484 | |||
485 | if (!UnknownMesgDone) { | ||
486 | if (!p->RIONoMessage) | ||
487 | cprintf("One or more unknown RTAs are being updated.\n"); | ||
488 | UnknownMesgDone = 1; | ||
489 | } | ||
490 | |||
491 | PktReplyP->Command = ROUTE_FOAD; | ||
492 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | ||
493 | } else { | ||
494 | /* | ||
495 | ** we did boot it (as an extra), and there may now be a table | ||
496 | ** slot free (because of a delete), so we will try to make | ||
497 | ** a tentative entry for it, so that the configurator can see it | ||
498 | ** and fill in the details for us. | ||
499 | */ | ||
500 | if (RtaType == TYPE_RTA16) { | ||
501 | if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) { | ||
502 | RIODefaultName(p, HostP, ThisUnit); | ||
503 | FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP); | ||
504 | } | ||
505 | } else { | ||
506 | if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) { | ||
507 | RIODefaultName(p, HostP, ThisUnit); | ||
508 | FillSlot(ThisUnit, 0, RtaUniq, HostP); | ||
509 | } | ||
510 | } | ||
511 | PktReplyP->Command = ROUTE_USED; | ||
512 | HostP->Copy("RT_USED", PktReplyP->CommandText, 7); | ||
614 | } | 513 | } |
615 | } | 514 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); |
616 | PktReplyP->Command = ROUTE_USED; | 515 | return TRUE; |
617 | HostP->Copy("RT_USED",PktReplyP->CommandText,7); | ||
618 | } | ||
619 | RIOQueueCmdBlk( HostP, Rup, CmdBlkP); | ||
620 | return TRUE; | ||
621 | } | 516 | } |
622 | 517 | ||
623 | 518 | ||
624 | void | 519 | void RIOFixPhbs(p, HostP, unit) |
625 | RIOFixPhbs(p, HostP, unit) | ||
626 | struct rio_info *p; | 520 | struct rio_info *p; |
627 | struct Host *HostP; | 521 | struct Host *HostP; |
628 | uint unit; | 522 | uint unit; |
629 | { | 523 | { |
630 | ushort link, port; | 524 | ushort link, port; |
631 | struct Port *PortP; | 525 | struct Port *PortP; |
632 | unsigned long flags; | 526 | unsigned long flags; |
633 | int PortN = HostP->Mapping[unit].SysPort; | 527 | int PortN = HostP->Mapping[unit].SysPort; |
634 | 528 | ||
635 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); | 529 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); |
636 | 530 | ||
637 | if (PortN != -1) { | 531 | if (PortN != -1) { |
638 | ushort dest_unit = HostP->Mapping[unit].ID2; | 532 | ushort dest_unit = HostP->Mapping[unit].ID2; |
639 | 533 | ||
640 | /* | 534 | /* |
641 | ** Get the link number used for the 1st 8 phbs on this unit. | 535 | ** Get the link number used for the 1st 8 phbs on this unit. |
642 | */ | 536 | */ |
643 | PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; | 537 | PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; |
644 | 538 | ||
645 | link = RWORD(PortP->PhbP->link); | 539 | link = RWORD(PortP->PhbP->link); |
646 | 540 | ||
647 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { | 541 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { |
648 | ushort dest_port = port + 8; | 542 | ushort dest_port = port + 8; |
649 | #if 0 | 543 | #if 0 |
650 | uint PktInt; | 544 | uint PktInt; |
651 | #endif | 545 | #endif |
652 | WORD *TxPktP; | 546 | WORD *TxPktP; |
653 | PKT *Pkt; | 547 | PKT *Pkt; |
654 | 548 | ||
655 | PortP = p->RIOPortp[PortN]; | 549 | PortP = p->RIOPortp[PortN]; |
656 | 550 | ||
657 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 551 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
658 | /* | 552 | /* |
659 | ** If RTA is not powered on, the tx packets will be | 553 | ** If RTA is not powered on, the tx packets will be |
660 | ** unset, so go no further. | 554 | ** unset, so go no further. |
661 | */ | 555 | */ |
662 | if (PortP->TxStart == 0) { | 556 | if (PortP->TxStart == 0) { |
663 | rio_dprintk (RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); | 557 | rio_dprintk(RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); |
664 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 558 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
665 | break; | 559 | break; |
666 | } | 560 | } |
667 | 561 | ||
668 | /* | 562 | /* |
669 | ** For the second slot of a 16 port RTA, the driver needs to | 563 | ** For the second slot of a 16 port RTA, the driver needs to |
670 | ** sort out the phb to port mappings. The dest_unit for this | 564 | ** sort out the phb to port mappings. The dest_unit for this |
671 | ** group of 8 phbs is set to the dest_unit of the accompanying | 565 | ** group of 8 phbs is set to the dest_unit of the accompanying |
672 | ** 8 port block. The dest_port of the second unit is set to | 566 | ** 8 port block. The dest_port of the second unit is set to |
673 | ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port | 567 | ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port |
674 | ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6 | 568 | ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6 |
675 | ** (being the second map ID) will be sent to dest_unit 5, port | 569 | ** (being the second map ID) will be sent to dest_unit 5, port |
676 | ** 14. When this RTA is deleted, dest_unit for ID 6 will be | 570 | ** 14. When this RTA is deleted, dest_unit for ID 6 will be |
677 | ** restored, and the dest_port will be reduced by 8. | 571 | ** restored, and the dest_port will be reduced by 8. |
678 | ** Transmit packets also have a destination field which needs | 572 | ** Transmit packets also have a destination field which needs |
679 | ** adjusting in the same manner. | 573 | ** adjusting in the same manner. |
680 | ** Note that the unit/port bytes in 'dest' are swapped. | 574 | ** Note that the unit/port bytes in 'dest' are swapped. |
681 | ** We also need to adjust the phb and rup link numbers for the | 575 | ** We also need to adjust the phb and rup link numbers for the |
682 | ** second block of 8 ttys. | 576 | ** second block of 8 ttys. |
683 | */ | 577 | */ |
684 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { | 578 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { |
685 | /* | 579 | /* |
686 | ** *TxPktP is the pointer to the transmit packet on the host | 580 | ** *TxPktP is the pointer to the transmit packet on the host |
687 | ** card. This needs to be translated into a 32 bit pointer | 581 | ** card. This needs to be translated into a 32 bit pointer |
688 | ** so it can be accessed from the driver. | 582 | ** so it can be accessed from the driver. |
689 | */ | 583 | */ |
690 | Pkt = (PKT *) RIO_PTR(HostP->Caddr,RINDW(TxPktP)); | 584 | Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP)); |
691 | 585 | ||
692 | /* | 586 | /* |
693 | ** If the packet is used, reset it. | 587 | ** If the packet is used, reset it. |
694 | */ | 588 | */ |
695 | Pkt = (PKT *)((uint)Pkt & ~PKT_IN_USE); | 589 | Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE); |
696 | WBYTE(Pkt->dest_unit, dest_unit); | 590 | WBYTE(Pkt->dest_unit, dest_unit); |
697 | WBYTE(Pkt->dest_port, dest_port); | 591 | WBYTE(Pkt->dest_port, dest_port); |
698 | } | 592 | } |
699 | rio_dprintk (RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", | 593 | rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); |
700 | RWORD(PortP->PhbP->destination) & 0xff, | ||
701 | (RWORD(PortP->PhbP->destination) >> 8) & 0xff, | ||
702 | dest_unit, dest_port); | ||
703 | WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); | 594 | WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); |
704 | WWORD(PortP->PhbP->link, link); | 595 | WWORD(PortP->PhbP->link, link); |
705 | 596 | ||
706 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 597 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
707 | } | 598 | } |
708 | /* | 599 | /* |
709 | ** Now make sure the range of ports to be serviced includes | 600 | ** Now make sure the range of ports to be serviced includes |
710 | ** the 2nd 8 on this 16 port RTA. | 601 | ** the 2nd 8 on this 16 port RTA. |
711 | */ | 602 | */ |
712 | if (link > 3) return; | 603 | if (link > 3) |
604 | return; | ||
713 | if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { | 605 | if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { |
714 | rio_dprintk (RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); | 606 | rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); |
715 | WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); | 607 | WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); |
716 | } | 608 | } |
717 | } | 609 | } |
@@ -723,9 +615,8 @@ uint unit; | |||
723 | ** the world about it. This is done to ensure that the configurator | 615 | ** the world about it. This is done to ensure that the configurator |
724 | ** only gets up-to-date information about what is going on. | 616 | ** only gets up-to-date information about what is going on. |
725 | */ | 617 | */ |
726 | static int | 618 | static int RIOCheckIsolated(p, HostP, UnitId) |
727 | RIOCheckIsolated(p, HostP, UnitId) | 619 | struct rio_info *p; |
728 | struct rio_info * p; | ||
729 | struct Host *HostP; | 620 | struct Host *HostP; |
730 | uint UnitId; | 621 | uint UnitId; |
731 | { | 622 | { |
@@ -733,16 +624,16 @@ uint UnitId; | |||
733 | rio_spin_lock_irqsave(&HostP->HostLock, flags); | 624 | rio_spin_lock_irqsave(&HostP->HostLock, flags); |
734 | 625 | ||
735 | #ifdef CHECK | 626 | #ifdef CHECK |
736 | CheckHostP( HostP ); | 627 | CheckHostP(HostP); |
737 | CheckUnitId( UnitId ); | 628 | CheckUnitId(UnitId); |
738 | #endif | 629 | #endif |
739 | if ( RIOCheck( HostP, UnitId ) ) { | 630 | if (RIOCheck(HostP, UnitId)) { |
740 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); | 631 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); |
741 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | 632 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); |
742 | return(0); | 633 | return (0); |
743 | } | 634 | } |
744 | 635 | ||
745 | RIOIsolate(p, HostP, UnitId ); | 636 | RIOIsolate(p, HostP, UnitId); |
746 | RIOSetChange(p); | 637 | RIOSetChange(p); |
747 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); | 638 | rio_spin_unlock_irqrestore(&HostP->HostLock, flags); |
748 | return 1; | 639 | return 1; |
@@ -753,85 +644,83 @@ uint UnitId; | |||
753 | ** all the units attached to it. This will mean that the entire | 644 | ** all the units attached to it. This will mean that the entire |
754 | ** subnet will re-introduce itself. | 645 | ** subnet will re-introduce itself. |
755 | */ | 646 | */ |
756 | static int | 647 | static int RIOIsolate(p, HostP, UnitId) |
757 | RIOIsolate(p, HostP, UnitId) | 648 | struct rio_info *p; |
758 | struct rio_info * p; | 649 | struct Host *HostP; |
759 | struct Host * HostP; | 650 | uint UnitId; |
760 | uint UnitId; | ||
761 | { | 651 | { |
762 | uint link, unit; | 652 | uint link, unit; |
763 | 653 | ||
764 | #ifdef CHECK | 654 | #ifdef CHECK |
765 | CheckHostP( HostP ); | 655 | CheckHostP(HostP); |
766 | CheckUnitId( UnitId ); | 656 | CheckUnitId(UnitId); |
767 | #endif | 657 | #endif |
768 | UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ | 658 | UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ |
769 | 659 | ||
770 | if ( UnitId >= MAX_RUP ) /* dontcha just lurv unsigned maths! */ | 660 | if (UnitId >= MAX_RUP) /* dontcha just lurv unsigned maths! */ |
771 | return(0); | 661 | return (0); |
772 | 662 | ||
773 | if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) | 663 | if (HostP->Mapping[UnitId].Flags & BEEN_HERE) |
774 | return(0); | 664 | return (0); |
775 | 665 | ||
776 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; | 666 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; |
777 | 667 | ||
778 | if ( p->RIOPrintDisabled == DO_PRINT ) | 668 | if (p->RIOPrintDisabled == DO_PRINT) |
779 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); | 669 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); |
780 | 670 | ||
781 | for ( link=0; link<LINKS_PER_UNIT; link++) { | 671 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
782 | unit = HostP->Mapping[UnitId].Topology[link].Unit; | 672 | unit = HostP->Mapping[UnitId].Topology[link].Unit; |
783 | HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT; | 673 | HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT; |
784 | HostP->Mapping[UnitId].Topology[link].Link = NO_LINK; | 674 | HostP->Mapping[UnitId].Topology[link].Link = NO_LINK; |
785 | RIOIsolate(p, HostP, unit ); | 675 | RIOIsolate(p, HostP, unit); |
786 | } | 676 | } |
787 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | 677 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; |
788 | return 1; | 678 | return 1; |
789 | } | 679 | } |
790 | 680 | ||
791 | static int | 681 | static int RIOCheck(HostP, UnitId) |
792 | RIOCheck(HostP, UnitId) | ||
793 | struct Host *HostP; | 682 | struct Host *HostP; |
794 | uint UnitId; | 683 | uint UnitId; |
795 | { | 684 | { |
796 | unsigned char link; | 685 | unsigned char link; |
797 | 686 | ||
798 | #ifdef CHECK | 687 | #ifdef CHECK |
799 | CheckHostP( HostP ); | 688 | CheckHostP(HostP); |
800 | CheckUnitId( UnitId ); | 689 | CheckUnitId(UnitId); |
801 | #endif | 690 | #endif |
802 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ | 691 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ |
803 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); | 692 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); |
804 | 693 | ||
805 | if ( UnitId == HOST_ID ) { | 694 | if (UnitId == HOST_ID) { |
806 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ | 695 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ |
807 | return 1; | 696 | return 1; |
808 | } | 697 | } |
809 | 698 | ||
810 | UnitId--; | 699 | UnitId--; |
811 | 700 | ||
812 | if ( UnitId >= MAX_RUP ) { | 701 | if (UnitId >= MAX_RUP) { |
813 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */ | 702 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */ |
814 | return 0; | 703 | return 0; |
815 | } | 704 | } |
816 | 705 | ||
817 | for ( link=0; link<LINKS_PER_UNIT; link++ ) { | 706 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
818 | if ( HostP->Mapping[UnitId].Topology[link].Unit==HOST_ID ) { | 707 | if (HostP->Mapping[UnitId].Topology[link].Unit == HOST_ID) { |
819 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", | 708 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", |
820 | UnitId, 'A'+link)); */ | 709 | UnitId, 'A'+link)); */ |
821 | return 1; | 710 | return 1; |
822 | } | 711 | } |
823 | } | 712 | } |
824 | 713 | ||
825 | if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) { | 714 | if (HostP->Mapping[UnitId].Flags & BEEN_HERE) { |
826 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */ | 715 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */ |
827 | return 0; | 716 | return 0; |
828 | } | 717 | } |
829 | 718 | ||
830 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; | 719 | HostP->Mapping[UnitId].Flags |= BEEN_HERE; |
831 | 720 | ||
832 | for ( link=0; link < LINKS_PER_UNIT; link++ ) { | 721 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
833 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */ | 722 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */ |
834 | if ( RIOCheck( HostP, HostP->Mapping[UnitId].Topology[link].Unit ) ) { | 723 | if (RIOCheck(HostP, HostP->Mapping[UnitId].Topology[link].Unit)) { |
835 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */ | 724 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */ |
836 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | 725 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; |
837 | return 1; | 726 | return 1; |
@@ -841,7 +730,7 @@ uint UnitId; | |||
841 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; | 730 | HostP->Mapping[UnitId].Flags &= ~BEEN_HERE; |
842 | 731 | ||
843 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */ | 732 | /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */ |
844 | 733 | ||
845 | return 0; | 734 | return 0; |
846 | } | 735 | } |
847 | 736 | ||
@@ -849,61 +738,57 @@ uint UnitId; | |||
849 | ** Returns the type of unit (host, 16/8 port RTA) | 738 | ** Returns the type of unit (host, 16/8 port RTA) |
850 | */ | 739 | */ |
851 | 740 | ||
852 | uint | 741 | uint GetUnitType(Uniq) |
853 | GetUnitType(Uniq) | ||
854 | uint Uniq; | 742 | uint Uniq; |
855 | { | 743 | { |
856 | switch ( (Uniq >> 28) & 0xf) | 744 | switch ((Uniq >> 28) & 0xf) { |
857 | { | 745 | case RIO_AT: |
858 | case RIO_AT: | 746 | case RIO_MCA: |
859 | case RIO_MCA: | 747 | case RIO_EISA: |
860 | case RIO_EISA: | 748 | case RIO_PCI: |
861 | case RIO_PCI: | 749 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Host\n"); |
862 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Host\n"); | 750 | return (TYPE_HOST); |
863 | return(TYPE_HOST); | 751 | case RIO_RTA_16: |
864 | case RIO_RTA_16: | 752 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); |
865 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); | 753 | return (TYPE_RTA16); |
866 | return(TYPE_RTA16); | 754 | case RIO_RTA: |
867 | case RIO_RTA: | 755 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); |
868 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); | 756 | return (TYPE_RTA8); |
869 | return(TYPE_RTA8); | 757 | default: |
870 | default : | 758 | rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); |
871 | rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); | 759 | return (99); |
872 | return(99); | ||
873 | } | 760 | } |
874 | } | 761 | } |
875 | 762 | ||
876 | int | 763 | int RIOSetChange(p) |
877 | RIOSetChange(p) | 764 | struct rio_info *p; |
878 | struct rio_info * p; | ||
879 | { | 765 | { |
880 | if ( p->RIOQuickCheck != NOT_CHANGED ) | 766 | if (p->RIOQuickCheck != NOT_CHANGED) |
881 | return(0); | 767 | return (0); |
882 | p->RIOQuickCheck = CHANGED; | 768 | p->RIOQuickCheck = CHANGED; |
883 | if ( p->RIOSignalProcess ) { | 769 | if (p->RIOSignalProcess) { |
884 | rio_dprintk (RIO_DEBUG_ROUTE, "Send SIG-HUP"); | 770 | rio_dprintk(RIO_DEBUG_ROUTE, "Send SIG-HUP"); |
885 | /* | 771 | /* |
886 | psignal( RIOSignalProcess, SIGHUP ); | 772 | psignal( RIOSignalProcess, SIGHUP ); |
887 | */ | 773 | */ |
888 | } | 774 | } |
889 | return(0); | 775 | return (0); |
890 | } | 776 | } |
891 | 777 | ||
892 | static void | 778 | static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change) |
893 | RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change) | 779 | struct rio_info *p; |
894 | struct rio_info * p; | ||
895 | struct Host *HostP; | 780 | struct Host *HostP; |
896 | uint FromId; | 781 | uint FromId; |
897 | uint FromLink; | 782 | uint FromLink; |
898 | uint ToId; | 783 | uint ToId; |
899 | uint ToLink; | 784 | uint ToLink; |
900 | int Change; | 785 | int Change; |
901 | { | 786 | { |
902 | char *FromName; | 787 | char *FromName; |
903 | char *FromType; | 788 | char *FromType; |
904 | char *ToName; | 789 | char *ToName; |
905 | char *ToType; | 790 | char *ToType; |
906 | unsigned int tp; | 791 | unsigned int tp; |
907 | 792 | ||
908 | /* | 793 | /* |
909 | ** 15.10.1998 ARG - ESIL 0759 | 794 | ** 15.10.1998 ARG - ESIL 0759 |
@@ -932,38 +817,32 @@ int Change; | |||
932 | ** rio_info struct - RIORtaDisCons (RIO RTA connections) keeps track of RTA | 817 | ** rio_info struct - RIORtaDisCons (RIO RTA connections) keeps track of RTA |
933 | ** connections and disconnections. | 818 | ** connections and disconnections. |
934 | */ | 819 | */ |
935 | if (Change == CONNECT) { | 820 | if (Change == CONNECT) { |
936 | if (p->RIORtaDisCons) p->RIORtaDisCons--; | 821 | if (p->RIORtaDisCons) |
937 | } | 822 | p->RIORtaDisCons--; |
938 | else { | 823 | } else { |
939 | p->RIORtaDisCons++; | 824 | p->RIORtaDisCons++; |
940 | } | 825 | } |
941 | 826 | ||
942 | if ( p->RIOPrintDisabled == DONT_PRINT ) | 827 | if (p->RIOPrintDisabled == DONT_PRINT) |
943 | return; | 828 | return; |
944 | 829 | ||
945 | if ( FromId > ToId ) { | 830 | if (FromId > ToId) { |
946 | tp = FromId; | 831 | tp = FromId; |
947 | FromId = ToId; | 832 | FromId = ToId; |
948 | ToId = tp; | 833 | ToId = tp; |
949 | tp = FromLink; | 834 | tp = FromLink; |
950 | FromLink = ToLink; | 835 | FromLink = ToLink; |
951 | ToLink = tp; | 836 | ToLink = tp; |
952 | } | 837 | } |
953 | 838 | ||
954 | FromName = FromId ? HostP->Mapping[FromId-1].Name : HostP->Name; | 839 | FromName = FromId ? HostP->Mapping[FromId - 1].Name : HostP->Name; |
955 | FromType = FromId ? "RTA" : "HOST"; | 840 | FromType = FromId ? "RTA" : "HOST"; |
956 | ToName = ToId ? HostP->Mapping[ToId-1].Name : HostP->Name; | 841 | ToName = ToId ? HostP->Mapping[ToId - 1].Name : HostP->Name; |
957 | ToType = ToId ? "RTA" : "HOST"; | 842 | ToType = ToId ? "RTA" : "HOST"; |
958 | 843 | ||
959 | rio_dprintk (RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", | 844 | rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); |
960 | FromType, FromName, 'A'+FromLink, | 845 | cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); |
961 | ToType, ToName, 'A'+ToLink, | ||
962 | (Change==CONNECT) ? "established" : "disconnected"); | ||
963 | cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", | ||
964 | FromType, FromName, 'A'+FromLink, | ||
965 | ToType, ToName, 'A'+ToLink, | ||
966 | (Change==CONNECT) ? "established" : "disconnected"); | ||
967 | } | 846 | } |
968 | 847 | ||
969 | /* | 848 | /* |
@@ -972,24 +851,21 @@ int Change; | |||
972 | ** Delete and RTA entry from the saved table given to us | 851 | ** Delete and RTA entry from the saved table given to us |
973 | ** by the configuration program. | 852 | ** by the configuration program. |
974 | */ | 853 | */ |
975 | static int | 854 | static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) |
976 | RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) | ||
977 | { | 855 | { |
978 | int entry; | 856 | int entry; |
979 | 857 | ||
980 | /* | 858 | /* |
981 | ** We loop for all entries even after finding an entry and | 859 | ** We loop for all entries even after finding an entry and |
982 | ** zeroing it because we may have two entries to delete if | 860 | ** zeroing it because we may have two entries to delete if |
983 | ** it's a 16 port RTA. | 861 | ** it's a 16 port RTA. |
984 | */ | 862 | */ |
985 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) | 863 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { |
986 | { | 864 | if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) { |
987 | if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) | 865 | bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map)); |
988 | { | 866 | } |
989 | bzero((caddr_t)&p->RIOSavedTable[entry], sizeof(struct Map)); | ||
990 | } | 867 | } |
991 | } | 868 | return 0; |
992 | return 0; | ||
993 | } | 869 | } |
994 | 870 | ||
995 | 871 | ||
@@ -999,64 +875,58 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) | |||
999 | ** Scan the unit links to and return zero if the unit is completely | 875 | ** Scan the unit links to and return zero if the unit is completely |
1000 | ** disconnected. | 876 | ** disconnected. |
1001 | */ | 877 | */ |
1002 | static int | 878 | static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) |
1003 | RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) | ||
1004 | { | 879 | { |
1005 | int link; | 880 | int link; |
1006 | 881 | ||
1007 | 882 | ||
1008 | rio_dprintk (RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); | 883 | rio_dprintk(RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); |
1009 | /* | 884 | /* |
1010 | ** If the slot is tentative and does not belong to the | 885 | ** If the slot is tentative and does not belong to the |
1011 | ** second half of a 16 port RTA then scan to see if | 886 | ** second half of a 16 port RTA then scan to see if |
1012 | ** is disconnected. | 887 | ** is disconnected. |
1013 | */ | 888 | */ |
1014 | for (link = 0; link < LINKS_PER_UNIT; link++) | 889 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
1015 | { | 890 | if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT) |
1016 | if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT) | 891 | break; |
1017 | break; | 892 | } |
1018 | } | 893 | |
1019 | 894 | /* | |
1020 | /* | 895 | ** If not all links are disconnected then we can forget about it. |
1021 | ** If not all links are disconnected then we can forget about it. | 896 | */ |
1022 | */ | 897 | if (link < LINKS_PER_UNIT) |
1023 | if (link < LINKS_PER_UNIT) | 898 | return 1; |
1024 | return 1; | ||
1025 | 899 | ||
1026 | #ifdef NEED_TO_FIX_THIS | 900 | #ifdef NEED_TO_FIX_THIS |
1027 | /* Ok so all the links are disconnected. But we may have only just | 901 | /* Ok so all the links are disconnected. But we may have only just |
1028 | ** made this slot tentative and not yet received a topology update. | 902 | ** made this slot tentative and not yet received a topology update. |
1029 | ** Lets check how long ago we made it tentative. | 903 | ** Lets check how long ago we made it tentative. |
1030 | */ | 904 | */ |
1031 | rio_dprintk (RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); | 905 | rio_dprintk(RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); |
1032 | if (drv_getparm(LBOLT, (ulong_t *) ¤t_time)) | 906 | if (drv_getparm(LBOLT, (ulong_t *) & current_time)) |
1033 | rio_dprintk (RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); | 907 | rio_dprintk(RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); |
1034 | 908 | ||
1035 | elapse_time = current_time - TentTime[unit]; | 909 | elapse_time = current_time - TentTime[unit]; |
1036 | rio_dprintk (RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", | 910 | rio_dprintk(RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); |
1037 | elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); | 911 | if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) { |
1038 | if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) | 912 | rio_dprintk(RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", unit, drv_hztousec(elapse_time)); |
1039 | { | 913 | return 1; |
1040 | rio_dprintk (RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", | 914 | } |
1041 | unit, drv_hztousec(elapse_time)); | ||
1042 | return 1; | ||
1043 | } | ||
1044 | #endif | 915 | #endif |
1045 | 916 | ||
1046 | /* | 917 | /* |
1047 | ** We have found an usable slot. | 918 | ** We have found an usable slot. |
1048 | ** If it is half of a 16 port RTA then delete the other half. | 919 | ** If it is half of a 16 port RTA then delete the other half. |
1049 | */ | 920 | */ |
1050 | if (HostP->Mapping[unit].ID2 != 0) | 921 | if (HostP->Mapping[unit].ID2 != 0) { |
1051 | { | 922 | int nOther = (HostP->Mapping[unit].ID2) - 1; |
1052 | int nOther = (HostP->Mapping[unit].ID2) -1; | 923 | |
1053 | 924 | rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); | |
1054 | rio_dprintk (RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); | 925 | bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map)); |
1055 | bzero((caddr_t)&HostP->Mapping[nOther], sizeof(struct Map)); | 926 | } |
1056 | } | 927 | RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); |
1057 | RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); | ||
1058 | 928 | ||
1059 | return 0; | 929 | return 0; |
1060 | } | 930 | } |
1061 | 931 | ||
1062 | 932 | ||
@@ -1066,150 +936,134 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) | |||
1066 | ** This function scans the given host table for either one | 936 | ** This function scans the given host table for either one |
1067 | ** or two free unit ID's. | 937 | ** or two free unit ID's. |
1068 | */ | 938 | */ |
1069 | int | 939 | int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2) |
1070 | RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) | ||
1071 | { | 940 | { |
1072 | int unit,tempID; | 941 | int unit, tempID; |
1073 | 942 | ||
1074 | /* | ||
1075 | ** Initialise the ID's to MAX_RUP. | ||
1076 | ** We do this to make the loop for setting the ID's as simple as | ||
1077 | ** possible. | ||
1078 | */ | ||
1079 | *pID1 = MAX_RUP; | ||
1080 | if (pID2 != NULL) | ||
1081 | *pID2 = MAX_RUP; | ||
1082 | |||
1083 | /* | ||
1084 | ** Scan all entries of the host mapping table for free slots. | ||
1085 | ** We scan for free slots first and then if that is not successful | ||
1086 | ** we start all over again looking for tentative slots we can re-use. | ||
1087 | */ | ||
1088 | for (unit = 0; unit < MAX_RUP; unit++) | ||
1089 | { | ||
1090 | rio_dprintk (RIO_DEBUG_ROUTE, "Scanning unit %d\n",unit); | ||
1091 | /* | 943 | /* |
1092 | ** If the flags are zero then the slot is empty. | 944 | ** Initialise the ID's to MAX_RUP. |
1093 | */ | 945 | ** We do this to make the loop for setting the ID's as simple as |
1094 | if (HostP->Mapping[unit].Flags == 0) | 946 | ** possible. |
1095 | { | 947 | */ |
1096 | rio_dprintk (RIO_DEBUG_ROUTE, " This slot is empty.\n"); | 948 | *pID1 = MAX_RUP; |
1097 | /* | 949 | if (pID2 != NULL) |
1098 | ** If we haven't allocated the first ID then do it now. | 950 | *pID2 = MAX_RUP; |
1099 | */ | ||
1100 | if (*pID1 == MAX_RUP) | ||
1101 | { | ||
1102 | rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit); | ||
1103 | *pID1 = unit; | ||
1104 | 951 | ||
952 | /* | ||
953 | ** Scan all entries of the host mapping table for free slots. | ||
954 | ** We scan for free slots first and then if that is not successful | ||
955 | ** we start all over again looking for tentative slots we can re-use. | ||
956 | */ | ||
957 | for (unit = 0; unit < MAX_RUP; unit++) { | ||
958 | rio_dprintk(RIO_DEBUG_ROUTE, "Scanning unit %d\n", unit); | ||
1105 | /* | 959 | /* |
1106 | ** If the second ID is not needed then we can return | 960 | ** If the flags are zero then the slot is empty. |
1107 | ** now. | 961 | */ |
1108 | */ | 962 | if (HostP->Mapping[unit].Flags == 0) { |
1109 | if (pID2 == NULL) | 963 | rio_dprintk(RIO_DEBUG_ROUTE, " This slot is empty.\n"); |
1110 | return 0; | 964 | /* |
1111 | } | 965 | ** If we haven't allocated the first ID then do it now. |
1112 | else | 966 | */ |
1113 | { | 967 | if (*pID1 == MAX_RUP) { |
1114 | /* | 968 | rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit); |
1115 | ** Allocate the second slot and return. | 969 | *pID1 = unit; |
1116 | */ | 970 | |
1117 | rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); | 971 | /* |
1118 | *pID2 = unit; | 972 | ** If the second ID is not needed then we can return |
1119 | return 0; | 973 | ** now. |
1120 | } | 974 | */ |
975 | if (pID2 == NULL) | ||
976 | return 0; | ||
977 | } else { | ||
978 | /* | ||
979 | ** Allocate the second slot and return. | ||
980 | */ | ||
981 | rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); | ||
982 | *pID2 = unit; | ||
983 | return 0; | ||
984 | } | ||
985 | } | ||
1121 | } | 986 | } |
1122 | } | ||
1123 | |||
1124 | /* | ||
1125 | ** If we manage to come out of the free slot loop then we | ||
1126 | ** need to start all over again looking for tentative slots | ||
1127 | ** that we can re-use. | ||
1128 | */ | ||
1129 | rio_dprintk (RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); | ||
1130 | for (unit = 0; unit < MAX_RUP; unit++) | ||
1131 | { | ||
1132 | if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || | ||
1133 | (HostP->Mapping[unit].Flags == 0)) && ! | ||
1134 | (HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT )) | ||
1135 | { | ||
1136 | rio_dprintk (RIO_DEBUG_ROUTE, " Slot %d looks promising.\n",unit); | ||
1137 | |||
1138 | if(unit == *pID1) | ||
1139 | { | ||
1140 | rio_dprintk (RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n"); | ||
1141 | continue; | ||
1142 | } | ||
1143 | |||
1144 | /* | ||
1145 | ** Slot is Tentative or Empty, but not a tentative second | ||
1146 | ** slot of a 16 porter. | ||
1147 | ** Attempt to free up this slot (and its parnter if | ||
1148 | ** it is a 16 port slot. The second slot will become | ||
1149 | ** empty after a call to RIOFreeDisconnected so thats why | ||
1150 | ** we look for empty slots above as well). | ||
1151 | */ | ||
1152 | if (HostP->Mapping[unit].Flags != 0) | ||
1153 | if (RIOFreeDisconnected(p, HostP, unit) != 0) | ||
1154 | continue; | ||
1155 | /* | ||
1156 | ** If we haven't allocated the first ID then do it now. | ||
1157 | */ | ||
1158 | if (*pID1 == MAX_RUP) | ||
1159 | { | ||
1160 | rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit); | ||
1161 | *pID1 = unit; | ||
1162 | 987 | ||
1163 | /* | 988 | /* |
1164 | ** Clear out this slot now that we intend to use it. | 989 | ** If we manage to come out of the free slot loop then we |
1165 | */ | 990 | ** need to start all over again looking for tentative slots |
1166 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); | 991 | ** that we can re-use. |
992 | */ | ||
993 | rio_dprintk(RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); | ||
994 | for (unit = 0; unit < MAX_RUP; unit++) { | ||
995 | if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || (HostP->Mapping[unit].Flags == 0)) && !(HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT)) { | ||
996 | rio_dprintk(RIO_DEBUG_ROUTE, " Slot %d looks promising.\n", unit); | ||
997 | |||
998 | if (unit == *pID1) { | ||
999 | rio_dprintk(RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n"); | ||
1000 | continue; | ||
1001 | } | ||
1167 | 1002 | ||
1168 | /* | 1003 | /* |
1169 | ** If the second ID is not needed then we can return | 1004 | ** Slot is Tentative or Empty, but not a tentative second |
1170 | ** now. | 1005 | ** slot of a 16 porter. |
1171 | */ | 1006 | ** Attempt to free up this slot (and its parnter if |
1172 | if (pID2 == NULL) | 1007 | ** it is a 16 port slot. The second slot will become |
1173 | return 0; | 1008 | ** empty after a call to RIOFreeDisconnected so thats why |
1174 | } | 1009 | ** we look for empty slots above as well). |
1175 | else | 1010 | */ |
1176 | { | 1011 | if (HostP->Mapping[unit].Flags != 0) |
1177 | /* | 1012 | if (RIOFreeDisconnected(p, HostP, unit) != 0) |
1178 | ** Allocate the second slot and return. | 1013 | continue; |
1179 | */ | 1014 | /* |
1180 | rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", | 1015 | ** If we haven't allocated the first ID then do it now. |
1181 | unit); | 1016 | */ |
1182 | *pID2 = unit; | 1017 | if (*pID1 == MAX_RUP) { |
1018 | rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit); | ||
1019 | *pID1 = unit; | ||
1183 | 1020 | ||
1184 | /* | 1021 | /* |
1185 | ** Clear out this slot now that we intend to use it. | 1022 | ** Clear out this slot now that we intend to use it. |
1186 | */ | 1023 | */ |
1187 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); | 1024 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); |
1188 | 1025 | ||
1189 | /* At this point under the right(wrong?) conditions | 1026 | /* |
1190 | ** we may have a first unit ID being higher than the | 1027 | ** If the second ID is not needed then we can return |
1191 | ** second unit ID. This is a bad idea if we are about | 1028 | ** now. |
1192 | ** to fill the slots with a 16 port RTA. | 1029 | */ |
1193 | ** Better check and swap them over. | 1030 | if (pID2 == NULL) |
1194 | */ | 1031 | return 0; |
1195 | 1032 | } else { | |
1196 | if (*pID1 > *pID2) | 1033 | /* |
1197 | { | 1034 | ** Allocate the second slot and return. |
1198 | rio_dprintk (RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2); | 1035 | */ |
1199 | tempID = *pID1; | 1036 | rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", unit); |
1200 | *pID1 = *pID2; | 1037 | *pID2 = unit; |
1201 | *pID2 = tempID; | 1038 | |
1039 | /* | ||
1040 | ** Clear out this slot now that we intend to use it. | ||
1041 | */ | ||
1042 | bzero(&HostP->Mapping[unit], sizeof(struct Map)); | ||
1043 | |||
1044 | /* At this point under the right(wrong?) conditions | ||
1045 | ** we may have a first unit ID being higher than the | ||
1046 | ** second unit ID. This is a bad idea if we are about | ||
1047 | ** to fill the slots with a 16 port RTA. | ||
1048 | ** Better check and swap them over. | ||
1049 | */ | ||
1050 | |||
1051 | if (*pID1 > *pID2) { | ||
1052 | rio_dprintk(RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2); | ||
1053 | tempID = *pID1; | ||
1054 | *pID1 = *pID2; | ||
1055 | *pID2 = tempID; | ||
1056 | } | ||
1057 | return 0; | ||
1058 | } | ||
1202 | } | 1059 | } |
1203 | return 0; | ||
1204 | } | ||
1205 | } | 1060 | } |
1206 | } | ||
1207 | 1061 | ||
1208 | /* | 1062 | /* |
1209 | ** If we manage to get to the end of the second loop then we | 1063 | ** If we manage to get to the end of the second loop then we |
1210 | ** can give up and return a failure. | 1064 | ** can give up and return a failure. |
1211 | */ | 1065 | */ |
1212 | return 1; | 1066 | return 1; |
1213 | } | 1067 | } |
1214 | 1068 | ||
1215 | 1069 | ||
diff --git a/drivers/char/rio/riospace.h b/drivers/char/rio/riospace.h index 32b09b0f23aa..534f1f5b9f53 100644 --- a/drivers/char/rio/riospace.h +++ b/drivers/char/rio/riospace.h | |||
@@ -47,9 +47,8 @@ static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2"; | |||
47 | ** In particular, it won't be able to see changes to RIO_SLOTS | 47 | ** In particular, it won't be able to see changes to RIO_SLOTS |
48 | */ | 48 | */ |
49 | 49 | ||
50 | struct Conf | 50 | struct Conf { |
51 | { | 51 | char Locator[24]; |
52 | char Locator[24]; | ||
53 | unsigned int StartupTime; | 52 | unsigned int StartupTime; |
54 | unsigned int SlowCook; | 53 | unsigned int SlowCook; |
55 | unsigned int IntrPollTime; | 54 | unsigned int IntrPollTime; |
@@ -59,8 +58,8 @@ struct Conf | |||
59 | unsigned int HostLoadBase; | 58 | unsigned int HostLoadBase; |
60 | unsigned int XpHz; | 59 | unsigned int XpHz; |
61 | unsigned int XpCps; | 60 | unsigned int XpCps; |
62 | char *XpOn; | 61 | char *XpOn; |
63 | char *XpOff; | 62 | char *XpOff; |
64 | unsigned int MaxXpCps; | 63 | unsigned int MaxXpCps; |
65 | unsigned int MinXpCps; | 64 | unsigned int MinXpCps; |
66 | unsigned int SpinCmds; | 65 | unsigned int SpinCmds; |
@@ -74,7 +73,7 @@ struct Conf | |||
74 | 73 | ||
75 | /* | 74 | /* |
76 | ** Board types - these MUST correspond to product codes! | 75 | ** Board types - these MUST correspond to product codes! |
77 | */ | 76 | */ |
78 | #define RIO_EMPTY 0x0 | 77 | #define RIO_EMPTY 0x0 |
79 | #define RIO_EISA 0x3 | 78 | #define RIO_EISA 0x3 |
80 | #define RIO_RTA_16 0x9 | 79 | #define RIO_RTA_16 0x9 |
@@ -86,18 +85,16 @@ struct Conf | |||
86 | /* | 85 | /* |
87 | ** Board data structure. This is used for configuration info | 86 | ** Board data structure. This is used for configuration info |
88 | */ | 87 | */ |
89 | struct Brd | 88 | struct Brd { |
90 | { | 89 | unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */ |
91 | unsigned char Type; /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */ | 90 | unsigned char Ivec; /* POLLED or ivec number */ |
92 | unsigned char Ivec; /* POLLED or ivec number */ | 91 | unsigned char Mode; /* Control stuff, see below */ |
93 | unsigned char Mode; /* Control stuff, see below */ | ||
94 | }; | 92 | }; |
95 | 93 | ||
96 | struct Board | 94 | struct Board { |
97 | { | 95 | char Locator[RIO_LOCATOR_LEN]; |
98 | char Locator[RIO_LOCATOR_LEN]; | 96 | int NumSlots; |
99 | int NumSlots; | 97 | struct Brd Boards[MAX_RIO_BOARDS]; |
100 | struct Brd Boards[MAX_RIO_BOARDS]; | ||
101 | }; | 98 | }; |
102 | 99 | ||
103 | #define BOOT_FROM_LINK 0x00 | 100 | #define BOOT_FROM_LINK 0x00 |
@@ -158,4 +155,4 @@ struct Board | |||
158 | 155 | ||
159 | #define DBG_ALWAYS 0x80000000 | 156 | #define DBG_ALWAYS 0x80000000 |
160 | 157 | ||
161 | #endif /* __rio_riospace_h__ */ | 158 | #endif /* __rio_riospace_h__ */ |
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index e45bc275907a..42c3dffcbbb2 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c | |||
@@ -91,9 +91,8 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2"; | |||
91 | ** A configuration table has been loaded. It is now up to us | 91 | ** A configuration table has been loaded. It is now up to us |
92 | ** to sort it out and use the information contained therein. | 92 | ** to sort it out and use the information contained therein. |
93 | */ | 93 | */ |
94 | int | 94 | int RIONewTable(p) |
95 | RIONewTable(p) | 95 | struct rio_info *p; |
96 | struct rio_info * p; | ||
97 | { | 96 | { |
98 | int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; | 97 | int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; |
99 | struct Map *MapP; | 98 | struct Map *MapP; |
@@ -103,26 +102,26 @@ struct rio_info * p; | |||
103 | char *cptr; | 102 | char *cptr; |
104 | 103 | ||
105 | /* | 104 | /* |
106 | ** We have been sent a new table to install. We need to break | 105 | ** We have been sent a new table to install. We need to break |
107 | ** it down into little bits and spread it around a bit to see | 106 | ** it down into little bits and spread it around a bit to see |
108 | ** what we have got. | 107 | ** what we have got. |
109 | */ | 108 | */ |
110 | /* | 109 | /* |
111 | ** Things to check: | 110 | ** Things to check: |
112 | ** (things marked 'xx' aren't checked any more!) | 111 | ** (things marked 'xx' aren't checked any more!) |
113 | ** (1) That there are no booted Hosts/RTAs out there. | 112 | ** (1) That there are no booted Hosts/RTAs out there. |
114 | ** (2) That the names are properly formed | 113 | ** (2) That the names are properly formed |
115 | ** (3) That blank entries really are. | 114 | ** (3) That blank entries really are. |
116 | ** xx (4) That hosts mentioned in the table actually exist. xx | 115 | ** xx (4) That hosts mentioned in the table actually exist. xx |
117 | ** (5) That the IDs are unique (per host). | 116 | ** (5) That the IDs are unique (per host). |
118 | ** (6) That host IDs are zero | 117 | ** (6) That host IDs are zero |
119 | ** (7) That port numbers are valid | 118 | ** (7) That port numbers are valid |
120 | ** (8) That port numbers aren't duplicated | 119 | ** (8) That port numbers aren't duplicated |
121 | ** (9) That names aren't duplicated | 120 | ** (9) That names aren't duplicated |
122 | ** xx (10) That hosts that actually exist are mentioned in the table. xx | 121 | ** xx (10) That hosts that actually exist are mentioned in the table. xx |
123 | */ | 122 | */ |
124 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); | 123 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); |
125 | if ( p->RIOSystemUp ) { /* (1) */ | 124 | if (p->RIOSystemUp) { /* (1) */ |
126 | p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; | 125 | p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; |
127 | return -EBUSY; | 126 | return -EBUSY; |
128 | } | 127 | } |
@@ -131,19 +130,19 @@ struct rio_info * p; | |||
131 | p->RIOError.Entry = -1; | 130 | p->RIOError.Entry = -1; |
132 | p->RIOError.Other = -1; | 131 | p->RIOError.Other = -1; |
133 | 132 | ||
134 | for ( Entry=0; Entry<TOTAL_MAP_ENTRIES; Entry++ ) { | 133 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { |
135 | MapP = &p->RIOConnectTable[Entry]; | 134 | MapP = &p->RIOConnectTable[Entry]; |
136 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { | 135 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { |
137 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); | 136 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); |
138 | cptr = MapP->Name; /* (2) */ | 137 | cptr = MapP->Name; /* (2) */ |
139 | cptr[MAX_NAME_LEN-1]='\0'; | 138 | cptr[MAX_NAME_LEN - 1] = '\0'; |
140 | if ( cptr[0]=='\0' ) { | 139 | if (cptr[0] == '\0') { |
141 | bcopy(MapP->RtaUniqueNum?"RTA NN":"HOST NN",MapP->Name,8); | 140 | bcopy(MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", MapP->Name, 8); |
142 | MapP->Name[5] = '0'+Entry/10; | 141 | MapP->Name[5] = '0' + Entry / 10; |
143 | MapP->Name[6] = '0'+Entry%10; | 142 | MapP->Name[6] = '0' + Entry % 10; |
144 | } | 143 | } |
145 | while ( *cptr ) { | 144 | while (*cptr) { |
146 | if ( *cptr<' ' || *cptr>'~' ) { | 145 | if (*cptr < ' ' || *cptr > '~') { |
147 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | 146 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; |
148 | p->RIOError.Entry = Entry; | 147 | p->RIOError.Entry = Entry; |
149 | return -ENXIO; | 148 | return -ENXIO; |
@@ -153,133 +152,119 @@ struct rio_info * p; | |||
153 | } | 152 | } |
154 | 153 | ||
155 | /* | 154 | /* |
156 | ** If the entry saved was a tentative entry then just forget | 155 | ** If the entry saved was a tentative entry then just forget |
157 | ** about it. | 156 | ** about it. |
158 | */ | 157 | */ |
159 | if ( MapP->Flags & SLOT_TENTATIVE ) { | 158 | if (MapP->Flags & SLOT_TENTATIVE) { |
160 | MapP->HostUniqueNum = 0; | 159 | MapP->HostUniqueNum = 0; |
161 | MapP->RtaUniqueNum = 0; | 160 | MapP->RtaUniqueNum = 0; |
162 | continue; | 161 | continue; |
163 | } | 162 | } |
164 | 163 | ||
165 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); | 164 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); |
166 | if ( !MapP->RtaUniqueNum && !MapP->HostUniqueNum ) { /* (3) */ | 165 | if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) { /* (3) */ |
167 | if ( MapP->ID || MapP->SysPort || MapP->Flags ) { | 166 | if (MapP->ID || MapP->SysPort || MapP->Flags) { |
168 | rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name); | 167 | rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name); |
169 | p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; | 168 | p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; |
170 | p->RIOError.Entry = Entry; | 169 | p->RIOError.Entry = Entry; |
171 | return -ENXIO; | 170 | return -ENXIO; |
172 | } | 171 | } |
173 | rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); | 172 | rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); |
174 | continue; | 173 | continue; |
175 | } | 174 | } |
176 | 175 | ||
177 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); | 176 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); |
178 | for ( Host=0; Host<p->RIONumHosts; Host++ ) { /* (4) */ | 177 | for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */ |
179 | if ( p->RIOHosts[Host].UniqueNum==MapP->HostUniqueNum ) { | 178 | if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) { |
180 | HostP = &p->RIOHosts[Host]; | 179 | HostP = &p->RIOHosts[Host]; |
181 | /* | 180 | /* |
182 | ** having done the lookup, we don't really want to do | 181 | ** having done the lookup, we don't really want to do |
183 | ** it again, so hang the host number in a safe place | 182 | ** it again, so hang the host number in a safe place |
184 | */ | 183 | */ |
185 | MapP->Topology[0].Unit = Host; | 184 | MapP->Topology[0].Unit = Host; |
186 | break; | 185 | break; |
187 | } | 186 | } |
188 | } | 187 | } |
189 | 188 | ||
190 | if ( Host >= p->RIONumHosts ) { | 189 | if (Host >= p->RIONumHosts) { |
191 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", | 190 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum); |
192 | MapP->Name, MapP->HostUniqueNum); | ||
193 | MapP->HostUniqueNum = 0; | 191 | MapP->HostUniqueNum = 0; |
194 | /* MapP->RtaUniqueNum = 0; */ | 192 | /* MapP->RtaUniqueNum = 0; */ |
195 | /* MapP->ID = 0; */ | 193 | /* MapP->ID = 0; */ |
196 | /* MapP->Flags = 0; */ | 194 | /* MapP->Flags = 0; */ |
197 | /* MapP->SysPort = 0; */ | 195 | /* MapP->SysPort = 0; */ |
198 | /* MapP->Name[0] = 0; */ | 196 | /* MapP->Name[0] = 0; */ |
199 | continue; | 197 | continue; |
200 | } | 198 | } |
201 | 199 | ||
202 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); | 200 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); |
203 | if ( MapP->RtaUniqueNum ) { /* (5) */ | 201 | if (MapP->RtaUniqueNum) { /* (5) */ |
204 | if ( !MapP->ID ) { | 202 | if (!MapP->ID) { |
205 | rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", | 203 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name); |
206 | MapP->Name); | 204 | p->RIOError.Error = ZERO_RTA_ID; |
207 | p->RIOError.Error = ZERO_RTA_ID; | ||
208 | p->RIOError.Entry = Entry; | 205 | p->RIOError.Entry = Entry; |
209 | return -ENXIO; | 206 | return -ENXIO; |
210 | } | 207 | } |
211 | if ( MapP->ID > MAX_RUP ) { | 208 | if (MapP->ID > MAX_RUP) { |
212 | rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", | 209 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID); |
213 | MapP->Name, MapP->ID); | ||
214 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | 210 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; |
215 | p->RIOError.Entry = Entry; | 211 | p->RIOError.Entry = Entry; |
216 | return -ENXIO; | 212 | return -ENXIO; |
217 | } | 213 | } |
218 | for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { | 214 | for (SubEnt = 0; SubEnt < Entry; SubEnt++) { |
219 | if ( MapP->HostUniqueNum == | 215 | if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID) { |
220 | p->RIOConnectTable[SubEnt].HostUniqueNum && | 216 | rio_dprintk(RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", MapP->Name, p->RIOConnectTable[SubEnt].Name); |
221 | MapP->ID == p->RIOConnectTable[SubEnt].ID ) { | ||
222 | rio_dprintk (RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", | ||
223 | MapP->Name, p->RIOConnectTable[SubEnt].Name); | ||
224 | p->RIOError.Error = DUPLICATED_RTA_ID; | 217 | p->RIOError.Error = DUPLICATED_RTA_ID; |
225 | p->RIOError.Entry = Entry; | 218 | p->RIOError.Entry = Entry; |
226 | p->RIOError.Other = SubEnt; | 219 | p->RIOError.Other = SubEnt; |
227 | return -ENXIO; | 220 | return -ENXIO; |
228 | } | 221 | } |
229 | /* | 222 | /* |
230 | ** If the RtaUniqueNum is the same, it may be looking at both | 223 | ** If the RtaUniqueNum is the same, it may be looking at both |
231 | ** entries for a 16 port RTA, so check the ids | 224 | ** entries for a 16 port RTA, so check the ids |
232 | */ | 225 | */ |
233 | if ((MapP->RtaUniqueNum == | 226 | if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum) |
234 | p->RIOConnectTable[SubEnt].RtaUniqueNum) | 227 | && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { |
235 | && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { | 228 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", MapP->Name); |
236 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n",MapP->Name); | 229 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name); |
237 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", | ||
238 | p->RIOConnectTable[SubEnt].Name); | ||
239 | p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; | 230 | p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; |
240 | p->RIOError.Entry = Entry; | 231 | p->RIOError.Entry = Entry; |
241 | p->RIOError.Other = SubEnt; | 232 | p->RIOError.Other = SubEnt; |
242 | return -ENXIO; | 233 | return -ENXIO; |
243 | } | 234 | } |
244 | } | 235 | } |
245 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); | 236 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); |
246 | /* (7a) */ | 237 | /* (7a) */ |
247 | if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort % PORTS_PER_RTA)) { | 238 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) { |
248 | rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", | 239 | rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", (int) MapP->SysPort, MapP->Name, PORTS_PER_RTA); |
249 | (int)MapP->SysPort,MapP->Name, PORTS_PER_RTA); | ||
250 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 240 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
251 | p->RIOError.Entry = Entry; | 241 | p->RIOError.Entry = Entry; |
252 | return -ENXIO; | 242 | return -ENXIO; |
253 | } | 243 | } |
254 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); | 244 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); |
255 | /* (7b) */ | 245 | /* (7b) */ |
256 | if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort >= RIO_PORTS)) { | 246 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) { |
257 | rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", | 247 | rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name); |
258 | (int)MapP->SysPort, MapP->Name); | ||
259 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 248 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
260 | p->RIOError.Entry = Entry; | 249 | p->RIOError.Entry = Entry; |
261 | return -ENXIO; | 250 | return -ENXIO; |
262 | } | 251 | } |
263 | for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { | 252 | for (SubEnt = 0; SubEnt < Entry; SubEnt++) { |
264 | if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT ) | 253 | if (p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT) |
265 | continue; | 254 | continue; |
266 | if ( p->RIOConnectTable[SubEnt].RtaUniqueNum ) { | 255 | if (p->RIOConnectTable[SubEnt].RtaUniqueNum) { |
267 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); | 256 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); |
268 | /* (8) */ | 257 | /* (8) */ |
269 | if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort == | 258 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort)) { |
270 | p->RIOConnectTable[SubEnt].SysPort) ) { | 259 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, (int) MapP->SysPort); |
271 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", | ||
272 | MapP->Name, p->RIOConnectTable[SubEnt].Name, | ||
273 | (int)MapP->SysPort); | ||
274 | p->RIOError.Error = TTY_NUMBER_IN_USE; | 260 | p->RIOError.Error = TTY_NUMBER_IN_USE; |
275 | p->RIOError.Entry = Entry; | 261 | p->RIOError.Entry = Entry; |
276 | p->RIOError.Other = SubEnt; | 262 | p->RIOError.Other = SubEnt; |
277 | return -ENXIO; | 263 | return -ENXIO; |
278 | } | 264 | } |
279 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); | 265 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); |
280 | if (strcmp(MapP->Name, | 266 | if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ |
281 | p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ | 267 | rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name); |
282 | rio_dprintk (RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name); | ||
283 | p->RIOError.Error = NAME_USED_TWICE; | 268 | p->RIOError.Error = NAME_USED_TWICE; |
284 | p->RIOError.Entry = Entry; | 269 | p->RIOError.Entry = Entry; |
285 | p->RIOError.Other = SubEnt; | 270 | p->RIOError.Other = SubEnt; |
@@ -287,19 +272,16 @@ struct rio_info * p; | |||
287 | } | 272 | } |
288 | } | 273 | } |
289 | } | 274 | } |
290 | } | 275 | } else { /* (6) */ |
291 | else { /* (6) */ | 276 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); |
292 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); | 277 | if (MapP->ID) { |
293 | if ( MapP->ID ) { | 278 | rio_dprintk(RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", MapP->Name); |
294 | rio_dprintk (RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", | ||
295 | MapP->Name); | ||
296 | p->RIOError.Error = HOST_ID_NOT_ZERO; | 279 | p->RIOError.Error = HOST_ID_NOT_ZERO; |
297 | p->RIOError.Entry = Entry; | 280 | p->RIOError.Entry = Entry; |
298 | return -ENXIO; | 281 | return -ENXIO; |
299 | } | 282 | } |
300 | if ( MapP->SysPort != NO_PORT ) { | 283 | if (MapP->SysPort != NO_PORT) { |
301 | rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", | 284 | rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name); |
302 | MapP->Name); | ||
303 | p->RIOError.Error = HOST_SYSPORT_BAD; | 285 | p->RIOError.Error = HOST_SYSPORT_BAD; |
304 | p->RIOError.Entry = Entry; | 286 | p->RIOError.Entry = Entry; |
305 | return -ENXIO; | 287 | return -ENXIO; |
@@ -308,106 +290,101 @@ struct rio_info * p; | |||
308 | } | 290 | } |
309 | 291 | ||
310 | /* | 292 | /* |
311 | ** wow! if we get here then it's a goody! | 293 | ** wow! if we get here then it's a goody! |
312 | */ | 294 | */ |
313 | 295 | ||
314 | /* | 296 | /* |
315 | ** Zero the (old) entries for each host... | 297 | ** Zero the (old) entries for each host... |
316 | */ | 298 | */ |
317 | for ( Host=0; Host<RIO_HOSTS; Host++ ) { | 299 | for (Host = 0; Host < RIO_HOSTS; Host++) { |
318 | for ( Entry=0; Entry<MAX_RUP; Entry++ ) { | 300 | for (Entry = 0; Entry < MAX_RUP; Entry++) { |
319 | bzero((caddr_t)&p->RIOHosts[Host].Mapping[Entry], | 301 | bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map)); |
320 | sizeof(struct Map)); | ||
321 | } | 302 | } |
322 | bzero((caddr_t)&p->RIOHosts[Host].Name[0], | 303 | bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name)); |
323 | sizeof(p->RIOHosts[Host].Name) ); | ||
324 | } | 304 | } |
325 | 305 | ||
326 | /* | 306 | /* |
327 | ** Copy in the new table entries | 307 | ** Copy in the new table entries |
328 | */ | 308 | */ |
329 | for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { | 309 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { |
330 | rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); | 310 | rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); |
331 | MapP = &p->RIOConnectTable[Entry]; | 311 | MapP = &p->RIOConnectTable[Entry]; |
332 | 312 | ||
333 | /* | 313 | /* |
334 | ** Now, if it is an empty slot ignore it! | 314 | ** Now, if it is an empty slot ignore it! |
335 | */ | 315 | */ |
336 | if ( MapP->HostUniqueNum==0 ) | 316 | if (MapP->HostUniqueNum == 0) |
337 | continue; | 317 | continue; |
338 | 318 | ||
339 | /* | 319 | /* |
340 | ** we saved the host number earlier, so grab it back | 320 | ** we saved the host number earlier, so grab it back |
341 | */ | 321 | */ |
342 | HostP = &p->RIOHosts[MapP->Topology[0].Unit]; | 322 | HostP = &p->RIOHosts[MapP->Topology[0].Unit]; |
343 | 323 | ||
344 | /* | 324 | /* |
345 | ** If it is a host, then we only need to fill in the name field. | 325 | ** If it is a host, then we only need to fill in the name field. |
346 | */ | 326 | */ |
347 | if ( MapP->ID==0 ) { | 327 | if (MapP->ID == 0) { |
348 | rio_dprintk (RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); | 328 | rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); |
349 | bcopy(MapP->Name,HostP->Name,MAX_NAME_LEN); | 329 | bcopy(MapP->Name, HostP->Name, MAX_NAME_LEN); |
350 | continue; | 330 | continue; |
351 | } | 331 | } |
352 | 332 | ||
353 | /* | 333 | /* |
354 | ** Its an RTA entry, so fill in the host mapping entries for it | 334 | ** Its an RTA entry, so fill in the host mapping entries for it |
355 | ** and the port mapping entries. Notice that entry zero is for | 335 | ** and the port mapping entries. Notice that entry zero is for |
356 | ** ID one. | 336 | ** ID one. |
357 | */ | 337 | */ |
358 | HostMapP = &HostP->Mapping[MapP->ID-1]; | 338 | HostMapP = &HostP->Mapping[MapP->ID - 1]; |
359 | 339 | ||
360 | if (MapP->Flags & SLOT_IN_USE) { | 340 | if (MapP->Flags & SLOT_IN_USE) { |
361 | rio_dprintk (RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); | 341 | rio_dprintk(RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); |
362 | /* | 342 | /* |
363 | ** structure assign, then sort out the bits we shouldn't have done | 343 | ** structure assign, then sort out the bits we shouldn't have done |
364 | */ | 344 | */ |
365 | *HostMapP = *MapP; | 345 | *HostMapP = *MapP; |
366 | 346 | ||
367 | HostMapP->Flags = SLOT_IN_USE; | 347 | HostMapP->Flags = SLOT_IN_USE; |
368 | if (MapP->Flags & RTA16_SECOND_SLOT) | 348 | if (MapP->Flags & RTA16_SECOND_SLOT) |
369 | HostMapP->Flags |= RTA16_SECOND_SLOT; | 349 | HostMapP->Flags |= RTA16_SECOND_SLOT; |
370 | 350 | ||
371 | RIOReMapPorts(p, HostP, HostMapP ); | 351 | RIOReMapPorts(p, HostP, HostMapP); |
372 | } | 352 | } else { |
373 | else { | 353 | rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name); |
374 | rio_dprintk (RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name); | ||
375 | } | 354 | } |
376 | } | 355 | } |
377 | 356 | ||
378 | for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { | 357 | for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) { |
379 | p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry]; | 358 | p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry]; |
380 | } | 359 | } |
381 | 360 | ||
382 | for ( Host=0; Host<p->RIONumHosts; Host++ ) { | 361 | for (Host = 0; Host < p->RIONumHosts; Host++) { |
383 | for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) { | 362 | for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) { |
384 | p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT; | 363 | p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT; |
385 | p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK; | 364 | p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK; |
386 | } | 365 | } |
387 | for ( Entry=0; Entry<MAX_RUP; Entry++ ) { | 366 | for (Entry = 0; Entry < MAX_RUP; Entry++) { |
388 | for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) { | 367 | for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) { |
389 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = | 368 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT; |
390 | ROUTE_DISCONNECT; | 369 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK; |
391 | p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = | ||
392 | NO_LINK; | ||
393 | } | 370 | } |
394 | } | 371 | } |
395 | if ( !p->RIOHosts[Host].Name[0] ) { | 372 | if (!p->RIOHosts[Host].Name[0]) { |
396 | bcopy("HOST 1",p->RIOHosts[Host].Name,7); | 373 | bcopy("HOST 1", p->RIOHosts[Host].Name, 7); |
397 | p->RIOHosts[Host].Name[5] += Host; | 374 | p->RIOHosts[Host].Name[5] += Host; |
398 | } | 375 | } |
399 | /* | 376 | /* |
400 | ** Check that default name assigned is unique. | 377 | ** Check that default name assigned is unique. |
401 | */ | 378 | */ |
402 | Host1 = Host; | 379 | Host1 = Host; |
403 | NameIsUnique = 0; | 380 | NameIsUnique = 0; |
404 | while (!NameIsUnique) { | 381 | while (!NameIsUnique) { |
405 | NameIsUnique = 1; | 382 | NameIsUnique = 1; |
406 | for ( Host2=0; Host2<p->RIONumHosts; Host2++ ) { | 383 | for (Host2 = 0; Host2 < p->RIONumHosts; Host2++) { |
407 | if (Host2 == Host) | 384 | if (Host2 == Host) |
408 | continue; | 385 | continue; |
409 | if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name) | 386 | if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name) |
410 | == 0) { | 387 | == 0) { |
411 | NameIsUnique = 0; | 388 | NameIsUnique = 0; |
412 | Host1++; | 389 | Host1++; |
413 | if (Host1 >= p->RIONumHosts) | 390 | if (Host1 >= p->RIONumHosts) |
@@ -417,15 +394,14 @@ struct rio_info * p; | |||
417 | } | 394 | } |
418 | } | 395 | } |
419 | /* | 396 | /* |
420 | ** Rename host if name already used. | 397 | ** Rename host if name already used. |
421 | */ | 398 | */ |
422 | if (Host1 != Host) | 399 | if (Host1 != Host) { |
423 | { | 400 | rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); |
424 | rio_dprintk (RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); | 401 | bcopy("HOST 1", p->RIOHosts[Host].Name, 7); |
425 | bcopy("HOST 1",p->RIOHosts[Host].Name,7); | ||
426 | p->RIOHosts[Host].Name[5] += Host1; | 402 | p->RIOHosts[Host].Name[5] += Host1; |
427 | } | 403 | } |
428 | rio_dprintk (RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); | 404 | rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); |
429 | } | 405 | } |
430 | return 0; | 406 | return 0; |
431 | } | 407 | } |
@@ -434,9 +410,8 @@ struct rio_info * p; | |||
434 | ** User process needs the config table - build it from first | 410 | ** User process needs the config table - build it from first |
435 | ** principles. | 411 | ** principles. |
436 | */ | 412 | */ |
437 | int | 413 | int RIOApel(p) |
438 | RIOApel(p) | 414 | struct rio_info *p; |
439 | struct rio_info * p; | ||
440 | { | 415 | { |
441 | int Host; | 416 | int Host; |
442 | int link; | 417 | int link; |
@@ -446,35 +421,34 @@ struct rio_info * p; | |||
446 | struct Host *HostP; | 421 | struct Host *HostP; |
447 | long oldspl; | 422 | long oldspl; |
448 | 423 | ||
449 | disable(oldspl); /* strange but true! */ | 424 | disable(oldspl); /* strange but true! */ |
450 | 425 | ||
451 | rio_dprintk (RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); | 426 | rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); |
452 | 427 | ||
453 | bzero((caddr_t)&p->RIOConnectTable[0], | 428 | bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES); |
454 | sizeof(struct Map) * TOTAL_MAP_ENTRIES ); | ||
455 | 429 | ||
456 | for ( Host=0; Host<RIO_HOSTS; Host++ ) { | 430 | for (Host = 0; Host < RIO_HOSTS; Host++) { |
457 | rio_dprintk (RIO_DEBUG_TABLE, "Processing host %d\n", Host); | 431 | rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host); |
458 | HostP = &p->RIOHosts[Host]; | 432 | HostP = &p->RIOHosts[Host]; |
459 | MapP = &p->RIOConnectTable[Next++]; | 433 | MapP = &p->RIOConnectTable[Next++]; |
460 | MapP->HostUniqueNum = HostP->UniqueNum; | 434 | MapP->HostUniqueNum = HostP->UniqueNum; |
461 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) | 435 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) |
462 | continue; | 436 | continue; |
463 | MapP->RtaUniqueNum = 0; | 437 | MapP->RtaUniqueNum = 0; |
464 | MapP->ID = 0; | 438 | MapP->ID = 0; |
465 | MapP->Flags = SLOT_IN_USE; | 439 | MapP->Flags = SLOT_IN_USE; |
466 | MapP->SysPort = NO_PORT; | 440 | MapP->SysPort = NO_PORT; |
467 | for ( link=0; link<LINKS_PER_UNIT; link++ ) | 441 | for (link = 0; link < LINKS_PER_UNIT; link++) |
468 | MapP->Topology[link] = HostP->Topology[link]; | 442 | MapP->Topology[link] = HostP->Topology[link]; |
469 | bcopy(HostP->Name,MapP->Name,MAX_NAME_LEN); | 443 | bcopy(HostP->Name, MapP->Name, MAX_NAME_LEN); |
470 | for ( Rup=0; Rup<MAX_RUP; Rup++ ) { | 444 | for (Rup = 0; Rup < MAX_RUP; Rup++) { |
471 | if ( HostP->Mapping[Rup].Flags & (SLOT_IN_USE|SLOT_TENTATIVE) ) { | 445 | if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) { |
472 | p->RIOConnectTable[Next] = HostP->Mapping[Rup]; | 446 | p->RIOConnectTable[Next] = HostP->Mapping[Rup]; |
473 | if ( HostP->Mapping[Rup].Flags & SLOT_IN_USE) | 447 | if (HostP->Mapping[Rup].Flags & SLOT_IN_USE) |
474 | p->RIOConnectTable[Next].Flags |= SLOT_IN_USE; | 448 | p->RIOConnectTable[Next].Flags |= SLOT_IN_USE; |
475 | if ( HostP->Mapping[Rup].Flags & SLOT_TENTATIVE) | 449 | if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE) |
476 | p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE; | 450 | p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE; |
477 | if ( HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT ) | 451 | if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT) |
478 | p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT; | 452 | p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT; |
479 | Next++; | 453 | Next++; |
480 | } | 454 | } |
@@ -489,8 +463,7 @@ struct rio_info * p; | |||
489 | ** if the entry is suitably inactive, then we can gob on it and remove | 463 | ** if the entry is suitably inactive, then we can gob on it and remove |
490 | ** it from the table. | 464 | ** it from the table. |
491 | */ | 465 | */ |
492 | int | 466 | int RIODeleteRta(p, MapP) |
493 | RIODeleteRta(p, MapP) | ||
494 | struct rio_info *p; | 467 | struct rio_info *p; |
495 | struct Map *MapP; | 468 | struct Map *MapP; |
496 | { | 469 | { |
@@ -502,110 +475,98 @@ struct Map *MapP; | |||
502 | int work_done = 0; | 475 | int work_done = 0; |
503 | unsigned long lock_flags, sem_flags; | 476 | unsigned long lock_flags, sem_flags; |
504 | 477 | ||
505 | rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", | 478 | rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum); |
506 | MapP->HostUniqueNum, MapP->RtaUniqueNum); | ||
507 | 479 | ||
508 | for ( host=0; host < p->RIONumHosts; host++ ) { | 480 | for (host = 0; host < p->RIONumHosts; host++) { |
509 | HostP = &p->RIOHosts[host]; | 481 | HostP = &p->RIOHosts[host]; |
510 | 482 | ||
511 | rio_spin_lock_irqsave( &HostP->HostLock, lock_flags ); | 483 | rio_spin_lock_irqsave(&HostP->HostLock, lock_flags); |
512 | 484 | ||
513 | if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { | 485 | if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { |
514 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); | 486 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); |
515 | continue; | 487 | continue; |
516 | } | 488 | } |
517 | 489 | ||
518 | for ( entry=0; entry<MAX_RUP; entry++ ) { | 490 | for (entry = 0; entry < MAX_RUP; entry++) { |
519 | if ( MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum ) { | 491 | if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) { |
520 | HostMapP = &HostP->Mapping[entry]; | 492 | HostMapP = &HostP->Mapping[entry]; |
521 | rio_dprintk (RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", | 493 | rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name); |
522 | entry, HostP->Name); | ||
523 | 494 | ||
524 | /* | 495 | /* |
525 | ** Check all four links of the unit are disconnected | 496 | ** Check all four links of the unit are disconnected |
526 | */ | 497 | */ |
527 | for ( link=0; link< LINKS_PER_UNIT; link++ ) { | 498 | for (link = 0; link < LINKS_PER_UNIT; link++) { |
528 | if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) { | 499 | if (HostMapP->Topology[link].Unit != ROUTE_DISCONNECT) { |
529 | rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); | 500 | rio_dprintk(RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); |
530 | p->RIOError.Error = UNIT_IS_IN_USE; | 501 | p->RIOError.Error = UNIT_IS_IN_USE; |
531 | rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags); | 502 | rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags); |
532 | return -EBUSY; | 503 | return -EBUSY; |
533 | } | 504 | } |
534 | } | 505 | } |
535 | /* | 506 | /* |
536 | ** Slot has been allocated, BUT not booted/routed/ | 507 | ** Slot has been allocated, BUT not booted/routed/ |
537 | ** connected/selected or anything else-ed | 508 | ** connected/selected or anything else-ed |
538 | */ | 509 | */ |
539 | SysPort = HostMapP->SysPort; | 510 | SysPort = HostMapP->SysPort; |
540 | 511 | ||
541 | if ( SysPort != NO_PORT ) { | 512 | if (SysPort != NO_PORT) { |
542 | for (port=SysPort; port < SysPort+PORTS_PER_RTA; port++) { | 513 | for (port = SysPort; port < SysPort + PORTS_PER_RTA; port++) { |
543 | PortP = p->RIOPortp[port]; | 514 | PortP = p->RIOPortp[port]; |
544 | rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n"); | 515 | rio_dprintk(RIO_DEBUG_TABLE, "Unmap port\n"); |
545 | 516 | ||
546 | rio_spin_lock_irqsave( &PortP->portSem, sem_flags ); | 517 | rio_spin_lock_irqsave(&PortP->portSem, sem_flags); |
547 | 518 | ||
548 | PortP->Mapped = 0; | 519 | PortP->Mapped = 0; |
549 | 520 | ||
550 | if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) { | 521 | if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) { |
551 | 522 | ||
552 | rio_dprintk (RIO_DEBUG_TABLE, "Gob on port\n"); | 523 | rio_dprintk(RIO_DEBUG_TABLE, "Gob on port\n"); |
553 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | 524 | PortP->TxBufferIn = PortP->TxBufferOut = 0; |
554 | /* What should I do | 525 | /* What should I do |
555 | wakeup( &PortP->TxBufferIn ); | 526 | wakeup( &PortP->TxBufferIn ); |
556 | wakeup( &PortP->TxBufferOut); | 527 | wakeup( &PortP->TxBufferOut); |
557 | */ | 528 | */ |
558 | PortP->InUse = NOT_INUSE; | 529 | PortP->InUse = NOT_INUSE; |
559 | /* What should I do | 530 | /* What should I do |
560 | wakeup( &PortP->InUse ); | 531 | wakeup( &PortP->InUse ); |
561 | signal(PortP->TtyP->t_pgrp,SIGKILL); | 532 | signal(PortP->TtyP->t_pgrp,SIGKILL); |
562 | ttyflush(PortP->TtyP,(FREAD|FWRITE)); | 533 | ttyflush(PortP->TtyP,(FREAD|FWRITE)); |
563 | */ | 534 | */ |
564 | PortP->State |= RIO_CLOSING | RIO_DELETED; | 535 | PortP->State |= RIO_CLOSING | RIO_DELETED; |
565 | } | 536 | } |
566 | 537 | ||
567 | /* | 538 | /* |
568 | ** For the second slot of a 16 port RTA, the | 539 | ** For the second slot of a 16 port RTA, the |
569 | ** driver needs to reset the changes made to | 540 | ** driver needs to reset the changes made to |
570 | ** the phb to port mappings in RIORouteRup. | 541 | ** the phb to port mappings in RIORouteRup. |
571 | */ | 542 | */ |
572 | if (PortP->SecondBlock) { | 543 | if (PortP->SecondBlock) { |
573 | ushort dest_unit = HostMapP->ID; | 544 | ushort dest_unit = HostMapP->ID; |
574 | ushort dest_port = port - SysPort; | 545 | ushort dest_port = port - SysPort; |
575 | WORD *TxPktP; | 546 | WORD *TxPktP; |
576 | PKT *Pkt; | 547 | PKT *Pkt; |
577 | 548 | ||
578 | for (TxPktP = PortP->TxStart; | 549 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { |
579 | TxPktP <= PortP->TxEnd; TxPktP++) { | ||
580 | /* | 550 | /* |
581 | ** *TxPktP is the pointer to the | 551 | ** *TxPktP is the pointer to the |
582 | ** transmit packet on the host card. | 552 | ** transmit packet on the host card. |
583 | ** This needs to be translated into | 553 | ** This needs to be translated into |
584 | ** a 32 bit pointer so it can be | 554 | ** a 32 bit pointer so it can be |
585 | ** accessed from the driver. | 555 | ** accessed from the driver. |
586 | */ | 556 | */ |
587 | Pkt = (PKT *) RIO_PTR(HostP->Caddr, | 557 | Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP)); |
588 | RWORD(*TxPktP)); | 558 | rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port); |
589 | rio_dprintk (RIO_DEBUG_TABLE, | ||
590 | "Tx packet (%x) destination: Old %x:%x New %x:%x\n", | ||
591 | *TxPktP, Pkt->dest_unit, | ||
592 | Pkt->dest_port, dest_unit, dest_port); | ||
593 | WWORD(Pkt->dest_unit, dest_unit); | 559 | WWORD(Pkt->dest_unit, dest_unit); |
594 | WWORD(Pkt->dest_port, dest_port); | 560 | WWORD(Pkt->dest_port, dest_port); |
595 | } | 561 | } |
596 | rio_dprintk (RIO_DEBUG_TABLE, | 562 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port); |
597 | "Port %d phb destination: Old %x:%x New %x:%x\n", | 563 | WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); |
598 | port, PortP->PhbP->destination & 0xff, | ||
599 | (PortP->PhbP->destination >> 8) & 0xff, | ||
600 | dest_unit, dest_port); | ||
601 | WWORD(PortP->PhbP->destination, | ||
602 | dest_unit + (dest_port << 8)); | ||
603 | } | 564 | } |
604 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); | 565 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); |
605 | } | 566 | } |
606 | } | 567 | } |
607 | rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n"); | 568 | rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n"); |
608 | bzero((char *)HostMapP,sizeof(struct Map)); | 569 | bzero((char *) HostMapP, sizeof(struct Map)); |
609 | work_done++; | 570 | work_done++; |
610 | } | 571 | } |
611 | } | 572 | } |
@@ -613,203 +574,178 @@ struct Map *MapP; | |||
613 | } | 574 | } |
614 | 575 | ||
615 | /* XXXXX lock me up */ | 576 | /* XXXXX lock me up */ |
616 | for ( entry=0; entry< TOTAL_MAP_ENTRIES; entry++ ) { | 577 | for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { |
617 | if ( p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) { | 578 | if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { |
618 | bzero((char *)&p->RIOSavedTable[entry],sizeof(struct Map)); | 579 | bzero((char *) &p->RIOSavedTable[entry], sizeof(struct Map)); |
619 | work_done++; | 580 | work_done++; |
620 | } | 581 | } |
621 | if ( p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) { | 582 | if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { |
622 | bzero((char *)&p->RIOConnectTable[entry],sizeof(struct Map)); | 583 | bzero((char *) &p->RIOConnectTable[entry], sizeof(struct Map)); |
623 | work_done++; | 584 | work_done++; |
624 | } | 585 | } |
625 | } | 586 | } |
626 | if ( work_done ) | 587 | if (work_done) |
627 | return 0; | 588 | return 0; |
628 | 589 | ||
629 | rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); | 590 | rio_dprintk(RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); |
630 | p->RIOError.Error = COULDNT_FIND_ENTRY; | 591 | p->RIOError.Error = COULDNT_FIND_ENTRY; |
631 | return -ENXIO; | 592 | return -ENXIO; |
632 | } | 593 | } |
633 | 594 | ||
634 | int RIOAssignRta( struct rio_info *p, struct Map *MapP ) | 595 | int RIOAssignRta(struct rio_info *p, struct Map *MapP) |
635 | { | 596 | { |
636 | int host; | 597 | int host; |
637 | struct Map *HostMapP; | 598 | struct Map *HostMapP; |
638 | char *sptr; | 599 | char *sptr; |
639 | int link; | 600 | int link; |
640 | 601 | ||
641 | 602 | ||
642 | rio_dprintk (RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", | 603 | rio_dprintk(RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort); |
643 | MapP->HostUniqueNum,MapP->RtaUniqueNum, | 604 | |
644 | MapP->ID, (int)MapP->SysPort); | 605 | if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) { |
645 | 606 | rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | |
646 | if ((MapP->ID != (ushort)-1) && | 607 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; |
647 | ((int)MapP->ID < (int)1 || (int)MapP->ID > MAX_RUP )) | 608 | return -EINVAL; |
648 | { | 609 | } |
649 | rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | 610 | if (MapP->RtaUniqueNum == 0) { |
650 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | 611 | rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); |
651 | return -EINVAL; | 612 | p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; |
652 | } | 613 | return -EINVAL; |
653 | if (MapP->RtaUniqueNum == 0) | 614 | } |
654 | { | 615 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) { |
655 | rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); | 616 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n", (int) MapP->SysPort, PORTS_PER_RTA); |
656 | p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; | 617 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
657 | return -EINVAL; | 618 | return -EINVAL; |
658 | } | 619 | } |
659 | if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) ) | 620 | if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) { |
660 | { | 621 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d not valid!\n", (int) MapP->SysPort); |
661 | rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA); | 622 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; |
662 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 623 | return -EINVAL; |
663 | return -EINVAL; | 624 | } |
664 | } | 625 | |
665 | if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) ) | 626 | /* |
666 | { | 627 | ** Copy the name across to the map entry. |
667 | rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort); | 628 | */ |
668 | p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; | 629 | MapP->Name[MAX_NAME_LEN - 1] = '\0'; |
669 | return -EINVAL; | 630 | sptr = MapP->Name; |
670 | } | 631 | while (*sptr) { |
671 | 632 | if (*sptr < ' ' || *sptr > '~') { | |
672 | /* | 633 | rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); |
673 | ** Copy the name across to the map entry. | 634 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; |
674 | */ | 635 | return -EINVAL; |
675 | MapP->Name[MAX_NAME_LEN-1] = '\0'; | ||
676 | sptr = MapP->Name; | ||
677 | while ( *sptr ) | ||
678 | { | ||
679 | if ( *sptr<' ' || *sptr>'~' ) | ||
680 | { | ||
681 | rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); | ||
682 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | ||
683 | return -EINVAL; | ||
684 | } | ||
685 | sptr++; | ||
686 | } | ||
687 | |||
688 | for ( host=0; host < p->RIONumHosts; host++ ) | ||
689 | { | ||
690 | if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) | ||
691 | { | ||
692 | if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) | ||
693 | { | ||
694 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
695 | return -ENXIO; | ||
696 | } | ||
697 | |||
698 | /* | ||
699 | ** Now we have a host we need to allocate an ID | ||
700 | ** if the entry does not already have one. | ||
701 | */ | ||
702 | if (MapP->ID == (ushort)-1) | ||
703 | { | ||
704 | int nNewID; | ||
705 | |||
706 | rio_dprintk (RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", | ||
707 | MapP->Name); | ||
708 | /* | ||
709 | ** The idea here is to allow RTA's to be assigned | ||
710 | ** before they actually appear on the network. | ||
711 | ** This allows the addition of RTA's without having | ||
712 | ** to plug them in. | ||
713 | ** What we do is: | ||
714 | ** - Find a free ID and allocate it to the RTA. | ||
715 | ** - If this map entry is the second half of a | ||
716 | ** 16 port entry then find the other half and | ||
717 | ** make sure the 2 cross reference each other. | ||
718 | */ | ||
719 | if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) | ||
720 | { | ||
721 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
722 | return -EBUSY; | ||
723 | } | ||
724 | MapP->ID = (ushort)nNewID + 1; | ||
725 | rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); | ||
726 | HostMapP = &p->RIOHosts[host].Mapping[nNewID]; | ||
727 | HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; | ||
728 | HostMapP->HostUniqueNum = MapP->HostUniqueNum; | ||
729 | HostMapP->ID = MapP->ID; | ||
730 | for (link = 0; link < LINKS_PER_UNIT; link++) | ||
731 | { | ||
732 | HostMapP->Topology[link].Unit = ROUTE_DISCONNECT; | ||
733 | HostMapP->Topology[link].Link = NO_LINK; | ||
734 | } | ||
735 | if (MapP->Flags & RTA16_SECOND_SLOT) | ||
736 | { | ||
737 | int unit; | ||
738 | |||
739 | for (unit = 0; unit < MAX_RUP; unit++) | ||
740 | if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == | ||
741 | MapP->RtaUniqueNum) | ||
742 | break; | ||
743 | if (unit == MAX_RUP) | ||
744 | { | ||
745 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
746 | return -EBUSY; | ||
747 | } | ||
748 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
749 | HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; | ||
750 | p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; | ||
751 | rio_dprintk (RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", | ||
752 | MapP->ID, | ||
753 | p->RIOHosts[host].Mapping[unit].ID); | ||
754 | } | 636 | } |
755 | } | 637 | sptr++; |
638 | } | ||
639 | |||
640 | for (host = 0; host < p->RIONumHosts; host++) { | ||
641 | if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) { | ||
642 | if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) { | ||
643 | p->RIOError.Error = HOST_NOT_RUNNING; | ||
644 | return -ENXIO; | ||
645 | } | ||
756 | 646 | ||
757 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1]; | 647 | /* |
648 | ** Now we have a host we need to allocate an ID | ||
649 | ** if the entry does not already have one. | ||
650 | */ | ||
651 | if (MapP->ID == (ushort) - 1) { | ||
652 | int nNewID; | ||
758 | 653 | ||
759 | if ( HostMapP->Flags & SLOT_IN_USE ) | 654 | rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name); |
760 | { | 655 | /* |
761 | rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); | 656 | ** The idea here is to allow RTA's to be assigned |
762 | p->RIOError.Error = ID_ALREADY_IN_USE; | 657 | ** before they actually appear on the network. |
763 | return -EBUSY; | 658 | ** This allows the addition of RTA's without having |
764 | } | 659 | ** to plug them in. |
765 | 660 | ** What we do is: | |
766 | /* | 661 | ** - Find a free ID and allocate it to the RTA. |
767 | ** Assign the sys ports and the name, and mark the slot as | 662 | ** - If this map entry is the second half of a |
768 | ** being in use. | 663 | ** 16 port entry then find the other half and |
769 | */ | 664 | ** make sure the 2 cross reference each other. |
770 | HostMapP->SysPort = MapP->SysPort; | 665 | */ |
771 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) | 666 | if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) { |
772 | CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); | 667 | p->RIOError.Error = COULDNT_FIND_ENTRY; |
773 | HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; | 668 | return -EBUSY; |
669 | } | ||
670 | MapP->ID = (ushort) nNewID + 1; | ||
671 | rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); | ||
672 | HostMapP = &p->RIOHosts[host].Mapping[nNewID]; | ||
673 | HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; | ||
674 | HostMapP->HostUniqueNum = MapP->HostUniqueNum; | ||
675 | HostMapP->ID = MapP->ID; | ||
676 | for (link = 0; link < LINKS_PER_UNIT; link++) { | ||
677 | HostMapP->Topology[link].Unit = ROUTE_DISCONNECT; | ||
678 | HostMapP->Topology[link].Link = NO_LINK; | ||
679 | } | ||
680 | if (MapP->Flags & RTA16_SECOND_SLOT) { | ||
681 | int unit; | ||
682 | |||
683 | for (unit = 0; unit < MAX_RUP; unit++) | ||
684 | if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum) | ||
685 | break; | ||
686 | if (unit == MAX_RUP) { | ||
687 | p->RIOError.Error = COULDNT_FIND_ENTRY; | ||
688 | return -EBUSY; | ||
689 | } | ||
690 | HostMapP->Flags |= RTA16_SECOND_SLOT; | ||
691 | HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; | ||
692 | p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; | ||
693 | rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID); | ||
694 | } | ||
695 | } | ||
696 | |||
697 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1]; | ||
698 | |||
699 | if (HostMapP->Flags & SLOT_IN_USE) { | ||
700 | rio_dprintk(RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); | ||
701 | p->RIOError.Error = ID_ALREADY_IN_USE; | ||
702 | return -EBUSY; | ||
703 | } | ||
704 | |||
705 | /* | ||
706 | ** Assign the sys ports and the name, and mark the slot as | ||
707 | ** being in use. | ||
708 | */ | ||
709 | HostMapP->SysPort = MapP->SysPort; | ||
710 | if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) | ||
711 | CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); | ||
712 | HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; | ||
774 | #ifdef NEED_TO_FIX | 713 | #ifdef NEED_TO_FIX |
775 | RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID-1]); | 714 | RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]); |
776 | #endif | 715 | #endif |
777 | if (MapP->Flags & RTA16_SECOND_SLOT) | 716 | if (MapP->Flags & RTA16_SECOND_SLOT) |
778 | HostMapP->Flags |= RTA16_SECOND_SLOT; | 717 | HostMapP->Flags |= RTA16_SECOND_SLOT; |
779 | 718 | ||
780 | RIOReMapPorts( p, &p->RIOHosts[host], HostMapP ); | 719 | RIOReMapPorts(p, &p->RIOHosts[host], HostMapP); |
781 | /* | 720 | /* |
782 | ** Adjust 2nd block of 8 phbs | 721 | ** Adjust 2nd block of 8 phbs |
783 | */ | 722 | */ |
784 | if (MapP->Flags & RTA16_SECOND_SLOT) | 723 | if (MapP->Flags & RTA16_SECOND_SLOT) |
785 | RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1); | 724 | RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1); |
786 | 725 | ||
787 | if ( HostMapP->SysPort != NO_PORT ) | 726 | if (HostMapP->SysPort != NO_PORT) { |
788 | { | 727 | if (HostMapP->SysPort < p->RIOFirstPortsBooted) |
789 | if ( HostMapP->SysPort < p->RIOFirstPortsBooted ) | 728 | p->RIOFirstPortsBooted = HostMapP->SysPort; |
790 | p->RIOFirstPortsBooted = HostMapP->SysPort; | 729 | if (HostMapP->SysPort > p->RIOLastPortsBooted) |
791 | if ( HostMapP->SysPort > p->RIOLastPortsBooted ) | 730 | p->RIOLastPortsBooted = HostMapP->SysPort; |
792 | p->RIOLastPortsBooted = HostMapP->SysPort; | 731 | } |
793 | } | 732 | if (MapP->Flags & RTA16_SECOND_SLOT) |
794 | if (MapP->Flags & RTA16_SECOND_SLOT) | 733 | rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name); |
795 | rio_dprintk (RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", | 734 | else |
796 | p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name); | 735 | rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); |
797 | else | 736 | return 0; |
798 | rio_dprintk (RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); | 737 | } |
799 | return 0; | ||
800 | } | 738 | } |
801 | } | 739 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; |
802 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; | 740 | rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); |
803 | rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); | 741 | return -ENXIO; |
804 | return -ENXIO; | ||
805 | } | 742 | } |
806 | 743 | ||
807 | 744 | ||
808 | int | 745 | int RIOReMapPorts(p, HostP, HostMapP) |
809 | RIOReMapPorts(p, HostP, HostMapP) | 746 | struct rio_info *p; |
810 | struct rio_info * p; | ||
811 | struct Host *HostP; | 747 | struct Host *HostP; |
812 | struct Map *HostMapP; | 748 | struct Map *HostMapP; |
813 | { | 749 | { |
814 | register struct Port *PortP; | 750 | register struct Port *PortP; |
815 | uint SubEnt; | 751 | uint SubEnt; |
@@ -819,135 +755,127 @@ struct Map *HostMapP; | |||
819 | unsigned long flags; | 755 | unsigned long flags; |
820 | 756 | ||
821 | #ifdef CHECK | 757 | #ifdef CHECK |
822 | CheckHostP( HostP ); | 758 | CheckHostP(HostP); |
823 | CheckHostMapP( HostMapP ); | 759 | CheckHostMapP(HostMapP); |
824 | #endif | 760 | #endif |
825 | 761 | ||
826 | rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int)HostMapP->SysPort, HostMapP->ID); | 762 | rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); |
827 | 763 | ||
828 | /* | 764 | /* |
829 | ** We need to tell the UnixRups which sysport the rup corresponds to | 765 | ** We need to tell the UnixRups which sysport the rup corresponds to |
830 | */ | 766 | */ |
831 | HostP->UnixRups[HostMapP->ID-1].BaseSysPort = HostMapP->SysPort; | 767 | HostP->UnixRups[HostMapP->ID - 1].BaseSysPort = HostMapP->SysPort; |
832 | 768 | ||
833 | if ( HostMapP->SysPort == NO_PORT ) | 769 | if (HostMapP->SysPort == NO_PORT) |
834 | return(0); | 770 | return (0); |
835 | 771 | ||
836 | RtaType = GetUnitType(HostMapP->RtaUniqueNum); | 772 | RtaType = GetUnitType(HostMapP->RtaUniqueNum); |
837 | rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", | 773 | rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1); |
838 | (int)HostMapP->SysPort, (int)HostMapP->SysPort+PORTS_PER_RTA-1); | ||
839 | 774 | ||
840 | /* | 775 | /* |
841 | ** now map each of its eight ports | 776 | ** now map each of its eight ports |
842 | */ | 777 | */ |
843 | for ( SubEnt=0; SubEnt<PORTS_PER_RTA; SubEnt++) { | 778 | for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) { |
844 | rio_dprintk (RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", | 779 | rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort); |
845 | SubEnt, (int)HostMapP->SysPort); | 780 | SysPort = HostMapP->SysPort + SubEnt; /* portnumber within system */ |
846 | SysPort = HostMapP->SysPort+SubEnt; /* portnumber within system */ | 781 | /* portnumber on host */ |
847 | /* portnumber on host */ | 782 | |
848 | 783 | HostPort = (HostMapP->ID - 1) * PORTS_PER_RTA + SubEnt; | |
849 | HostPort = (HostMapP->ID-1)*PORTS_PER_RTA+SubEnt; | 784 | |
850 | 785 | rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); | |
851 | rio_dprintk (RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); | ||
852 | PortP = p->RIOPortp[SysPort]; | 786 | PortP = p->RIOPortp[SysPort]; |
853 | #if 0 | 787 | #if 0 |
854 | PortP->TtyP = &p->channel[SysPort]; | 788 | PortP->TtyP = &p->channel[SysPort]; |
855 | #endif | 789 | #endif |
856 | rio_dprintk (RIO_DEBUG_TABLE, "Map port\n"); | 790 | rio_dprintk(RIO_DEBUG_TABLE, "Map port\n"); |
857 | 791 | ||
858 | /* | 792 | /* |
859 | ** Point at all the real neat data structures | 793 | ** Point at all the real neat data structures |
860 | */ | 794 | */ |
861 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 795 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
862 | PortP->HostP = HostP; | 796 | PortP->HostP = HostP; |
863 | PortP->Caddr = HostP->Caddr; | 797 | PortP->Caddr = HostP->Caddr; |
864 | 798 | ||
865 | /* | 799 | /* |
866 | ** The PhbP cannot be filled in yet | 800 | ** The PhbP cannot be filled in yet |
867 | ** unless the host has been booted | 801 | ** unless the host has been booted |
868 | */ | 802 | */ |
869 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { | 803 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { |
870 | struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; | 804 | struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; |
871 | PortP->TxAdd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_add)); | 805 | PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add)); |
872 | PortP->TxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_start)); | 806 | PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start)); |
873 | PortP->TxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_end)); | 807 | PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end)); |
874 | PortP->RxRemove=(WORD *)RIO_PTR(HostP->Caddr, | 808 | PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove)); |
875 | RWORD(PhbP->rx_remove)); | 809 | PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start)); |
876 | PortP->RxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_start)); | 810 | PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end)); |
877 | PortP->RxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_end)); | 811 | } else |
878 | } | ||
879 | else | ||
880 | PortP->PhbP = NULL; | 812 | PortP->PhbP = NULL; |
881 | 813 | ||
882 | /* | 814 | /* |
883 | ** port related flags | 815 | ** port related flags |
884 | */ | 816 | */ |
885 | PortP->HostPort = HostPort; | 817 | PortP->HostPort = HostPort; |
886 | /* | 818 | /* |
887 | ** For each part of a 16 port RTA, RupNum is ID - 1. | 819 | ** For each part of a 16 port RTA, RupNum is ID - 1. |
888 | */ | 820 | */ |
889 | PortP->RupNum = HostMapP->ID - 1; | 821 | PortP->RupNum = HostMapP->ID - 1; |
890 | if (HostMapP->Flags & RTA16_SECOND_SLOT) { | 822 | if (HostMapP->Flags & RTA16_SECOND_SLOT) { |
891 | PortP->ID2 = HostMapP->ID2 - 1; | 823 | PortP->ID2 = HostMapP->ID2 - 1; |
892 | PortP->SecondBlock = TRUE; | 824 | PortP->SecondBlock = TRUE; |
893 | } | 825 | } else { |
894 | else { | 826 | PortP->ID2 = 0; |
895 | PortP->ID2 = 0; | 827 | PortP->SecondBlock = FALSE; |
896 | PortP->SecondBlock = FALSE; | ||
897 | } | 828 | } |
898 | PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; | 829 | PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; |
899 | 830 | ||
900 | /* | 831 | /* |
901 | ** If the port was already mapped then thats all we need to do. | 832 | ** If the port was already mapped then thats all we need to do. |
902 | */ | 833 | */ |
903 | if (PortP->Mapped) { | 834 | if (PortP->Mapped) { |
904 | rio_spin_unlock_irqrestore( &PortP->portSem, flags); | 835 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
905 | continue; | 836 | continue; |
906 | } | 837 | } else |
907 | else HostMapP->Flags &= ~RTA_NEWBOOT; | 838 | HostMapP->Flags &= ~RTA_NEWBOOT; |
908 | 839 | ||
909 | PortP->State = 0; | 840 | PortP->State = 0; |
910 | PortP->Config = 0; | 841 | PortP->Config = 0; |
911 | /* | 842 | /* |
912 | ** Check out the module type - if it is special (read only etc.) | 843 | ** Check out the module type - if it is special (read only etc.) |
913 | ** then we need to set flags in the PortP->Config. | 844 | ** then we need to set flags in the PortP->Config. |
914 | ** Note: For 16 port RTA, all ports are of the same type. | 845 | ** Note: For 16 port RTA, all ports are of the same type. |
915 | */ | 846 | */ |
916 | if (RtaType == TYPE_RTA16) { | 847 | if (RtaType == TYPE_RTA16) { |
917 | PortP->Config |= p->RIOModuleTypes[HostP->UnixRups | 848 | PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE]; |
918 | [HostMapP->ID-1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE]; | ||
919 | } else { | 849 | } else { |
920 | if ( SubEnt < PORTS_PER_MODULE ) | 850 | if (SubEnt < PORTS_PER_MODULE) |
921 | PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups | 851 | PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; |
922 | [HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; | ||
923 | else | 852 | else |
924 | PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups | 853 | PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; |
925 | [HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE]; | ||
926 | } | 854 | } |
927 | 855 | ||
928 | /* | 856 | /* |
929 | ** more port related flags | 857 | ** more port related flags |
930 | */ | 858 | */ |
931 | PortP->PortState = 0; | 859 | PortP->PortState = 0; |
932 | PortP->ModemLines = 0; | 860 | PortP->ModemLines = 0; |
933 | PortP->ModemState = 0; | 861 | PortP->ModemState = 0; |
934 | PortP->CookMode = COOK_WELL; | 862 | PortP->CookMode = COOK_WELL; |
935 | PortP->ParamSem = 0; | 863 | PortP->ParamSem = 0; |
936 | PortP->FlushCmdBodge= 0; | 864 | PortP->FlushCmdBodge = 0; |
937 | PortP->WflushFlag = 0; | 865 | PortP->WflushFlag = 0; |
938 | PortP->MagicFlags = 0; | 866 | PortP->MagicFlags = 0; |
939 | PortP->Lock = 0; | 867 | PortP->Lock = 0; |
940 | PortP->Store = 0; | 868 | PortP->Store = 0; |
941 | PortP->FirstOpen = 1; | 869 | PortP->FirstOpen = 1; |
942 | 870 | ||
943 | /* | 871 | /* |
944 | ** Buffers 'n things | 872 | ** Buffers 'n things |
945 | */ | 873 | */ |
946 | PortP->RxDataStart = 0; | 874 | PortP->RxDataStart = 0; |
947 | PortP->Cor2Copy = 0; | 875 | PortP->Cor2Copy = 0; |
948 | PortP->Name = &HostMapP->Name[0]; | 876 | PortP->Name = &HostMapP->Name[0]; |
949 | #ifdef STATS | 877 | #ifdef STATS |
950 | bzero( (caddr_t)&PortP->Stat, sizeof(struct RIOStats) ); | 878 | bzero((caddr_t) & PortP->Stat, sizeof(struct RIOStats)); |
951 | #endif | 879 | #endif |
952 | PortP->statsGather = 0; | 880 | PortP->statsGather = 0; |
953 | PortP->txchars = 0; | 881 | PortP->txchars = 0; |
@@ -955,90 +883,87 @@ struct Map *HostMapP; | |||
955 | PortP->opens = 0; | 883 | PortP->opens = 0; |
956 | PortP->closes = 0; | 884 | PortP->closes = 0; |
957 | PortP->ioctls = 0; | 885 | PortP->ioctls = 0; |
958 | if ( PortP->TxRingBuffer ) | 886 | if (PortP->TxRingBuffer) |
959 | bzero( PortP->TxRingBuffer, p->RIOBufferSize ); | 887 | bzero(PortP->TxRingBuffer, p->RIOBufferSize); |
960 | else if ( p->RIOBufferSize ) { | 888 | else if (p->RIOBufferSize) { |
961 | PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); | 889 | PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); |
962 | bzero( PortP->TxRingBuffer, p->RIOBufferSize ); | 890 | bzero(PortP->TxRingBuffer, p->RIOBufferSize); |
963 | } | 891 | } |
964 | PortP->TxBufferOut = 0; | 892 | PortP->TxBufferOut = 0; |
965 | PortP->TxBufferIn = 0; | 893 | PortP->TxBufferIn = 0; |
966 | PortP->Debug = 0; | 894 | PortP->Debug = 0; |
967 | /* | 895 | /* |
968 | ** LastRxTgl stores the state of the rx toggle bit for this | 896 | ** LastRxTgl stores the state of the rx toggle bit for this |
969 | ** port, to be compared with the state of the next pkt received. | 897 | ** port, to be compared with the state of the next pkt received. |
970 | ** If the same, we have received the same rx pkt from the RTA | 898 | ** If the same, we have received the same rx pkt from the RTA |
971 | ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. | 899 | ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. |
972 | */ | 900 | */ |
973 | PortP->LastRxTgl = ~(uchar)PHB_RX_TGL; | 901 | PortP->LastRxTgl = ~(uchar) PHB_RX_TGL; |
974 | 902 | ||
975 | /* | 903 | /* |
976 | ** and mark the port as usable | 904 | ** and mark the port as usable |
977 | */ | 905 | */ |
978 | PortP->Mapped = 1; | 906 | PortP->Mapped = 1; |
979 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 907 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
980 | } | 908 | } |
981 | if ( HostMapP->SysPort < p->RIOFirstPortsMapped ) | 909 | if (HostMapP->SysPort < p->RIOFirstPortsMapped) |
982 | p->RIOFirstPortsMapped = HostMapP->SysPort; | 910 | p->RIOFirstPortsMapped = HostMapP->SysPort; |
983 | if ( HostMapP->SysPort > p->RIOLastPortsMapped ) | 911 | if (HostMapP->SysPort > p->RIOLastPortsMapped) |
984 | p->RIOLastPortsMapped = HostMapP->SysPort; | 912 | p->RIOLastPortsMapped = HostMapP->SysPort; |
985 | 913 | ||
986 | return 0; | 914 | return 0; |
987 | } | 915 | } |
988 | 916 | ||
989 | int | 917 | int RIOChangeName(p, MapP) |
990 | RIOChangeName(p, MapP) | ||
991 | struct rio_info *p; | 918 | struct rio_info *p; |
992 | struct Map* MapP; | 919 | struct Map *MapP; |
993 | { | 920 | { |
994 | int host; | 921 | int host; |
995 | struct Map *HostMapP; | 922 | struct Map *HostMapP; |
996 | char *sptr; | 923 | char *sptr; |
997 | 924 | ||
998 | rio_dprintk (RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", | 925 | rio_dprintk(RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort); |
999 | MapP->HostUniqueNum,MapP->RtaUniqueNum, | ||
1000 | MapP->ID, (int)MapP->SysPort); | ||
1001 | 926 | ||
1002 | if ( MapP->ID > MAX_RUP ) { | 927 | if (MapP->ID > MAX_RUP) { |
1003 | rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); | 928 | rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); |
1004 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; | 929 | p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; |
1005 | return -EINVAL; | 930 | return -EINVAL; |
1006 | } | 931 | } |
1007 | 932 | ||
1008 | MapP->Name[MAX_NAME_LEN-1] = '\0'; | 933 | MapP->Name[MAX_NAME_LEN - 1] = '\0'; |
1009 | sptr = MapP->Name; | 934 | sptr = MapP->Name; |
1010 | 935 | ||
1011 | while ( *sptr ) { | 936 | while (*sptr) { |
1012 | if ( *sptr<' ' || *sptr>'~' ) { | 937 | if (*sptr < ' ' || *sptr > '~') { |
1013 | rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); | 938 | rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); |
1014 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; | 939 | p->RIOError.Error = BAD_CHARACTER_IN_NAME; |
1015 | return -EINVAL; | 940 | return -EINVAL; |
1016 | } | 941 | } |
1017 | sptr++; | 942 | sptr++; |
1018 | } | 943 | } |
1019 | 944 | ||
1020 | for ( host=0; host < p->RIONumHosts; host++ ) { | 945 | for (host = 0; host < p->RIONumHosts; host++) { |
1021 | if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) { | 946 | if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) { |
1022 | if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) { | 947 | if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) { |
1023 | p->RIOError.Error = HOST_NOT_RUNNING; | 948 | p->RIOError.Error = HOST_NOT_RUNNING; |
1024 | return -ENXIO; | 949 | return -ENXIO; |
1025 | } | 950 | } |
1026 | if ( MapP->ID==0 ) { | 951 | if (MapP->ID == 0) { |
1027 | CCOPY( MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN ); | 952 | CCOPY(MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN); |
1028 | return 0; | 953 | return 0; |
1029 | } | 954 | } |
1030 | 955 | ||
1031 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1]; | 956 | HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1]; |
1032 | 957 | ||
1033 | if ( HostMapP->RtaUniqueNum != MapP->RtaUniqueNum ) { | 958 | if (HostMapP->RtaUniqueNum != MapP->RtaUniqueNum) { |
1034 | p->RIOError.Error = RTA_NUMBER_WRONG; | 959 | p->RIOError.Error = RTA_NUMBER_WRONG; |
1035 | return -ENXIO; | 960 | return -ENXIO; |
1036 | } | 961 | } |
1037 | CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); | 962 | CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); |
1038 | return 0; | 963 | return 0; |
1039 | } | 964 | } |
1040 | } | 965 | } |
1041 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; | 966 | p->RIOError.Error = UNKNOWN_HOST_NUMBER; |
1042 | rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); | 967 | rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); |
1043 | return -ENXIO; | 968 | return -ENXIO; |
1044 | } | 969 | } |
diff --git a/drivers/char/rio/riotime.h b/drivers/char/rio/riotime.h index 66d52bc0549b..35e01cd103d0 100644 --- a/drivers/char/rio/riotime.h +++ b/drivers/char/rio/riotime.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | #ifndef lint | 41 | #ifndef lint |
42 | #ifdef SCCS | 42 | #ifdef SCCS |
43 | static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1" ; | 43 | static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1"; |
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
46 | 46 | ||
@@ -52,7 +52,7 @@ static char *_rio_riotime_h_sccs = "@(#)riotime.h 1.1" ; | |||
52 | /************************************** | 52 | /************************************** |
53 | * Convert a RIO tick (1/10th second) | 53 | * Convert a RIO tick (1/10th second) |
54 | * into transputer low priority ticks | 54 | * into transputer low priority ticks |
55 | *************************************/ | 55 | *************************************/ |
56 | #define RioTimeToLow(time) (time*(100000 / 64)) | 56 | #define RioTimeToLow(time) (time*(100000 / 64)) |
57 | #define RioLowToTime(time) ((time*64)/100000) | 57 | #define RioLowToTime(time) ((time*64)/100000) |
58 | 58 | ||
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 78a321afdf4f..5894a25b0113 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c | |||
@@ -90,21 +90,19 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; | |||
90 | #include "sam.h" | 90 | #include "sam.h" |
91 | 91 | ||
92 | #if 0 | 92 | #if 0 |
93 | static void ttyseth_pv(struct Port *, struct ttystatics *, | 93 | static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int); |
94 | struct termios *sg, int); | ||
95 | #endif | 94 | #endif |
96 | 95 | ||
97 | static void RIOClearUp(struct Port *PortP); | 96 | static void RIOClearUp(struct Port *PortP); |
98 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, | 97 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); |
99 | int command, int len, int arg); | ||
100 | 98 | ||
101 | #if 0 | 99 | #if 0 |
102 | static int RIOCookMode(struct ttystatics *); | 100 | static int RIOCookMode(struct ttystatics *); |
103 | #endif | 101 | #endif |
104 | 102 | ||
105 | extern int conv_vb[]; /* now defined in ttymgr.c */ | 103 | extern int conv_vb[]; /* now defined in ttymgr.c */ |
106 | extern int conv_bv[]; /* now defined in ttymgr.c */ | 104 | extern int conv_bv[]; /* now defined in ttymgr.c */ |
107 | 105 | ||
108 | /* | 106 | /* |
109 | ** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support | 107 | ** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support |
110 | ** | 108 | ** |
@@ -117,27 +115,25 @@ extern int conv_bv[]; /* now defined in ttymgr.c */ | |||
117 | #endif | 115 | #endif |
118 | 116 | ||
119 | #ifdef NEED_THIS2 | 117 | #ifdef NEED_THIS2 |
120 | static struct old_sgttyb | 118 | static struct old_sgttyb default_sg = { |
121 | default_sg = | 119 | B19200, B19200, /* input and output speed */ |
122 | { | 120 | 'H' - '@', /* erase char */ |
123 | B19200, B19200, /* input and output speed */ | 121 | -1, /* 2nd erase char */ |
124 | 'H' - '@', /* erase char */ | 122 | 'U' - '@', /* kill char */ |
125 | -1, /* 2nd erase char */ | 123 | ECHO | CRMOD, /* mode */ |
126 | 'U' - '@', /* kill char */ | 124 | 'C' - '@', /* interrupt character */ |
127 | ECHO | CRMOD, /* mode */ | 125 | '\\' - '@', /* quit char */ |
128 | 'C' - '@', /* interrupt character */ | 126 | 'Q' - '@', /* start char */ |
129 | '\\' - '@', /* quit char */ | 127 | 'S' - '@', /* stop char */ |
130 | 'Q' - '@', /* start char */ | 128 | 'D' - '@', /* EOF */ |
131 | 'S' - '@', /* stop char */ | 129 | -1, /* brk */ |
132 | 'D' - '@', /* EOF */ | 130 | (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ |
133 | -1, /* brk */ | 131 | 'Z' - '@', /* process stop */ |
134 | (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ | 132 | 'Y' - '@', /* delayed stop */ |
135 | 'Z' - '@', /* process stop */ | 133 | 'R' - '@', /* reprint line */ |
136 | 'Y' - '@', /* delayed stop */ | 134 | 'O' - '@', /* flush output */ |
137 | 'R' - '@', /* reprint line */ | 135 | 'W' - '@', /* word erase */ |
138 | 'O' - '@', /* flush output */ | 136 | 'V' - '@' /* literal next char */ |
139 | 'W' - '@', /* word erase */ | ||
140 | 'V' - '@' /* literal next char */ | ||
141 | }; | 137 | }; |
142 | #endif | 138 | #endif |
143 | 139 | ||
@@ -145,62 +141,59 @@ default_sg = | |||
145 | extern struct rio_info *p; | 141 | extern struct rio_info *p; |
146 | 142 | ||
147 | 143 | ||
148 | int | 144 | int riotopen(struct tty_struct *tty, struct file *filp) |
149 | riotopen(struct tty_struct * tty, struct file * filp) | ||
150 | { | 145 | { |
151 | register uint SysPort; | 146 | register uint SysPort; |
152 | int Modem; | 147 | int Modem; |
153 | int repeat_this = 250; | 148 | int repeat_this = 250; |
154 | struct Port *PortP; /* pointer to the port structure */ | 149 | struct Port *PortP; /* pointer to the port structure */ |
155 | unsigned long flags; | 150 | unsigned long flags; |
156 | int retval = 0; | 151 | int retval = 0; |
157 | 152 | ||
158 | func_enter (); | 153 | func_enter(); |
159 | 154 | ||
160 | /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close | 155 | /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close |
161 | is going to oops. | 156 | is going to oops. |
162 | */ | 157 | */ |
163 | tty->driver_data = NULL; | 158 | tty->driver_data = NULL; |
164 | 159 | ||
165 | SysPort = rio_minor(tty); | 160 | SysPort = rio_minor(tty); |
166 | Modem = rio_ismodem(tty); | 161 | Modem = rio_ismodem(tty); |
167 | 162 | ||
168 | if ( p->RIOFailed ) { | 163 | if (p->RIOFailed) { |
169 | rio_dprintk (RIO_DEBUG_TTY, "System initialisation failed\n"); | 164 | rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n"); |
170 | pseterr(ENXIO); | 165 | pseterr(ENXIO); |
171 | func_exit (); | 166 | func_exit(); |
172 | return -ENXIO; | 167 | return -ENXIO; |
173 | } | 168 | } |
174 | 169 | ||
175 | rio_dprintk (RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", | 170 | rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped); |
176 | SysPort, Modem ? "Modem" : "tty", | ||
177 | p->RIOPortp[SysPort]->Mapped); | ||
178 | 171 | ||
179 | /* | 172 | /* |
180 | ** Validate that we have received a legitimate request. | 173 | ** Validate that we have received a legitimate request. |
181 | ** Currently, just check that we are opening a port on | 174 | ** Currently, just check that we are opening a port on |
182 | ** a host card that actually exists, and that the port | 175 | ** a host card that actually exists, and that the port |
183 | ** has been mapped onto a host. | 176 | ** has been mapped onto a host. |
184 | */ | 177 | */ |
185 | if (SysPort >= RIO_PORTS) { /* out of range ? */ | 178 | if (SysPort >= RIO_PORTS) { /* out of range ? */ |
186 | rio_dprintk (RIO_DEBUG_TTY, "Illegal port number %d\n",SysPort); | 179 | rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort); |
187 | pseterr(ENXIO); | 180 | pseterr(ENXIO); |
188 | func_exit(); | 181 | func_exit(); |
189 | return -ENXIO; | 182 | return -ENXIO; |
190 | } | 183 | } |
191 | 184 | ||
192 | /* | 185 | /* |
193 | ** Grab pointer to the port stucture | 186 | ** Grab pointer to the port stucture |
194 | */ | 187 | */ |
195 | PortP = p->RIOPortp[SysPort]; /* Get control struc */ | 188 | PortP = p->RIOPortp[SysPort]; /* Get control struc */ |
196 | rio_dprintk (RIO_DEBUG_TTY, "PortP: %p\n", PortP); | 189 | rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP); |
197 | if ( !PortP->Mapped ) { /* we aren't mapped yet! */ | 190 | if (!PortP->Mapped) { /* we aren't mapped yet! */ |
198 | /* | 191 | /* |
199 | ** The system doesn't know which RTA this port | 192 | ** The system doesn't know which RTA this port |
200 | ** corresponds to. | 193 | ** corresponds to. |
201 | */ | 194 | */ |
202 | rio_dprintk (RIO_DEBUG_TTY, "port not mapped into system\n"); | 195 | rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n"); |
203 | func_exit (); | 196 | func_exit(); |
204 | pseterr(ENXIO); | 197 | pseterr(ENXIO); |
205 | return -ENXIO; | 198 | return -ENXIO; |
206 | } | 199 | } |
@@ -210,132 +203,131 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
210 | PortP->gs.tty = tty; | 203 | PortP->gs.tty = tty; |
211 | PortP->gs.count++; | 204 | PortP->gs.count++; |
212 | 205 | ||
213 | rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n", | 206 | rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); |
214 | PortP->gs.xmit_cnt); | ||
215 | 207 | ||
216 | retval = gs_init_port (&PortP->gs); | 208 | retval = gs_init_port(&PortP->gs); |
217 | if (retval) { | 209 | if (retval) { |
218 | PortP->gs.count--; | 210 | PortP->gs.count--; |
219 | return -ENXIO; | 211 | return -ENXIO; |
220 | } | 212 | } |
221 | /* | 213 | /* |
222 | ** If the host hasn't been booted yet, then | 214 | ** If the host hasn't been booted yet, then |
223 | ** fail | 215 | ** fail |
224 | */ | 216 | */ |
225 | if ( (PortP->HostP->Flags & RUN_STATE) != RC_RUNNING ) { | 217 | if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) { |
226 | rio_dprintk (RIO_DEBUG_TTY, "Host not running\n"); | 218 | rio_dprintk(RIO_DEBUG_TTY, "Host not running\n"); |
227 | pseterr(ENXIO); | 219 | pseterr(ENXIO); |
228 | func_exit (); | 220 | func_exit(); |
229 | return -ENXIO; | 221 | return -ENXIO; |
230 | } | 222 | } |
231 | 223 | ||
232 | /* | 224 | /* |
233 | ** If the RTA has not booted yet and the user has choosen to block | 225 | ** If the RTA has not booted yet and the user has choosen to block |
234 | ** until the RTA is present then we must spin here waiting for | 226 | ** until the RTA is present then we must spin here waiting for |
235 | ** the RTA to boot. | 227 | ** the RTA to boot. |
236 | */ | 228 | */ |
237 | #if 0 | 229 | #if 0 |
238 | if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { | 230 | if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { |
239 | if (PortP->WaitUntilBooted) { | 231 | if (PortP->WaitUntilBooted) { |
240 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); | 232 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); |
241 | do { | 233 | do { |
242 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 234 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
243 | rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | 235 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); |
244 | func_exit (); | 236 | func_exit(); |
245 | return -EINTR; | 237 | return -EINTR; |
246 | } | 238 | } |
247 | if (repeat_this -- <= 0) { | 239 | if (repeat_this-- <= 0) { |
248 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); | 240 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); |
249 | RIOPreemptiveCmd(p, PortP, FCLOSE ); | 241 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
250 | pseterr(EINTR); | 242 | pseterr(EINTR); |
251 | func_exit (); | 243 | func_exit(); |
252 | return -EIO; | 244 | return -EIO; |
253 | } | 245 | } |
254 | } while(!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); | 246 | } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); |
255 | rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); | 247 | rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); |
256 | } else { | 248 | } else { |
257 | rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); | 249 | rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); |
258 | pseterr(ENXIO); | 250 | pseterr(ENXIO); |
259 | func_exit (); | 251 | func_exit(); |
260 | return 0; | 252 | return 0; |
261 | } | 253 | } |
262 | } | 254 | } |
263 | #else | 255 | #else |
264 | /* I find the above code a bit hairy. I find the below code | 256 | /* I find the above code a bit hairy. I find the below code |
265 | easier to read and shorter. Now, if it works too that would | 257 | easier to read and shorter. Now, if it works too that would |
266 | be great... -- REW | 258 | be great... -- REW |
267 | */ | 259 | */ |
268 | rio_dprintk (RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); | 260 | rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); |
269 | while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { | 261 | while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { |
270 | if (!PortP->WaitUntilBooted) { | 262 | if (!PortP->WaitUntilBooted) { |
271 | rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); | 263 | rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n"); |
272 | func_exit (); | 264 | func_exit(); |
273 | return -ENXIO; | 265 | return -ENXIO; |
274 | } | 266 | } |
275 | 267 | ||
276 | /* Under Linux you'd normally use a wait instead of this | 268 | /* Under Linux you'd normally use a wait instead of this |
277 | busy-waiting. I'll stick with the old implementation for | 269 | busy-waiting. I'll stick with the old implementation for |
278 | now. --REW | 270 | now. --REW |
279 | */ | 271 | */ |
280 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 272 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
281 | rio_dprintk (RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); | 273 | rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); |
282 | func_exit (); | 274 | func_exit(); |
283 | return -EINTR; | 275 | return -EINTR; |
284 | } | 276 | } |
285 | if (repeat_this -- <= 0) { | 277 | if (repeat_this-- <= 0) { |
286 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); | 278 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); |
287 | func_exit (); | 279 | func_exit(); |
288 | return -EIO; | 280 | return -EIO; |
289 | } | 281 | } |
290 | } | 282 | } |
291 | rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); | 283 | rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n"); |
292 | #endif | 284 | #endif |
293 | #if 0 | 285 | #if 0 |
294 | tp = PortP->TtyP; /* get tty struct */ | 286 | tp = PortP->TtyP; /* get tty struct */ |
295 | #endif | 287 | #endif |
296 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 288 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
297 | if ( p->RIOHalted ) { | 289 | if (p->RIOHalted) { |
298 | goto bombout; | 290 | goto bombout; |
299 | } | 291 | } |
300 | #if 0 | 292 | #if 0 |
301 | retval = gs_init_port(&PortP->gs); | 293 | retval = gs_init_port(&PortP->gs); |
302 | if (retval){ | 294 | if (retval) { |
303 | func_exit (); | 295 | func_exit(); |
304 | return retval; | 296 | return retval; |
305 | } | 297 | } |
306 | #endif | 298 | #endif |
307 | 299 | ||
308 | /* | 300 | /* |
309 | ** If the port is in the final throws of being closed, | 301 | ** If the port is in the final throws of being closed, |
310 | ** we should wait here (politely), waiting | 302 | ** we should wait here (politely), waiting |
311 | ** for it to finish, so that it doesn't close us! | 303 | ** for it to finish, so that it doesn't close us! |
312 | */ | 304 | */ |
313 | while ( (PortP->State & RIO_CLOSING) && !p->RIOHalted ) { | 305 | while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) { |
314 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); | 306 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); |
315 | if (repeat_this -- <= 0) { | 307 | if (repeat_this-- <= 0) { |
316 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); | 308 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); |
317 | RIOPreemptiveCmd(p, PortP, FCLOSE ); | 309 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
318 | retval = -EINTR; | 310 | retval = -EINTR; |
319 | goto bombout; | 311 | goto bombout; |
320 | } | 312 | } |
321 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 313 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
322 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 314 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
323 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 315 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
324 | retval = -EINTR; | 316 | retval = -EINTR; |
325 | goto bombout; | 317 | goto bombout; |
326 | } | 318 | } |
327 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 319 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
328 | } | 320 | } |
329 | 321 | ||
330 | if ( !PortP->Mapped ) { | 322 | if (!PortP->Mapped) { |
331 | rio_dprintk (RIO_DEBUG_TTY, "Port unmapped while closing!\n"); | 323 | rio_dprintk(RIO_DEBUG_TTY, "Port unmapped while closing!\n"); |
332 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 324 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
333 | retval = -ENXIO; | 325 | retval = -ENXIO; |
334 | func_exit (); | 326 | func_exit(); |
335 | return retval; | 327 | return retval; |
336 | } | 328 | } |
337 | 329 | ||
338 | if ( p->RIOHalted ) { | 330 | if (p->RIOHalted) { |
339 | goto bombout; | 331 | goto bombout; |
340 | } | 332 | } |
341 | 333 | ||
@@ -346,16 +338,16 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
346 | */ | 338 | */ |
347 | /* Uh? Suppose I turn these on and then another process opens | 339 | /* Uh? Suppose I turn these on and then another process opens |
348 | the port again? The flags get cleared! Not good. -- REW */ | 340 | the port again? The flags get cleared! Not good. -- REW */ |
349 | if ( !(PortP->State & (RIO_LOPEN | RIO_MOPEN)) ) { | 341 | if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
350 | PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); | 342 | PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); |
351 | } | 343 | } |
352 | 344 | ||
353 | if (!(PortP->firstOpen)) { /* First time ? */ | 345 | if (!(PortP->firstOpen)) { /* First time ? */ |
354 | rio_dprintk (RIO_DEBUG_TTY, "First open for this port\n"); | 346 | rio_dprintk(RIO_DEBUG_TTY, "First open for this port\n"); |
355 | 347 | ||
356 | 348 | ||
357 | PortP->firstOpen++; | 349 | PortP->firstOpen++; |
358 | PortP->CookMode = 0; /* XXX RIOCookMode(tp); */ | 350 | PortP->CookMode = 0; /* XXX RIOCookMode(tp); */ |
359 | PortP->InUse = NOT_INUSE; | 351 | PortP->InUse = NOT_INUSE; |
360 | 352 | ||
361 | /* Tentative fix for bug PR27. Didn't work. */ | 353 | /* Tentative fix for bug PR27. Didn't work. */ |
@@ -363,26 +355,26 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
363 | 355 | ||
364 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 356 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
365 | #ifdef NEED_THIS | 357 | #ifdef NEED_THIS |
366 | ttyseth(PortP, tp, (struct old_sgttyb *)&default_sg); | 358 | ttyseth(PortP, tp, (struct old_sgttyb *) &default_sg); |
367 | #endif | 359 | #endif |
368 | 360 | ||
369 | /* Someone explain to me why this delay/config is | 361 | /* Someone explain to me why this delay/config is |
370 | here. If I read the docs correctly the "open" | 362 | here. If I read the docs correctly the "open" |
371 | command piggybacks the parameters immediately. | 363 | command piggybacks the parameters immediately. |
372 | -- REW */ | 364 | -- REW */ |
373 | RIOParam(PortP,OPEN,Modem,OK_TO_SLEEP); /* Open the port */ | 365 | RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ |
374 | #if 0 | 366 | #if 0 |
375 | /* This delay of 1 second was annoying. I removed it. -- REW */ | 367 | /* This delay of 1 second was annoying. I removed it. -- REW */ |
376 | RIODelay(PortP, HUNDRED_MS*10); | 368 | RIODelay(PortP, HUNDRED_MS * 10); |
377 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); /* Config the port */ | 369 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); /* Config the port */ |
378 | #endif | 370 | #endif |
379 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 371 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
380 | 372 | ||
381 | /* | 373 | /* |
382 | ** wait for the port to be not closed. | 374 | ** wait for the port to be not closed. |
383 | */ | 375 | */ |
384 | while ( !(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted ) { | 376 | while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) { |
385 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n",PortP->PortState); | 377 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState); |
386 | /* | 378 | /* |
387 | ** 15.10.1998 ARG - ESIL 0759 | 379 | ** 15.10.1998 ARG - ESIL 0759 |
388 | ** (Part) fix for port being trashed when opened whilst RTA "disconnected" | 380 | ** (Part) fix for port being trashed when opened whilst RTA "disconnected" |
@@ -399,115 +391,109 @@ riotopen(struct tty_struct * tty, struct file * filp) | |||
399 | */ | 391 | */ |
400 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 392 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
401 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 393 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
402 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); | 394 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); |
403 | RIOPreemptiveCmd(p, PortP, FCLOSE ); | 395 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
404 | func_exit (); | 396 | func_exit(); |
405 | return -EINTR; | 397 | return -EINTR; |
406 | } | 398 | } |
407 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 399 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
408 | } | 400 | } |
409 | 401 | ||
410 | if ( p->RIOHalted ) { | 402 | if (p->RIOHalted) { |
411 | retval = -EIO; | 403 | retval = -EIO; |
412 | bombout: | 404 | bombout: |
413 | /* RIOClearUp( PortP ); */ | 405 | /* RIOClearUp( PortP ); */ |
414 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 406 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
415 | return retval; | 407 | return retval; |
416 | } | 408 | } |
417 | rio_dprintk (RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); | 409 | rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); |
418 | } | 410 | } |
419 | 411 | #ifdef MODEM_SUPPORT | |
420 | #ifdef MODEM_SUPPORT | ||
421 | if (Modem) { | 412 | if (Modem) { |
422 | rio_dprintk (RIO_DEBUG_TTY, "Modem - test for carrier\n"); | 413 | rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n"); |
423 | /* | 414 | /* |
424 | ** ACTION | 415 | ** ACTION |
425 | ** insert test for carrier here. -- ??? | 416 | ** insert test for carrier here. -- ??? |
426 | ** I already see that test here. What's the deal? -- REW | 417 | ** I already see that test here. What's the deal? -- REW |
427 | */ | 418 | */ |
428 | if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) | 419 | if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { |
429 | { | 420 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); |
430 | rio_dprintk (RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); | ||
431 | /* | 421 | /* |
432 | tp->tm.c_state |= CARR_ON; | 422 | tp->tm.c_state |= CARR_ON; |
433 | wakeup((caddr_t) &tp->tm.c_canq); | 423 | wakeup((caddr_t) &tp->tm.c_canq); |
434 | */ | 424 | */ |
435 | PortP->State |= RIO_CARR_ON; | 425 | PortP->State |= RIO_CARR_ON; |
436 | wake_up_interruptible (&PortP->gs.open_wait); | 426 | wake_up_interruptible(&PortP->gs.open_wait); |
437 | } | 427 | } else { /* no carrier - wait for DCD */ |
438 | else /* no carrier - wait for DCD */ | 428 | |
439 | { | 429 | /* |
440 | /* | 430 | while (!(PortP->gs.tty->termios->c_state & CARR_ON) && |
441 | while (!(PortP->gs.tty->termios->c_state & CARR_ON) && | 431 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) |
442 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) | 432 | */ |
443 | */ | 433 | while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { |
444 | while (!(PortP->State & RIO_CARR_ON) && | 434 | |
445 | !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) { | 435 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); |
446 | |||
447 | rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n",SysPort); | ||
448 | /* | 436 | /* |
449 | PortP->gs.tty->termios->c_state |= WOPEN; | 437 | PortP->gs.tty->termios->c_state |= WOPEN; |
450 | */ | 438 | */ |
451 | PortP->State |= RIO_WOPEN; | 439 | PortP->State |= RIO_WOPEN; |
452 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 440 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
453 | if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL) | 441 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) |
454 | #if 0 | 442 | #if 0 |
455 | if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH)) | 443 | if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH)) |
456 | #endif | 444 | #endif |
457 | { | 445 | { |
458 | /* | 446 | /* |
459 | ** ACTION: verify that this is a good thing | 447 | ** ACTION: verify that this is a good thing |
460 | ** to do here. -- ??? | 448 | ** to do here. -- ??? |
461 | ** I think it's OK. -- REW | 449 | ** I think it's OK. -- REW |
462 | */ | 450 | */ |
463 | rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", | 451 | rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort); |
464 | SysPort); | 452 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
465 | RIOPreemptiveCmd( p, PortP, FCLOSE ); | 453 | /* |
466 | /* | 454 | tp->tm.c_state &= ~WOPEN; |
467 | tp->tm.c_state &= ~WOPEN; | 455 | */ |
468 | */ | 456 | PortP->State &= ~RIO_WOPEN; |
469 | PortP->State &= ~RIO_WOPEN; | 457 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
470 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 458 | func_exit(); |
471 | func_exit (); | 459 | return -EINTR; |
472 | return -EINTR; | 460 | } |
473 | } | ||
474 | } | 461 | } |
475 | PortP->State &= ~RIO_WOPEN; | 462 | PortP->State &= ~RIO_WOPEN; |
476 | } | 463 | } |
477 | if ( p->RIOHalted ) | 464 | if (p->RIOHalted) |
478 | goto bombout; | 465 | goto bombout; |
479 | rio_dprintk (RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); | 466 | rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); |
480 | PortP->State |= RIO_MOPEN; | 467 | PortP->State |= RIO_MOPEN; |
481 | } | 468 | } else |
482 | else | ||
483 | #endif | 469 | #endif |
484 | { | 470 | { |
485 | /* | 471 | /* |
486 | ** ACTION | 472 | ** ACTION |
487 | ** Direct line open - force carrier (will probably mean | 473 | ** Direct line open - force carrier (will probably mean |
488 | ** that sleeping Modem line fubar) | 474 | ** that sleeping Modem line fubar) |
489 | */ | 475 | */ |
490 | PortP->State |= RIO_LOPEN; | 476 | PortP->State |= RIO_LOPEN; |
491 | } | 477 | } |
492 | 478 | ||
493 | if ( p->RIOHalted ) { | 479 | if (p->RIOHalted) { |
494 | goto bombout; | 480 | goto bombout; |
495 | } | 481 | } |
496 | 482 | ||
497 | rio_dprintk (RIO_DEBUG_TTY, "high level open done\n"); | 483 | rio_dprintk(RIO_DEBUG_TTY, "high level open done\n"); |
498 | 484 | ||
499 | #ifdef STATS | 485 | #ifdef STATS |
500 | PortP->Stat.OpenCnt++; | 486 | PortP->Stat.OpenCnt++; |
501 | #endif | 487 | #endif |
502 | /* | 488 | /* |
503 | ** Count opens for port statistics reporting | 489 | ** Count opens for port statistics reporting |
504 | */ | 490 | */ |
505 | if (PortP->statsGather) | 491 | if (PortP->statsGather) |
506 | PortP->opens++; | 492 | PortP->opens++; |
507 | 493 | ||
508 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 494 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
509 | rio_dprintk (RIO_DEBUG_TTY, "Returning from open\n"); | 495 | rio_dprintk(RIO_DEBUG_TTY, "Returning from open\n"); |
510 | func_exit (); | 496 | func_exit(); |
511 | return 0; | 497 | return 0; |
512 | } | 498 | } |
513 | 499 | ||
@@ -516,36 +502,35 @@ bombout: | |||
516 | ** The operating system thinks that this is last close for the device. | 502 | ** The operating system thinks that this is last close for the device. |
517 | ** As there are two interfaces to the port (Modem and tty), we need to | 503 | ** As there are two interfaces to the port (Modem and tty), we need to |
518 | ** check that both are closed before we close the device. | 504 | ** check that both are closed before we close the device. |
519 | */ | 505 | */ |
520 | int | 506 | int riotclose(void *ptr) |
521 | riotclose(void *ptr) | ||
522 | { | 507 | { |
523 | #if 0 | 508 | #if 0 |
524 | register uint SysPort = dev; | 509 | register uint SysPort = dev; |
525 | struct ttystatics *tp; /* pointer to our ttystruct */ | 510 | struct ttystatics *tp; /* pointer to our ttystruct */ |
526 | #endif | 511 | #endif |
527 | struct Port *PortP = ptr; /* pointer to the port structure */ | 512 | struct Port *PortP = ptr; /* pointer to the port structure */ |
528 | int deleted = 0; | 513 | int deleted = 0; |
529 | int try = -1; /* Disable the timeouts by setting them to -1 */ | 514 | int try = -1; /* Disable the timeouts by setting them to -1 */ |
530 | int repeat_this = -1; /* Congrats to those having 15 years of | 515 | int repeat_this = -1; /* Congrats to those having 15 years of |
531 | uptime! (You get to break the driver.) */ | 516 | uptime! (You get to break the driver.) */ |
532 | unsigned long end_time; | 517 | unsigned long end_time; |
533 | struct tty_struct * tty; | 518 | struct tty_struct *tty; |
534 | unsigned long flags; | 519 | unsigned long flags; |
535 | int Modem; | 520 | int Modem; |
536 | int rv = 0; | 521 | int rv = 0; |
537 | 522 | ||
538 | rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum); | 523 | rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum); |
539 | 524 | ||
540 | /* PortP = p->RIOPortp[SysPort]; */ | 525 | /* PortP = p->RIOPortp[SysPort]; */ |
541 | rio_dprintk (RIO_DEBUG_TTY, "Port is at address 0x%x\n",(int)PortP); | 526 | rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%x\n", (int) PortP); |
542 | /* tp = PortP->TtyP;*/ /* Get tty */ | 527 | /* tp = PortP->TtyP; *//* Get tty */ |
543 | tty = PortP->gs.tty; | 528 | tty = PortP->gs.tty; |
544 | rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty); | 529 | rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%x\n", (int) tty); |
545 | 530 | ||
546 | if (PortP->gs.closing_wait) | 531 | if (PortP->gs.closing_wait) |
547 | end_time = jiffies + PortP->gs.closing_wait; | 532 | end_time = jiffies + PortP->gs.closing_wait; |
548 | else | 533 | else |
549 | end_time = jiffies + MAX_SCHEDULE_TIMEOUT; | 534 | end_time = jiffies + MAX_SCHEDULE_TIMEOUT; |
550 | 535 | ||
551 | Modem = rio_ismodem(tty); | 536 | Modem = rio_ismodem(tty); |
@@ -553,48 +538,48 @@ riotclose(void *ptr) | |||
553 | /* What F.CKING cache? Even then, a higly idle multiprocessor, | 538 | /* What F.CKING cache? Even then, a higly idle multiprocessor, |
554 | system with large caches this won't work . Better find out when | 539 | system with large caches this won't work . Better find out when |
555 | this doesn't work asap, and fix the cause. -- REW */ | 540 | this doesn't work asap, and fix the cause. -- REW */ |
556 | 541 | ||
557 | RIODelay(PortP, HUNDRED_MS*10); /* To flush the cache */ | 542 | RIODelay(PortP, HUNDRED_MS * 10); /* To flush the cache */ |
558 | #endif | 543 | #endif |
559 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 544 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
560 | 545 | ||
561 | /* | 546 | /* |
562 | ** Setting this flag will make any process trying to open | 547 | ** Setting this flag will make any process trying to open |
563 | ** this port block until we are complete closing it. | 548 | ** this port block until we are complete closing it. |
564 | */ | 549 | */ |
565 | PortP->State |= RIO_CLOSING; | 550 | PortP->State |= RIO_CLOSING; |
566 | 551 | ||
567 | if ( (PortP->State & RIO_DELETED) ) { | 552 | if ((PortP->State & RIO_DELETED)) { |
568 | rio_dprintk (RIO_DEBUG_TTY, "Close on deleted RTA\n"); | 553 | rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n"); |
569 | deleted = 1; | 554 | deleted = 1; |
570 | } | 555 | } |
571 | 556 | ||
572 | if ( p->RIOHalted ) { | 557 | if (p->RIOHalted) { |
573 | RIOClearUp( PortP ); | 558 | RIOClearUp(PortP); |
574 | rv = -EIO; | 559 | rv = -EIO; |
575 | goto close_end; | 560 | goto close_end; |
576 | } | 561 | } |
577 | 562 | ||
578 | rio_dprintk (RIO_DEBUG_TTY, "Clear bits\n"); | 563 | rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n"); |
579 | /* | 564 | /* |
580 | ** clear the open bits for this device | 565 | ** clear the open bits for this device |
581 | */ | 566 | */ |
582 | PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN); | 567 | PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN); |
583 | PortP->State &= ~RIO_CARR_ON; | 568 | PortP->State &= ~RIO_CARR_ON; |
584 | PortP->ModemState &= ~MSVR1_CD; | 569 | PortP->ModemState &= ~MSVR1_CD; |
585 | /* | 570 | /* |
586 | ** If the device was open as both a Modem and a tty line | 571 | ** If the device was open as both a Modem and a tty line |
587 | ** then we need to wimp out here, as the port has not really | 572 | ** then we need to wimp out here, as the port has not really |
588 | ** been finally closed (gee, whizz!) The test here uses the | 573 | ** been finally closed (gee, whizz!) The test here uses the |
589 | ** bit for the OTHER mode of operation, to see if THAT is | 574 | ** bit for the OTHER mode of operation, to see if THAT is |
590 | ** still active! | 575 | ** still active! |
591 | */ | 576 | */ |
592 | if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) { | 577 | if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
593 | /* | 578 | /* |
594 | ** The port is still open for the other task - | 579 | ** The port is still open for the other task - |
595 | ** return, pretending that we are still active. | 580 | ** return, pretending that we are still active. |
596 | */ | 581 | */ |
597 | rio_dprintk (RIO_DEBUG_TTY, "Channel %d still open !\n",PortP->PortNum); | 582 | rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum); |
598 | PortP->State &= ~RIO_CLOSING; | 583 | PortP->State &= ~RIO_CLOSING; |
599 | if (PortP->firstOpen) | 584 | if (PortP->firstOpen) |
600 | PortP->firstOpen--; | 585 | PortP->firstOpen--; |
@@ -602,48 +587,47 @@ riotclose(void *ptr) | |||
602 | return -EIO; | 587 | return -EIO; |
603 | } | 588 | } |
604 | 589 | ||
605 | rio_dprintk (RIO_DEBUG_TTY, "Closing down - everything must go!\n"); | 590 | rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n"); |
606 | 591 | ||
607 | PortP->State &= ~RIO_DYNOROD; | 592 | PortP->State &= ~RIO_DYNOROD; |
608 | 593 | ||
609 | /* | 594 | /* |
610 | ** This is where we wait for the port | 595 | ** This is where we wait for the port |
611 | ** to drain down before closing. Bye-bye.... | 596 | ** to drain down before closing. Bye-bye.... |
612 | ** (We never meant to do this) | 597 | ** (We never meant to do this) |
613 | */ | 598 | */ |
614 | rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n"); | 599 | rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n"); |
615 | 600 | ||
616 | if (!deleted) | 601 | if (!deleted) |
617 | while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted && | 602 | while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) { |
618 | (PortP->TxBufferIn != PortP->TxBufferOut) ) { | 603 | cprintf("Need to flush the ttyport\n"); |
619 | cprintf("Need to flush the ttyport\n"); | 604 | if (repeat_this-- <= 0) { |
620 | if (repeat_this -- <= 0) { | 605 | rv = -EINTR; |
621 | rv = -EINTR; | 606 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); |
622 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); | 607 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
623 | RIOPreemptiveCmd(p, PortP, FCLOSE); | 608 | goto close_end; |
624 | goto close_end; | 609 | } |
625 | } | 610 | rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); |
626 | rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); | 611 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
627 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 612 | if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) { |
628 | if (RIODelay_ni(PortP, HUNDRED_MS*10) == RIO_FAIL) { | 613 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); |
629 | rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | 614 | rv = -EINTR; |
630 | rv = -EINTR; | 615 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
616 | goto close_end; | ||
617 | } | ||
631 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 618 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
632 | goto close_end; | ||
633 | } | 619 | } |
634 | rio_spin_lock_irqsave(&PortP->portSem, flags); | ||
635 | } | ||
636 | 620 | ||
637 | PortP->TxBufferIn = PortP->TxBufferOut = 0; | 621 | PortP->TxBufferIn = PortP->TxBufferOut = 0; |
638 | repeat_this = 0xff; | 622 | repeat_this = 0xff; |
639 | 623 | ||
640 | PortP->InUse = 0; | 624 | PortP->InUse = 0; |
641 | if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) { | 625 | if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) { |
642 | /* | 626 | /* |
643 | ** The port has been re-opened for the other task - | 627 | ** The port has been re-opened for the other task - |
644 | ** return, pretending that we are still active. | 628 | ** return, pretending that we are still active. |
645 | */ | 629 | */ |
646 | rio_dprintk (RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); | 630 | rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); |
647 | PortP->State &= ~RIO_CLOSING; | 631 | PortP->State &= ~RIO_CLOSING; |
648 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 632 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
649 | if (PortP->firstOpen) | 633 | if (PortP->firstOpen) |
@@ -651,8 +635,8 @@ riotclose(void *ptr) | |||
651 | return -EIO; | 635 | return -EIO; |
652 | } | 636 | } |
653 | 637 | ||
654 | if ( p->RIOHalted ) { | 638 | if (p->RIOHalted) { |
655 | RIOClearUp( PortP ); | 639 | RIOClearUp(PortP); |
656 | goto close_end; | 640 | goto close_end; |
657 | } | 641 | } |
658 | 642 | ||
@@ -665,57 +649,56 @@ riotclose(void *ptr) | |||
665 | } | 649 | } |
666 | 650 | ||
667 | if (!deleted) | 651 | if (!deleted) |
668 | while (try && (PortP->PortState & PORT_ISOPEN)) { | 652 | while (try && (PortP->PortState & PORT_ISOPEN)) { |
669 | try--; | 653 | try--; |
670 | if (time_after (jiffies, end_time)) { | 654 | if (time_after(jiffies, end_time)) { |
671 | rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" ); | 655 | rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n"); |
672 | RIOPreemptiveCmd(p, PortP,FCLOSE); | 656 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
673 | break; | 657 | break; |
674 | } | 658 | } |
675 | rio_dprintk (RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", | 659 | rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN); |
676 | PortP->PortState & PORT_ISOPEN); | ||
677 | 660 | ||
678 | if ( p->RIOHalted ) { | 661 | if (p->RIOHalted) { |
679 | RIOClearUp( PortP ); | 662 | RIOClearUp(PortP); |
680 | goto close_end; | 663 | goto close_end; |
681 | } | 664 | } |
682 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { | 665 | if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { |
683 | rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); | 666 | rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n"); |
684 | RIOPreemptiveCmd(p, PortP,FCLOSE); | 667 | RIOPreemptiveCmd(p, PortP, FCLOSE); |
685 | break; | 668 | break; |
669 | } | ||
686 | } | 670 | } |
687 | } | ||
688 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 671 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
689 | rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try ); | 672 | rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try); |
690 | 673 | ||
691 | /* RIOPreemptiveCmd(p, PortP, FCLOSE); */ | 674 | /* RIOPreemptiveCmd(p, PortP, FCLOSE); */ |
692 | 675 | ||
693 | /* | 676 | /* |
694 | ** 15.10.1998 ARG - ESIL 0761 part fix | 677 | ** 15.10.1998 ARG - ESIL 0761 part fix |
695 | ** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,** we need to make sure that the flags are clear when the port is opened. | 678 | ** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,** we need to make sure that the flags are clear when the port is opened. |
696 | */ | 679 | */ |
697 | PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW); | 680 | PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); |
698 | 681 | ||
699 | #ifdef STATS | 682 | #ifdef STATS |
700 | PortP->Stat.CloseCnt++; | 683 | PortP->Stat.CloseCnt++; |
701 | #endif | 684 | #endif |
702 | /* | 685 | /* |
703 | ** Count opens for port statistics reporting | 686 | ** Count opens for port statistics reporting |
704 | */ | 687 | */ |
705 | if (PortP->statsGather) | 688 | if (PortP->statsGather) |
706 | PortP->closes++; | 689 | PortP->closes++; |
707 | 690 | ||
708 | close_end: | 691 | close_end: |
709 | /* XXX: Why would a "DELETED" flag be reset here? I'd have | 692 | /* XXX: Why would a "DELETED" flag be reset here? I'd have |
710 | thought that a "deleted" flag means that the port was | 693 | thought that a "deleted" flag means that the port was |
711 | permanently gone, but here we can make it reappear by it | 694 | permanently gone, but here we can make it reappear by it |
712 | being in close during the "deletion". | 695 | being in close during the "deletion". |
713 | */ | 696 | */ |
714 | PortP->State &= ~(RIO_CLOSING|RIO_DELETED); | 697 | PortP->State &= ~(RIO_CLOSING | RIO_DELETED); |
715 | if (PortP->firstOpen) | 698 | if (PortP->firstOpen) |
716 | PortP->firstOpen--; | 699 | PortP->firstOpen--; |
717 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 700 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
718 | rio_dprintk (RIO_DEBUG_TTY, "Return from close\n"); | 701 | rio_dprintk(RIO_DEBUG_TTY, "Return from close\n"); |
719 | return rv; | 702 | return rv; |
720 | } | 703 | } |
721 | 704 | ||
@@ -728,52 +711,50 @@ close_end: | |||
728 | ** COOK_MEDIUM if the card can do all the processing necessary. | 711 | ** COOK_MEDIUM if the card can do all the processing necessary. |
729 | */ | 712 | */ |
730 | #if 0 | 713 | #if 0 |
731 | static int | 714 | static int RIOCookMode(struct ttystatics *tp) |
732 | RIOCookMode(struct ttystatics *tp) | ||
733 | { | 715 | { |
734 | /* | 716 | /* |
735 | ** We can't handle tm.c_mstate != 0 on SCO | 717 | ** We can't handle tm.c_mstate != 0 on SCO |
736 | ** We can't handle mapping | 718 | ** We can't handle mapping |
737 | ** We can't handle non-ttwrite line disc. | 719 | ** We can't handle non-ttwrite line disc. |
738 | ** We can't handle lflag XCASE | 720 | ** We can't handle lflag XCASE |
739 | ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3) | 721 | ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3) |
740 | */ | 722 | */ |
741 | 723 | ||
742 | #ifdef CHECK | 724 | #ifdef CHECK |
743 | CheckTtyP( tp ); | 725 | CheckTtyP(tp); |
744 | #endif | 726 | #endif |
745 | if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ | 727 | if (!(tp->tm.c_oflag & OPOST)) /* No post processing */ |
746 | return COOK_RAW; /* Raw mode o/p */ | 728 | return COOK_RAW; /* Raw mode o/p */ |
747 | 729 | ||
748 | if ( tp->tm.c_lflag & XCASE ) | 730 | if (tp->tm.c_lflag & XCASE) |
749 | return COOK_WELL; /* Use line disc */ | 731 | return COOK_WELL; /* Use line disc */ |
750 | 732 | ||
751 | if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3 ) ) | 733 | if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3)) |
752 | return COOK_WELL; /* Use line disc for strange modes */ | 734 | return COOK_WELL; /* Use line disc for strange modes */ |
753 | 735 | ||
754 | if ( tp->tm.c_oflag == OPOST ) /* If only OPOST is set, do RAW */ | 736 | if (tp->tm.c_oflag == OPOST) /* If only OPOST is set, do RAW */ |
755 | return COOK_RAW; | 737 | return COOK_RAW; |
756 | 738 | ||
757 | /* | 739 | /* |
758 | ** So, we need to output process! | 740 | ** So, we need to output process! |
759 | */ | 741 | */ |
760 | return COOK_MEDIUM; | 742 | return COOK_MEDIUM; |
761 | } | 743 | } |
762 | #endif | 744 | #endif |
763 | 745 | ||
764 | static void | 746 | static void RIOClearUp(PortP) |
765 | RIOClearUp(PortP) | ||
766 | struct Port *PortP; | 747 | struct Port *PortP; |
767 | { | 748 | { |
768 | rio_dprintk (RIO_DEBUG_TTY, "RIOHalted set\n"); | 749 | rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n"); |
769 | PortP->Config = 0; /* Direct semaphore */ | 750 | PortP->Config = 0; /* Direct semaphore */ |
770 | PortP->PortState = 0; | 751 | PortP->PortState = 0; |
771 | PortP->firstOpen = 0; | 752 | PortP->firstOpen = 0; |
772 | PortP->FlushCmdBodge = 0; | 753 | PortP->FlushCmdBodge = 0; |
773 | PortP->ModemState = PortP->CookMode = 0; | 754 | PortP->ModemState = PortP->CookMode = 0; |
774 | PortP->Mapped = 0; | 755 | PortP->Mapped = 0; |
775 | PortP->WflushFlag = 0; | 756 | PortP->WflushFlag = 0; |
776 | PortP->MagicFlags = 0; | 757 | PortP->MagicFlags = 0; |
777 | PortP->RxDataStart = 0; | 758 | PortP->RxDataStart = 0; |
778 | PortP->TxBufferIn = 0; | 759 | PortP->TxBufferIn = 0; |
779 | PortP->TxBufferOut = 0; | 760 | PortP->TxBufferOut = 0; |
@@ -788,33 +769,31 @@ struct Port *PortP; | |||
788 | ** Other values of len aren't allowed, and will cause | 769 | ** Other values of len aren't allowed, and will cause |
789 | ** a panic. | 770 | ** a panic. |
790 | */ | 771 | */ |
791 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, | 772 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) |
792 | int command, int len, int arg) | ||
793 | { | 773 | { |
794 | PKT *PacketP; | 774 | PKT *PacketP; |
795 | int retries = 20; /* at 10 per second -> 2 seconds */ | 775 | int retries = 20; /* at 10 per second -> 2 seconds */ |
796 | unsigned long flags; | 776 | unsigned long flags; |
797 | 777 | ||
798 | rio_dprintk (RIO_DEBUG_TTY, "entering shortcommand.\n"); | 778 | rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n"); |
799 | #ifdef CHECK | 779 | #ifdef CHECK |
800 | CheckPortP( PortP ); | 780 | CheckPortP(PortP); |
801 | if ( len < 1 || len > 2 ) | 781 | if (len < 1 || len > 2) |
802 | cprintf(("STUPID LENGTH %d\n",len)); | 782 | cprintf(("STUPID LENGTH %d\n", len)); |
803 | #endif | 783 | #endif |
804 | 784 | ||
805 | if ( PortP->State & RIO_DELETED ) { | 785 | if (PortP->State & RIO_DELETED) { |
806 | rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); | 786 | rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); |
807 | return RIO_FAIL; | 787 | return RIO_FAIL; |
808 | } | 788 | } |
809 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 789 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
810 | 790 | ||
811 | /* | 791 | /* |
812 | ** If the port is in use for pre-emptive command, then wait for it to | 792 | ** If the port is in use for pre-emptive command, then wait for it to |
813 | ** be free again. | 793 | ** be free again. |
814 | */ | 794 | */ |
815 | while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted ) { | 795 | while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) { |
816 | rio_dprintk (RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", | 796 | rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries); |
817 | retries); | ||
818 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 797 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
819 | if (retries-- <= 0) { | 798 | if (retries-- <= 0) { |
820 | return RIO_FAIL; | 799 | return RIO_FAIL; |
@@ -824,47 +803,47 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, | |||
824 | } | 803 | } |
825 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 804 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
826 | } | 805 | } |
827 | if ( PortP->State & RIO_DELETED ) { | 806 | if (PortP->State & RIO_DELETED) { |
828 | rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); | 807 | rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); |
829 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 808 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
830 | return RIO_FAIL; | 809 | return RIO_FAIL; |
831 | } | 810 | } |
832 | 811 | ||
833 | while ( !can_add_transmit(&PacketP,PortP) && !p->RIOHalted ) { | 812 | while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) { |
834 | rio_dprintk (RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); | 813 | rio_dprintk(RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); |
835 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 814 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
836 | if (retries-- <= 0) { | 815 | if (retries-- <= 0) { |
837 | rio_dprintk (RIO_DEBUG_TTY, "out of tries. Failing\n"); | 816 | rio_dprintk(RIO_DEBUG_TTY, "out of tries. Failing\n"); |
838 | return RIO_FAIL; | 817 | return RIO_FAIL; |
839 | } | 818 | } |
840 | if ( RIODelay_ni(PortP, HUNDRED_MS)==RIO_FAIL ) { | 819 | if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) { |
841 | return RIO_FAIL; | 820 | return RIO_FAIL; |
842 | } | 821 | } |
843 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 822 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
844 | } | 823 | } |
845 | 824 | ||
846 | if ( p->RIOHalted ) { | 825 | if (p->RIOHalted) { |
847 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 826 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
848 | return RIO_FAIL; | 827 | return RIO_FAIL; |
849 | } | 828 | } |
850 | 829 | ||
851 | /* | 830 | /* |
852 | ** set the command byte and the argument byte | 831 | ** set the command byte and the argument byte |
853 | */ | 832 | */ |
854 | WBYTE(PacketP->data[0] , command); | 833 | WBYTE(PacketP->data[0], command); |
855 | 834 | ||
856 | if ( len==2 ) | 835 | if (len == 2) |
857 | WBYTE(PacketP->data[1] , arg); | 836 | WBYTE(PacketP->data[1], arg); |
858 | 837 | ||
859 | /* | 838 | /* |
860 | ** set the length of the packet and set the command bit. | 839 | ** set the length of the packet and set the command bit. |
861 | */ | 840 | */ |
862 | WBYTE(PacketP->len , PKT_CMD_BIT | len); | 841 | WBYTE(PacketP->len, PKT_CMD_BIT | len); |
863 | 842 | ||
864 | add_transmit(PortP); | 843 | add_transmit(PortP); |
865 | /* | 844 | /* |
866 | ** Count characters transmitted for port statistics reporting | 845 | ** Count characters transmitted for port statistics reporting |
867 | */ | 846 | */ |
868 | if (PortP->statsGather) | 847 | if (PortP->statsGather) |
869 | PortP->txchars += len; | 848 | PortP->txchars += len; |
870 | 849 | ||
@@ -878,28 +857,26 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, | |||
878 | ** This is an ioctl interface. This is the twentieth century. You know what | 857 | ** This is an ioctl interface. This is the twentieth century. You know what |
879 | ** its all about. | 858 | ** its all about. |
880 | */ | 859 | */ |
881 | int | 860 | int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) |
882 | riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | ||
883 | { | 861 | { |
884 | register struct Port *PortP; | 862 | register struct Port *PortP; |
885 | register struct ttystatics *tp; | 863 | register struct ttystatics *tp; |
886 | int current; | 864 | int current; |
887 | int ParamSemIncremented = 0; | 865 | int ParamSemIncremented = 0; |
888 | int old_oflag, old_cflag, old_iflag, changed, oldcook; | 866 | int old_oflag, old_cflag, old_iflag, changed, oldcook; |
889 | int i; | 867 | int i; |
890 | unsigned char sio_regs[5]; /* Here be magic */ | 868 | unsigned char sio_regs[5]; /* Here be magic */ |
891 | short vpix_cflag; | 869 | short vpix_cflag; |
892 | short divisor; | 870 | short divisor; |
893 | int baud; | 871 | int baud; |
894 | uint SysPort = rio_minor(tty); | 872 | uint SysPort = rio_minor(tty); |
895 | int Modem = rio_ismodem(tty); | 873 | int Modem = rio_ismodem(tty); |
896 | int ioctl_processed; | 874 | int ioctl_processed; |
897 | 875 | ||
898 | rio_dprintk (RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", | 876 | rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty"); |
899 | SysPort, cmd, arg, Modem?"Modem":"tty") ; | 877 | |
900 | 878 | if (SysPort >= RIO_PORTS) { | |
901 | if ( SysPort >= RIO_PORTS ) { | 879 | rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); |
902 | rio_dprintk (RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); | ||
903 | return -ENXIO; | 880 | return -ENXIO; |
904 | } | 881 | } |
905 | 882 | ||
@@ -912,205 +889,195 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
912 | PortP->Stat.IoctlCnt++; | 889 | PortP->Stat.IoctlCnt++; |
913 | #endif | 890 | #endif |
914 | 891 | ||
915 | if ( PortP->State & RIO_DELETED ) { | 892 | if (PortP->State & RIO_DELETED) { |
916 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 893 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
917 | return -EIO; | 894 | return -EIO; |
918 | } | 895 | } |
919 | 896 | ||
920 | 897 | ||
921 | if ( p->RIOHalted ) { | 898 | if (p->RIOHalted) { |
922 | RIOClearUp( PortP ); | 899 | RIOClearUp(PortP); |
923 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 900 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
924 | return -EIO; | 901 | return -EIO; |
925 | } | 902 | } |
926 | 903 | ||
927 | /* | 904 | /* |
928 | ** Count ioctls for port statistics reporting | 905 | ** Count ioctls for port statistics reporting |
929 | */ | 906 | */ |
930 | if (PortP->statsGather) | 907 | if (PortP->statsGather) |
931 | PortP->ioctls++; | 908 | PortP->ioctls++; |
932 | 909 | ||
933 | /* | 910 | /* |
934 | ** Specialix RIO Ioctl calls | 911 | ** Specialix RIO Ioctl calls |
935 | */ | 912 | */ |
936 | switch (cmd) { | 913 | switch (cmd) { |
937 | 914 | ||
938 | case TCRIOTRIAD: | 915 | case TCRIOTRIAD: |
939 | if ( arg ) | 916 | if (arg) |
940 | PortP->State |= RIO_TRIAD_MODE; | 917 | PortP->State |= RIO_TRIAD_MODE; |
941 | else | 918 | else |
942 | PortP->State &= ~RIO_TRIAD_MODE; | 919 | PortP->State &= ~RIO_TRIAD_MODE; |
943 | /* | 920 | /* |
944 | ** Normally, when istrip is set on a port, a config is | 921 | ** Normally, when istrip is set on a port, a config is |
945 | ** sent to the RTA instructing the CD1400 to do the | 922 | ** sent to the RTA instructing the CD1400 to do the |
946 | ** stripping. In TRIAD mode, the interrupt receive routine | 923 | ** stripping. In TRIAD mode, the interrupt receive routine |
947 | ** must do the stripping instead, since it has to detect | 924 | ** must do the stripping instead, since it has to detect |
948 | ** an 8 bit function key sequence. If istrip is set with | 925 | ** an 8 bit function key sequence. If istrip is set with |
949 | ** TRIAD mode on(off), and 8 bit data is being read by | 926 | ** TRIAD mode on(off), and 8 bit data is being read by |
950 | ** the port, the user then turns TRIAD mode off(on), the RTA | 927 | ** the port, the user then turns TRIAD mode off(on), the RTA |
951 | ** must be reconfigured (not) to do the stripping. | 928 | ** must be reconfigured (not) to do the stripping. |
952 | ** Hence we call RIOParam here. | 929 | ** Hence we call RIOParam here. |
953 | */ | 930 | */ |
954 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 931 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
955 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 932 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
956 | return 0; | 933 | return 0; |
957 | 934 | ||
958 | case TCRIOTSTATE: | 935 | case TCRIOTSTATE: |
959 | rio_dprintk (RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", | 936 | rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis"); |
960 | arg ? "en" : "dis"); | 937 | /* MonitorTstate = 0 ; */ |
961 | /* MonitorTstate = 0 ;*/ | 938 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
962 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 939 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
963 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); | 940 | return 0; |
964 | return 0; | ||
965 | 941 | ||
966 | case TCRIOSTATE: /* current state of Modem input pins */ | 942 | case TCRIOSTATE: /* current state of Modem input pins */ |
967 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE\n"); | 943 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n"); |
968 | if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) | 944 | if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) |
969 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); | 945 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); |
970 | PortP->State |= RIO_BUSY; | 946 | PortP->State |= RIO_BUSY; |
971 | current = PortP->ModemState; | 947 | current = PortP->ModemState; |
972 | if ( copyout((caddr_t)¤t, (int)arg, | 948 | if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) { |
973 | sizeof(current))==COPYFAIL ) { | 949 | rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n"); |
974 | rio_dprintk (RIO_DEBUG_TTY, "Copyout failed\n"); | ||
975 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
976 | pseterr(EFAULT); | ||
977 | } | ||
978 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 950 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
979 | return 0; | 951 | pseterr(EFAULT); |
952 | } | ||
953 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
954 | return 0; | ||
980 | 955 | ||
981 | case TCRIOMBIS: /* Set modem lines */ | 956 | case TCRIOMBIS: /* Set modem lines */ |
982 | case TCRIOMBIC: /* Clear modem lines */ | 957 | case TCRIOMBIC: /* Clear modem lines */ |
983 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); | 958 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); |
984 | if (cmd == TCRIOMBIS) { | 959 | if (cmd == TCRIOMBIS) { |
985 | uint state; | 960 | uint state; |
986 | state = (uint)arg; | 961 | state = (uint) arg; |
987 | PortP->ModemState |= (ushort)state; | 962 | PortP->ModemState |= (ushort) state; |
988 | PortP->ModemLines = (ulong) arg; | 963 | PortP->ModemLines = (ulong) arg; |
989 | if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) | 964 | if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) |
990 | rio_dprintk (RIO_DEBUG_TTY, | 965 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n"); |
991 | "TCRIOMBIS command failed\n"); | 966 | } else { |
992 | } | 967 | uint state; |
993 | else { | ||
994 | uint state; | ||
995 | |||
996 | state = (uint)arg; | ||
997 | PortP->ModemState &= ~(ushort)state; | ||
998 | PortP->ModemLines = (ulong) arg; | ||
999 | if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) | ||
1000 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); | ||
1001 | } | ||
1002 | PortP->State |= RIO_BUSY; | ||
1003 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1004 | return 0; | ||
1005 | 968 | ||
1006 | case TCRIOXPON: /* set Xprint ON string */ | 969 | state = (uint) arg; |
1007 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPON\n"); | 970 | PortP->ModemState &= ~(ushort) state; |
1008 | if ( copyin((int)arg, (caddr_t)PortP->Xprint.XpOn, | 971 | PortP->ModemLines = (ulong) arg; |
1009 | MAX_XP_CTRL_LEN)==COPYFAIL ) { | 972 | if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) |
1010 | rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n"); | 973 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); |
1011 | PortP->Xprint.XpOn[0] = '\0'; | 974 | } |
1012 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 975 | PortP->State |= RIO_BUSY; |
1013 | pseterr(EFAULT); | 976 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1014 | } | 977 | return 0; |
1015 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0'; | ||
1016 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+ | ||
1017 | strlen(PortP->Xprint.XpOff); | ||
1018 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1019 | return 0; | ||
1020 | 978 | ||
1021 | case TCRIOXPOFF: /* set Xprint OFF string */ | 979 | case TCRIOXPON: /* set Xprint ON string */ |
1022 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPOFF\n"); | 980 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n"); |
1023 | if ( copyin( (int)arg, (caddr_t)PortP->Xprint.XpOff, | 981 | if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) { |
1024 | MAX_XP_CTRL_LEN)==COPYFAIL ) { | 982 | rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); |
1025 | rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n"); | 983 | PortP->Xprint.XpOn[0] = '\0'; |
1026 | PortP->Xprint.XpOff[0] = '\0'; | ||
1027 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1028 | pseterr(EFAULT); | ||
1029 | } | ||
1030 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0'; | ||
1031 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+ | ||
1032 | strlen(PortP->Xprint.XpOff); | ||
1033 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 984 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1034 | return 0; | 985 | pseterr(EFAULT); |
986 | } | ||
987 | PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; | ||
988 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); | ||
989 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
990 | return 0; | ||
1035 | 991 | ||
1036 | case TCRIOXPCPS: /* set Xprint CPS string */ | 992 | case TCRIOXPOFF: /* set Xprint OFF string */ |
1037 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPCPS\n"); | 993 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n"); |
1038 | if ( (uint)arg > p->RIOConf.MaxXpCps || | 994 | if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) { |
1039 | (uint)arg < p->RIOConf.MinXpCps ) { | 995 | rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n"); |
1040 | rio_dprintk (RIO_DEBUG_TTY, "%d CPS out of range\n",arg); | 996 | PortP->Xprint.XpOff[0] = '\0'; |
1041 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1042 | pseterr(EINVAL); | ||
1043 | return 0; | ||
1044 | } | ||
1045 | PortP->Xprint.XpCps = (uint)arg; | ||
1046 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 997 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1047 | return 0; | 998 | pseterr(EFAULT); |
999 | } | ||
1000 | PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | ||
1001 | PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff); | ||
1002 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1003 | return 0; | ||
1048 | 1004 | ||
1049 | case TCRIOXPRINT: | 1005 | case TCRIOXPCPS: /* set Xprint CPS string */ |
1050 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPRINT\n"); | 1006 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n"); |
1051 | if ( copyout((caddr_t)&PortP->Xprint, (int)arg, | 1007 | if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) { |
1052 | sizeof(struct Xprint))==COPYFAIL ) { | 1008 | rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg); |
1053 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1054 | pseterr(EFAULT); | ||
1055 | } | ||
1056 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1009 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1010 | pseterr(EINVAL); | ||
1057 | return 0; | 1011 | return 0; |
1012 | } | ||
1013 | PortP->Xprint.XpCps = (uint) arg; | ||
1014 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1015 | return 0; | ||
1058 | 1016 | ||
1059 | case TCRIOIXANYON: | 1017 | case TCRIOXPRINT: |
1060 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYON\n"); | 1018 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n"); |
1061 | PortP->Config |= RIO_IXANY; | 1019 | if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) { |
1062 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1020 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1063 | return 0; | 1021 | pseterr(EFAULT); |
1022 | } | ||
1023 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1024 | return 0; | ||
1064 | 1025 | ||
1065 | case TCRIOIXANYOFF: | 1026 | case TCRIOIXANYON: |
1066 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); | 1027 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n"); |
1067 | PortP->Config &= ~RIO_IXANY; | 1028 | PortP->Config |= RIO_IXANY; |
1068 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1029 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1069 | return 0; | 1030 | return 0; |
1070 | 1031 | ||
1071 | case TCRIOIXONON: | 1032 | case TCRIOIXANYOFF: |
1072 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONON\n"); | 1033 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); |
1073 | PortP->Config |= RIO_IXON; | 1034 | PortP->Config &= ~RIO_IXANY; |
1074 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1035 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1075 | return 0; | 1036 | return 0; |
1076 | 1037 | ||
1077 | case TCRIOIXONOFF: | 1038 | case TCRIOIXONON: |
1078 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); | 1039 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n"); |
1079 | PortP->Config &= ~RIO_IXON; | 1040 | PortP->Config |= RIO_IXON; |
1080 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1041 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1081 | return 0; | 1042 | return 0; |
1043 | |||
1044 | case TCRIOIXONOFF: | ||
1045 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); | ||
1046 | PortP->Config &= ~RIO_IXON; | ||
1047 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | ||
1048 | return 0; | ||
1082 | 1049 | ||
1083 | /* | 1050 | /* |
1084 | ** 15.10.1998 ARG - ESIL 0761 part fix | 1051 | ** 15.10.1998 ARG - ESIL 0761 part fix |
1085 | ** Added support for CTS and RTS flow control ioctls : | 1052 | ** Added support for CTS and RTS flow control ioctls : |
1086 | */ | 1053 | */ |
1087 | case TCRIOCTSFLOWEN: | 1054 | case TCRIOCTSFLOWEN: |
1088 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); | 1055 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); |
1089 | PortP->Config |= RIO_CTSFLOW; | 1056 | PortP->Config |= RIO_CTSFLOW; |
1090 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1057 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1091 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1058 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1092 | return 0; | 1059 | return 0; |
1093 | 1060 | ||
1094 | case TCRIOCTSFLOWDIS: | 1061 | case TCRIOCTSFLOWDIS: |
1095 | rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); | 1062 | rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); |
1096 | PortP->Config &= ~RIO_CTSFLOW; | 1063 | PortP->Config &= ~RIO_CTSFLOW; |
1097 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1064 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1098 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1065 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1099 | return 0; | 1066 | return 0; |
1100 | 1067 | ||
1101 | case TCRIORTSFLOWEN: | 1068 | case TCRIORTSFLOWEN: |
1102 | rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); | 1069 | rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); |
1103 | PortP->Config |= RIO_RTSFLOW; | 1070 | PortP->Config |= RIO_RTSFLOW; |
1104 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1071 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1105 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1072 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1106 | return 0; | 1073 | return 0; |
1107 | 1074 | ||
1108 | case TCRIORTSFLOWDIS: | 1075 | case TCRIORTSFLOWDIS: |
1109 | rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); | 1076 | rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); |
1110 | PortP->Config &= ~RIO_RTSFLOW; | 1077 | PortP->Config &= ~RIO_RTSFLOW; |
1111 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1078 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1112 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1079 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1113 | return 0; | 1080 | return 0; |
1114 | 1081 | ||
1115 | /* end ESIL 0761 part fix */ | 1082 | /* end ESIL 0761 part fix */ |
1116 | 1083 | ||
@@ -1119,35 +1086,35 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1119 | 1086 | ||
1120 | /* Lynx IOCTLS */ | 1087 | /* Lynx IOCTLS */ |
1121 | switch (cmd) { | 1088 | switch (cmd) { |
1122 | case TIOCSETP: | 1089 | case TIOCSETP: |
1123 | case TIOCSETN: | 1090 | case TIOCSETN: |
1124 | case OTIOCSETP: | 1091 | case OTIOCSETP: |
1125 | case OTIOCSETN: | 1092 | case OTIOCSETN: |
1126 | ioctl_processed++; | 1093 | ioctl_processed++; |
1127 | ttyseth(PortP, tp, (struct old_sgttyb *)arg); | 1094 | ttyseth(PortP, tp, (struct old_sgttyb *) arg); |
1128 | break; | 1095 | break; |
1129 | case TCSETA: | 1096 | case TCSETA: |
1130 | case TCSETAW: | 1097 | case TCSETAW: |
1131 | case TCSETAF: | 1098 | case TCSETAF: |
1132 | ioctl_processed++; | 1099 | ioctl_processed++; |
1133 | rio_dprintk (RIO_DEBUG_TTY, "NON POSIX ioctl\n"); | 1100 | rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n"); |
1134 | ttyseth_pv(PortP, tp, (struct termios *)arg, 0); | 1101 | ttyseth_pv(PortP, tp, (struct termios *) arg, 0); |
1135 | break; | 1102 | break; |
1136 | case TCSETAP: /* posix tcsetattr() */ | 1103 | case TCSETAP: /* posix tcsetattr() */ |
1137 | case TCSETAWP: /* posix tcsetattr() */ | 1104 | case TCSETAWP: /* posix tcsetattr() */ |
1138 | case TCSETAFP: /* posix tcsetattr() */ | 1105 | case TCSETAFP: /* posix tcsetattr() */ |
1139 | rio_dprintk (RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); | 1106 | rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); |
1140 | ttyseth_pv(PortP, tp, (struct termios *)arg, 1); | 1107 | ttyseth_pv(PortP, tp, (struct termios *) arg, 1); |
1141 | ioctl_processed++; | 1108 | ioctl_processed++; |
1142 | break; | 1109 | break; |
1143 | } | 1110 | } |
1144 | 1111 | ||
1145 | /* | 1112 | /* |
1146 | ** If its any of the commands that require the port to be in the | 1113 | ** If its any of the commands that require the port to be in the |
1147 | ** non-busy state wait until all output has drained | 1114 | ** non-busy state wait until all output has drained |
1148 | */ | 1115 | */ |
1149 | if (!ioctl_processed) | 1116 | if (!ioctl_processed) |
1150 | switch(cmd) { | 1117 | switch (cmd) { |
1151 | case TCSETAW: | 1118 | case TCSETAW: |
1152 | case TCSETAF: | 1119 | case TCSETAF: |
1153 | case TCSETA: | 1120 | case TCSETA: |
@@ -1171,29 +1138,29 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1171 | #endif | 1138 | #endif |
1172 | case TIOCSETD: | 1139 | case TIOCSETD: |
1173 | case TIOCSETN: | 1140 | case TIOCSETN: |
1174 | rio_dprintk (RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); | 1141 | rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); |
1175 | /* | 1142 | /* |
1176 | ** Wait for drain here, at least as far as the double buffer | 1143 | ** Wait for drain here, at least as far as the double buffer |
1177 | ** being empty. | 1144 | ** being empty. |
1178 | */ | 1145 | */ |
1179 | /* XXX Does the above comment mean that this has | 1146 | /* XXX Does the above comment mean that this has |
1180 | still to be implemented? -- REW */ | 1147 | still to be implemented? -- REW */ |
1181 | /* XXX Is the locking OK together with locking | 1148 | /* XXX Is the locking OK together with locking |
1182 | in txenable? (Deadlock?) -- REW */ | 1149 | in txenable? (Deadlock?) -- REW */ |
1183 | 1150 | ||
1184 | RIOTxEnable((char *)PortP); | 1151 | RIOTxEnable((char *) PortP); |
1185 | break; | 1152 | break; |
1186 | default: | 1153 | default: |
1187 | break; | 1154 | break; |
1188 | } | 1155 | } |
1189 | 1156 | ||
1190 | old_cflag = tp->tm.c_cflag; | 1157 | old_cflag = tp->tm.c_cflag; |
1191 | old_iflag = tp->tm.c_iflag; | 1158 | old_iflag = tp->tm.c_iflag; |
1192 | old_oflag = tp->tm.c_oflag; | 1159 | old_oflag = tp->tm.c_oflag; |
1193 | oldcook = PortP->CookMode; | 1160 | oldcook = PortP->CookMode; |
1194 | 1161 | ||
1195 | if ( p->RIOHalted ) { | 1162 | if (p->RIOHalted) { |
1196 | RIOClearUp( PortP ); | 1163 | RIOClearUp(PortP); |
1197 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1164 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1198 | pseterr(EIO); | 1165 | pseterr(EIO); |
1199 | return 0; | 1166 | return 0; |
@@ -1202,10 +1169,10 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1202 | PortP->FlushCmdBodge = 0; | 1169 | PortP->FlushCmdBodge = 0; |
1203 | 1170 | ||
1204 | /* | 1171 | /* |
1205 | ** If the port is locked, and it is reconfigured, we want | 1172 | ** If the port is locked, and it is reconfigured, we want |
1206 | ** to restore the state of the tty structure so the change is NOT | 1173 | ** to restore the state of the tty structure so the change is NOT |
1207 | ** made. | 1174 | ** made. |
1208 | */ | 1175 | */ |
1209 | if (PortP->Lock) { | 1176 | if (PortP->Lock) { |
1210 | tp->tm.c_iflag = PortP->StoredTty.iflag; | 1177 | tp->tm.c_iflag = PortP->StoredTty.iflag; |
1211 | tp->tm.c_oflag = PortP->StoredTty.oflag; | 1178 | tp->tm.c_oflag = PortP->StoredTty.oflag; |
@@ -1214,13 +1181,12 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1214 | tp->tm.c_line = PortP->StoredTty.line; | 1181 | tp->tm.c_line = PortP->StoredTty.line; |
1215 | for (i = 0; i < NCC + 1; i++) | 1182 | for (i = 0; i < NCC + 1; i++) |
1216 | tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; | 1183 | tp->tm.c_cc[i] = PortP->StoredTty.cc[i]; |
1217 | } | 1184 | } else { |
1218 | else { | ||
1219 | /* | 1185 | /* |
1220 | ** If the port is set to store the parameters, and it is | 1186 | ** If the port is set to store the parameters, and it is |
1221 | ** reconfigured, we want to save the current tty struct so it | 1187 | ** reconfigured, we want to save the current tty struct so it |
1222 | ** may be restored on the next open. | 1188 | ** may be restored on the next open. |
1223 | */ | 1189 | */ |
1224 | if (PortP->Store) { | 1190 | if (PortP->Store) { |
1225 | PortP->StoredTty.iflag = tp->tm.c_iflag; | 1191 | PortP->StoredTty.iflag = tp->tm.c_iflag; |
1226 | PortP->StoredTty.oflag = tp->tm.c_oflag; | 1192 | PortP->StoredTty.oflag = tp->tm.c_oflag; |
@@ -1232,44 +1198,41 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1232 | } | 1198 | } |
1233 | } | 1199 | } |
1234 | 1200 | ||
1235 | changed = (tp->tm.c_cflag != old_cflag) || | 1201 | changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag); |
1236 | (tp->tm.c_iflag != old_iflag) || | ||
1237 | (tp->tm.c_oflag != old_oflag); | ||
1238 | 1202 | ||
1239 | PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ | 1203 | PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ |
1240 | 1204 | ||
1241 | rio_dprintk (RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", | 1205 | rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook); |
1242 | changed,PortP->CookMode,oldcook); | ||
1243 | 1206 | ||
1244 | #ifdef MODEM_SUPPORT | 1207 | #ifdef MODEM_SUPPORT |
1245 | /* | 1208 | /* |
1246 | ** kludge to force CARR_ON if CLOCAL set | 1209 | ** kludge to force CARR_ON if CLOCAL set |
1247 | */ | 1210 | */ |
1248 | if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { | 1211 | if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { |
1249 | tp->tm.c_state |= CARR_ON; | 1212 | tp->tm.c_state |= CARR_ON; |
1250 | wakeup ((caddr_t)&tp->tm.c_canq); | 1213 | wakeup((caddr_t) & tp->tm.c_canq); |
1251 | } | 1214 | } |
1252 | #endif | 1215 | #endif |
1253 | 1216 | ||
1254 | if ( p->RIOHalted ) { | 1217 | if (p->RIOHalted) { |
1255 | RIOClearUp( PortP ); | 1218 | RIOClearUp(PortP); |
1256 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1219 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1257 | pseterr(EIO); | 1220 | pseterr(EIO); |
1258 | return 0; | 1221 | return 0; |
1259 | } | 1222 | } |
1260 | /* | 1223 | /* |
1261 | ** Re-configure if modes or cooking have changed | 1224 | ** Re-configure if modes or cooking have changed |
1262 | */ | 1225 | */ |
1263 | if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { | 1226 | if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { |
1264 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1227 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1265 | rio_dprintk (RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); | 1228 | rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); |
1266 | RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); | 1229 | RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); |
1267 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 1230 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
1268 | } | 1231 | } |
1269 | 1232 | ||
1270 | if (p->RIOHalted) { | 1233 | if (p->RIOHalted) { |
1271 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1234 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1272 | RIOClearUp( PortP ); | 1235 | RIOClearUp(PortP); |
1273 | pseterr(EIO); | 1236 | pseterr(EIO); |
1274 | return 0; | 1237 | return 0; |
1275 | } | 1238 | } |
@@ -1280,36 +1243,32 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg) | |||
1280 | /* | 1243 | /* |
1281 | ttyseth -- set hardware dependent tty settings | 1244 | ttyseth -- set hardware dependent tty settings |
1282 | */ | 1245 | */ |
1283 | void | 1246 | void ttyseth(PortP, s, sg) |
1284 | ttyseth(PortP, s, sg) | 1247 | struct Port *PortP; |
1285 | struct Port * PortP; | 1248 | struct ttystatics *s; |
1286 | struct ttystatics * s; | ||
1287 | struct old_sgttyb *sg; | 1249 | struct old_sgttyb *sg; |
1288 | { | 1250 | { |
1289 | struct old_sgttyb * tsg; | 1251 | struct old_sgttyb *tsg; |
1290 | struct termios *tp = &s->tm; | 1252 | struct termios *tp = &s->tm; |
1291 | 1253 | ||
1292 | tsg = &s->sg; | 1254 | tsg = &s->sg; |
1293 | 1255 | ||
1294 | if (sg->sg_flags & (EVENP|ODDP)) { | 1256 | if (sg->sg_flags & (EVENP | ODDP)) { |
1295 | tp->c_cflag &= PARENB; | 1257 | tp->c_cflag &= PARENB; |
1296 | if (sg->sg_flags & EVENP) { | 1258 | if (sg->sg_flags & EVENP) { |
1297 | if (sg->sg_flags & ODDP) { | 1259 | if (sg->sg_flags & ODDP) { |
1298 | tp->c_cflag &= V_CS7; | 1260 | tp->c_cflag &= V_CS7; |
1299 | tp->c_cflag &= ~PARENB; | 1261 | tp->c_cflag &= ~PARENB; |
1300 | } | 1262 | } else { |
1301 | else { | ||
1302 | tp->c_cflag &= V_CS7; | 1263 | tp->c_cflag &= V_CS7; |
1303 | tp->c_cflag &= PARENB; | 1264 | tp->c_cflag &= PARENB; |
1304 | tp->c_cflag &= PARODD; | 1265 | tp->c_cflag &= PARODD; |
1305 | } | 1266 | } |
1306 | } | 1267 | } else if (sg->sg_flags & ODDP) { |
1307 | else if (sg->sg_flags & ODDP) { | ||
1308 | tp->c_cflag &= V_CS7; | 1268 | tp->c_cflag &= V_CS7; |
1309 | tp->c_cflag &= PARENB; | 1269 | tp->c_cflag &= PARENB; |
1310 | tp->c_cflag &= PARODD; | 1270 | tp->c_cflag &= PARODD; |
1311 | } | 1271 | } else { |
1312 | else { | ||
1313 | tp->c_cflag &= V_CS7; | 1272 | tp->c_cflag &= V_CS7; |
1314 | tp->c_cflag &= PARENB; | 1273 | tp->c_cflag &= PARENB; |
1315 | } | 1274 | } |
@@ -1320,16 +1279,16 @@ struct old_sgttyb *sg; | |||
1320 | * I will have to use separate sets of flags to store them in the | 1279 | * I will have to use separate sets of flags to store them in the |
1321 | * Port structure. | 1280 | * Port structure. |
1322 | */ | 1281 | */ |
1323 | if ( !sg->sg_ospeed ) | 1282 | if (!sg->sg_ospeed) |
1324 | sg->sg_ospeed = sg->sg_ispeed; | 1283 | sg->sg_ospeed = sg->sg_ispeed; |
1325 | else | 1284 | else |
1326 | sg->sg_ispeed = sg->sg_ospeed; | 1285 | sg->sg_ispeed = sg->sg_ospeed; |
1327 | if (sg->sg_ispeed > V_EXTB ) | 1286 | if (sg->sg_ispeed > V_EXTB) |
1328 | sg->sg_ispeed = V_EXTB; | 1287 | sg->sg_ispeed = V_EXTB; |
1329 | if (sg->sg_ispeed < V_B0) | 1288 | if (sg->sg_ispeed < V_B0) |
1330 | sg->sg_ispeed = V_B0; | 1289 | sg->sg_ispeed = V_B0; |
1331 | *tsg = *sg; | 1290 | *tsg = *sg; |
1332 | tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int)sg->sg_ispeed]; | 1291 | tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed]; |
1333 | } | 1292 | } |
1334 | 1293 | ||
1335 | /* | 1294 | /* |
@@ -1338,36 +1297,33 @@ struct old_sgttyb *sg; | |||
1338 | sysv = 0 => (POSIX): struct termios *sg | 1297 | sysv = 0 => (POSIX): struct termios *sg |
1339 | sysv != 0 => (System V): struct termio *sg | 1298 | sysv != 0 => (System V): struct termio *sg |
1340 | */ | 1299 | */ |
1341 | static void | 1300 | static void ttyseth_pv(PortP, s, sg, sysv) |
1342 | ttyseth_pv(PortP, s, sg, sysv) | ||
1343 | struct Port *PortP; | 1301 | struct Port *PortP; |
1344 | struct ttystatics *s; | 1302 | struct ttystatics *s; |
1345 | struct termios *sg; | 1303 | struct termios *sg; |
1346 | int sysv; | 1304 | int sysv; |
1347 | { | 1305 | { |
1348 | int speed; | 1306 | int speed; |
1349 | unsigned char csize; | 1307 | unsigned char csize; |
1350 | unsigned char cread; | 1308 | unsigned char cread; |
1351 | unsigned int lcr_flags; | 1309 | unsigned int lcr_flags; |
1352 | int ps; | 1310 | int ps; |
1353 | 1311 | ||
1354 | if (sysv) { | 1312 | if (sysv) { |
1355 | /* sg points to a System V termio structure */ | 1313 | /* sg points to a System V termio structure */ |
1356 | csize = ((struct termio *)sg)->c_cflag & CSIZE; | 1314 | csize = ((struct termio *) sg)->c_cflag & CSIZE; |
1357 | cread = ((struct termio *)sg)->c_cflag & CREAD; | 1315 | cread = ((struct termio *) sg)->c_cflag & CREAD; |
1358 | speed = conv_vb[((struct termio *)sg)->c_cflag & V_CBAUD]; | 1316 | speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD]; |
1359 | } | 1317 | } else { |
1360 | else { | 1318 | /* sg points to a POSIX termios structure */ |
1361 | /* sg points to a POSIX termios structure */ | 1319 | csize = sg->c_cflag & CSIZE; |
1362 | csize = sg->c_cflag & CSIZE; | 1320 | cread = sg->c_cflag & CREAD; |
1363 | cread = sg->c_cflag & CREAD; | 1321 | speed = conv_vb[sg->c_cflag & V_CBAUD]; |
1364 | speed = conv_vb[sg->c_cflag & V_CBAUD]; | 1322 | } |
1365 | } | 1323 | if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { |
1366 | if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) { | 1324 | s->sg.sg_ispeed = speed; |
1367 | s->sg.sg_ispeed = speed; | 1325 | s->sg.sg_ospeed = speed; |
1368 | s->sg.sg_ospeed = speed; | 1326 | s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed]; |
1369 | s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | | 1327 | } |
1370 | conv_bv[(int)s->sg.sg_ispeed]; | ||
1371 | } | ||
1372 | } | 1328 | } |
1373 | #endif | 1329 | #endif |
diff --git a/drivers/char/rio/riotypes.h b/drivers/char/rio/riotypes.h index 1c7c42c638f0..9b67e2468bec 100644 --- a/drivers/char/rio/riotypes.h +++ b/drivers/char/rio/riotypes.h | |||
@@ -89,47 +89,46 @@ typedef RIO_POINTER u_short_ptr; | |||
89 | typedef RIO_POINTER ushort_ptr; | 89 | typedef RIO_POINTER ushort_ptr; |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | #else /* not INKERNEL */ | 92 | #else /* not INKERNEL */ |
93 | typedef unsigned char BYTE; | 93 | typedef unsigned char BYTE; |
94 | typedef unsigned short WORD; | 94 | typedef unsigned short WORD; |
95 | typedef unsigned long DWORD; | 95 | typedef unsigned long DWORD; |
96 | typedef short NUMBER; | 96 | typedef short NUMBER; |
97 | typedef short *NUMBER_ptr; | 97 | typedef short *NUMBER_ptr; |
98 | typedef unsigned short *WORD_ptr; | 98 | typedef unsigned short *WORD_ptr; |
99 | typedef unsigned char *BYTE_ptr; | 99 | typedef unsigned char *BYTE_ptr; |
100 | typedef unsigned char uchar ; | 100 | typedef unsigned char uchar; |
101 | typedef unsigned short ushort ; | 101 | typedef unsigned short ushort; |
102 | typedef unsigned int uint ; | 102 | typedef unsigned int uint; |
103 | typedef unsigned long ulong ; | 103 | typedef unsigned long ulong; |
104 | typedef unsigned char u_char ; | 104 | typedef unsigned char u_char; |
105 | typedef unsigned short u_short ; | 105 | typedef unsigned short u_short; |
106 | typedef unsigned int u_int ; | 106 | typedef unsigned int u_int; |
107 | typedef unsigned long u_long ; | 107 | typedef unsigned long u_long; |
108 | typedef unsigned short ERROR ; | 108 | typedef unsigned short ERROR; |
109 | typedef unsigned long ID ; | 109 | typedef unsigned long ID; |
110 | typedef char *char_ptr; | 110 | typedef char *char_ptr; |
111 | typedef Channel *Channel_ptr; | 111 | typedef Channel *Channel_ptr; |
112 | typedef struct FREE_LIST *FREE_LIST_ptr; | 112 | typedef struct FREE_LIST *FREE_LIST_ptr; |
113 | typedef struct FREE_LIST **FREE_LIST_ptr_ptr; | 113 | typedef struct FREE_LIST **FREE_LIST_ptr_ptr; |
114 | typedef struct LPB *LPB_ptr; | 114 | typedef struct LPB *LPB_ptr; |
115 | typedef struct Process *Process_ptr; | 115 | typedef struct Process *Process_ptr; |
116 | typedef struct PHB *PHB_ptr; | 116 | typedef struct PHB *PHB_ptr; |
117 | typedef struct PKT *PKT_ptr; | 117 | typedef struct PKT *PKT_ptr; |
118 | typedef struct PKT **PKT_ptr_ptr; | 118 | typedef struct PKT **PKT_ptr_ptr; |
119 | typedef struct Q_BUF *Q_BUF_ptr; | 119 | typedef struct Q_BUF *Q_BUF_ptr; |
120 | typedef struct Q_BUF **Q_BUF_ptr_ptr; | 120 | typedef struct Q_BUF **Q_BUF_ptr_ptr; |
121 | typedef struct ROUTE_STR *ROUTE_STR_ptr; | 121 | typedef struct ROUTE_STR *ROUTE_STR_ptr; |
122 | typedef struct RUP *RUP_ptr; | 122 | typedef struct RUP *RUP_ptr; |
123 | typedef short *short_ptr; | 123 | typedef short *short_ptr; |
124 | typedef u_short *u_short_ptr; | 124 | typedef u_short *u_short_ptr; |
125 | typedef ushort *ushort_ptr; | 125 | typedef ushort *ushort_ptr; |
126 | typedef struct PKT PKT; | 126 | typedef struct PKT PKT; |
127 | typedef struct LPB LPB; | 127 | typedef struct LPB LPB; |
128 | typedef struct RUP RUP; | 128 | typedef struct RUP RUP; |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | 131 | ||
132 | #endif /* __riotypes__ */ | 132 | #endif /* __riotypes__ */ |
133 | 133 | ||
134 | /*********** end of file ***********/ | 134 | /*********** end of file ***********/ |
135 | |||
diff --git a/drivers/char/rio/riowinif.h b/drivers/char/rio/riowinif.h index 18a4f147edc2..f802d7593b80 100644 --- a/drivers/char/rio/riowinif.h +++ b/drivers/char/rio/riowinif.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | */ | 41 | */ |
42 | 42 | ||
43 | #ifndef _riowinif_h /* If RIOWINDIF.H not already defined */ | 43 | #ifndef _riowinif_h /* If RIOWINDIF.H not already defined */ |
44 | #define _riowinif_h 1 | 44 | #define _riowinif_h 1 |
45 | 45 | ||
46 | /***************************************************************************** | 46 | /***************************************************************************** |
@@ -60,42 +60,41 @@ | |||
60 | /* The PARM_MAP structure defines global values relating to the Host Card / RTA | 60 | /* The PARM_MAP structure defines global values relating to the Host Card / RTA |
61 | and is the main structure from which all other structures are referenced. */ | 61 | and is the main structure from which all other structures are referenced. */ |
62 | 62 | ||
63 | typedef struct _PARM_MAP | 63 | typedef struct _PARM_MAP { |
64 | { | 64 | _u16 phb_ptr; /* 0x00 Pointer to the PHB array */ |
65 | _u16 phb_ptr; /* 0x00 Pointer to the PHB array */ | 65 | _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ |
66 | _u16 phb_num_ptr; /* 0x02 Ptr to Number of PHB's */ | 66 | _u16 free_list; /* 0x04 Free List pointer */ |
67 | _u16 free_list; /* 0x04 Free List pointer */ | 67 | _u16 free_list_end; /* 0x06 Free List End pointer */ |
68 | _u16 free_list_end; /* 0x06 Free List End pointer */ | 68 | _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */ |
69 | _u16 q_free_list_ptr; /* 0x08 Ptr to Q_BUF variable */ | 69 | _u16 unit_id_ptr; /* 0x0A Unit Id */ |
70 | _u16 unit_id_ptr; /* 0x0A Unit Id */ | 70 | _u16 link_str_ptr; /* 0x0C Link Structure Array */ |
71 | _u16 link_str_ptr; /* 0x0C Link Structure Array */ | 71 | _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */ |
72 | _u16 bootloader_1; /* 0x0E 1st Stage Boot Loader */ | 72 | _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */ |
73 | _u16 bootloader_2; /* 0x10 2nd Stage Boot Loader */ | 73 | _u16 port_route_map_ptr; /* 0x12 Port Route Map */ |
74 | _u16 port_route_map_ptr; /* 0x12 Port Route Map */ | 74 | _u16 route_ptr; /* 0x14 Route Map */ |
75 | _u16 route_ptr; /* 0x14 Route Map */ | 75 | _u16 map_present; /* 0x16 Route Map present */ |
76 | _u16 map_present; /* 0x16 Route Map present */ | 76 | _u16 pkt_num; /* 0x18 Total number of packets */ |
77 | _u16 pkt_num; /* 0x18 Total number of packets */ | 77 | _u16 q_num; /* 0x1A Total number of Q packets */ |
78 | _u16 q_num; /* 0x1A Total number of Q packets */ | 78 | _u16 buffers_per_port; /* 0x1C Number of buffers per port */ |
79 | _u16 buffers_per_port; /* 0x1C Number of buffers per port */ | 79 | _u16 heap_size; /* 0x1E Initial size of heap */ |
80 | _u16 heap_size; /* 0x1E Initial size of heap */ | 80 | _u16 heap_left; /* 0x20 Current Heap left */ |
81 | _u16 heap_left; /* 0x20 Current Heap left */ | 81 | _u16 error; /* 0x22 Error code */ |
82 | _u16 error; /* 0x22 Error code */ | 82 | _u16 tx_max; /* 0x24 Max number of tx pkts per phb */ |
83 | _u16 tx_max; /* 0x24 Max number of tx pkts per phb */ | 83 | _u16 rx_max; /* 0x26 Max number of rx pkts per phb */ |
84 | _u16 rx_max; /* 0x26 Max number of rx pkts per phb */ | 84 | _u16 rx_limit; /* 0x28 For high / low watermarks */ |
85 | _u16 rx_limit; /* 0x28 For high / low watermarks */ | 85 | _u16 links; /* 0x2A Links to use */ |
86 | _u16 links; /* 0x2A Links to use */ | 86 | _u16 timer; /* 0x2C Interrupts per second */ |
87 | _u16 timer; /* 0x2C Interrupts per second */ | 87 | _u16 rups; /* 0x2E Pointer to the RUPs */ |
88 | _u16 rups; /* 0x2E Pointer to the RUPs */ | 88 | _u16 max_phb; /* 0x30 Mostly for debugging */ |
89 | _u16 max_phb; /* 0x30 Mostly for debugging */ | 89 | _u16 living; /* 0x32 Just increments!! */ |
90 | _u16 living; /* 0x32 Just increments!! */ | 90 | _u16 init_done; /* 0x34 Initialisation over */ |
91 | _u16 init_done; /* 0x34 Initialisation over */ | 91 | _u16 booting_link; /* 0x36 */ |
92 | _u16 booting_link; /* 0x36 */ | 92 | _u16 idle_count; /* 0x38 Idle time counter */ |
93 | _u16 idle_count; /* 0x38 Idle time counter */ | 93 | _u16 busy_count; /* 0x3A Busy counter */ |
94 | _u16 busy_count; /* 0x3A Busy counter */ | 94 | _u16 idle_control; /* 0x3C Control Idle Process */ |
95 | _u16 idle_control; /* 0x3C Control Idle Process */ | 95 | _u16 tx_intr; /* 0x3E TX interrupt pending */ |
96 | _u16 tx_intr; /* 0x3E TX interrupt pending */ | 96 | _u16 rx_intr; /* 0x40 RX interrupt pending */ |
97 | _u16 rx_intr; /* 0x40 RX interrupt pending */ | 97 | _u16 rup_intr; /* 0x42 RUP interrupt pending */ |
98 | _u16 rup_intr; /* 0x42 RUP interrupt pending */ | ||
99 | 98 | ||
100 | } PARM_MAP; | 99 | } PARM_MAP; |
101 | 100 | ||
@@ -184,45 +183,44 @@ typedef struct _PARM_MAP | |||
184 | attached to the system and there is normally an array of MAX_RUPS (=16) structures | 183 | attached to the system and there is normally an array of MAX_RUPS (=16) structures |
185 | in a host card, defined by PARM_MAP->rup. */ | 184 | in a host card, defined by PARM_MAP->rup. */ |
186 | 185 | ||
187 | typedef struct _RUP | 186 | typedef struct _RUP { |
188 | { | 187 | _u16 txpkt; /* 0x00 Outgoing packet */ |
189 | _u16 txpkt; /* 0x00 Outgoing packet */ | 188 | _u16 rxpkt; /* 0x02 ncoming packet */ |
190 | _u16 rxpkt; /* 0x02 ncoming packet */ | 189 | _u16 link; /* 0x04 Which link to send packet down ? */ |
191 | _u16 link; /* 0x04 Which link to send packet down ? */ | 190 | _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */ |
192 | _u8 rup_dest_unit[2]; /* 0x06 Destination Unit */ | 191 | _u16 handshake; /* 0x08 Handshaking */ |
193 | _u16 handshake; /* 0x08 Handshaking */ | 192 | _u16 timeout; /* 0x0A Timeout */ |
194 | _u16 timeout; /* 0x0A Timeout */ | 193 | _u16 status; /* 0x0C Status */ |
195 | _u16 status; /* 0x0C Status */ | 194 | _u16 txcontrol; /* 0x0E Transmit control */ |
196 | _u16 txcontrol; /* 0x0E Transmit control */ | 195 | _u16 rxcontrol; /* 0x10 Receive control */ |
197 | _u16 rxcontrol; /* 0x10 Receive control */ | ||
198 | 196 | ||
199 | } RUP; | 197 | } RUP; |
200 | 198 | ||
201 | /* Same thing again, but defined as offsets... */ | 199 | /* Same thing again, but defined as offsets... */ |
202 | 200 | ||
203 | #define RUP_txpkt 0x00 /* 0x00 Outgoing packet */ | 201 | #define RUP_txpkt 0x00 /* 0x00 Outgoing packet */ |
204 | #define RUP_rxpkt 0x02 /* 0x02 Incoming packet */ | 202 | #define RUP_rxpkt 0x02 /* 0x02 Incoming packet */ |
205 | #define RUP_link 0x04 /* 0x04 Which link to send packet down ? */ | 203 | #define RUP_link 0x04 /* 0x04 Which link to send packet down ? */ |
206 | #define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */ | 204 | #define RUP_rup_dest_unit 0x06 /* 0x06 Destination Unit */ |
207 | #define RUP_handshake 0x08 /* 0x08 Handshaking */ | 205 | #define RUP_handshake 0x08 /* 0x08 Handshaking */ |
208 | #define RUP_timeout 0x0A /* 0x0A Timeout */ | 206 | #define RUP_timeout 0x0A /* 0x0A Timeout */ |
209 | #define RUP_status 0x0C /* 0x0C Status */ | 207 | #define RUP_status 0x0C /* 0x0C Status */ |
210 | #define RUP_txcontrol 0x0E /* 0x0E Transmit control */ | 208 | #define RUP_txcontrol 0x0E /* 0x0E Transmit control */ |
211 | #define RUP_rxcontrol 0x10 /* 0x10 Receive control */ | 209 | #define RUP_rxcontrol 0x10 /* 0x10 Receive control */ |
212 | #define sizeof_RUP 0x12 /* structure size = 0x12 */ | 210 | #define sizeof_RUP 0x12 /* structure size = 0x12 */ |
213 | 211 | ||
214 | #define MAX_RUP 16 | 212 | #define MAX_RUP 16 |
215 | 213 | ||
216 | /* RUP.txcontrol definitions... */ | 214 | /* RUP.txcontrol definitions... */ |
217 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ | 215 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ |
218 | #define TX_PACKET_READY 1 /* Transmit packet ready */ | 216 | #define TX_PACKET_READY 1 /* Transmit packet ready */ |
219 | #define TX_LOCK_RUP 2 /* Transmit side locked */ | 217 | #define TX_LOCK_RUP 2 /* Transmit side locked */ |
220 | 218 | ||
221 | /* RUP.txcontrol definitions... */ | 219 | /* RUP.txcontrol definitions... */ |
222 | #define RX_RUP_INACTIVE 0 /* Nothing received */ | 220 | #define RX_RUP_INACTIVE 0 /* Nothing received */ |
223 | #define RX_PACKET_READY 1 /* Packet received */ | 221 | #define RX_PACKET_READY 1 /* Packet received */ |
224 | 222 | ||
225 | #define RUP_NO_OWNER 0xFF /* RUP not owned by any process */ | 223 | #define RUP_NO_OWNER 0xFF /* RUP not owned by any process */ |
226 | 224 | ||
227 | /***************************************************************************** | 225 | /***************************************************************************** |
228 | ********************************** *********************************** | 226 | ********************************** *********************************** |
@@ -234,52 +232,51 @@ typedef struct _RUP | |||
234 | to the system and there is normally an array of MAX_PHBS (=128) structures | 232 | to the system and there is normally an array of MAX_PHBS (=128) structures |
235 | in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */ | 233 | in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */ |
236 | 234 | ||
237 | typedef struct _PHB | 235 | typedef struct _PHB { |
238 | { | 236 | _u16 source; /* 0x00 Location of the PHB in the host card */ |
239 | _u16 source; /* 0x00 Location of the PHB in the host card */ | 237 | _u16 handshake; /* 0x02 Used to manage receive packet flow control */ |
240 | _u16 handshake; /* 0x02 Used to manage receive packet flow control */ | 238 | _u16 status; /* 0x04 Internal port transmit/receive status */ |
241 | _u16 status; /* 0x04 Internal port transmit/receive status */ | 239 | _u16 timeout; /* 0x06 Time period to wait for an ACK */ |
242 | _u16 timeout; /* 0x06 Time period to wait for an ACK */ | 240 | _u16 link; /* 0x08 The host link associated with the PHB */ |
243 | _u16 link; /* 0x08 The host link associated with the PHB */ | 241 | _u16 destination; /* 0x0A Location of the remote port on the network */ |
244 | _u16 destination; /* 0x0A Location of the remote port on the network */ | 242 | |
245 | 243 | _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */ | |
246 | _u16 tx_start; /* 0x0C first entry in the packet array for transmit packets */ | 244 | _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */ |
247 | _u16 tx_end; /* 0x0E last entry in the packet array for transmit packets */ | 245 | _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */ |
248 | _u16 tx_add; /* 0x10 position in the packet array for new transmit packets */ | 246 | _u16 tx_remove; /* 0x12 current position in the packet pointer array */ |
249 | _u16 tx_remove; /* 0x12 current position in the packet pointer array */ | 247 | |
250 | 248 | _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */ | |
251 | _u16 rx_start; /* 0x14 first entry in the packet array for receive packets */ | 249 | _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */ |
252 | _u16 rx_end; /* 0x16 last entry in the packet array for receive packets */ | 250 | _u16 rx_add; /* 0x18 position in the packet array for new receive packets */ |
253 | _u16 rx_add; /* 0x18 position in the packet array for new receive packets */ | 251 | _u16 rx_remove; /* 0x1A current position in the packet pointer array */ |
254 | _u16 rx_remove; /* 0x1A current position in the packet pointer array */ | ||
255 | 252 | ||
256 | } PHB; | 253 | } PHB; |
257 | 254 | ||
258 | /* Same thing again, but defined as offsets... */ | 255 | /* Same thing again, but defined as offsets... */ |
259 | 256 | ||
260 | #define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */ | 257 | #define PHB_source 0x00 /* 0x00 Location of the PHB in the host card */ |
261 | #define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */ | 258 | #define PHB_handshake 0x02 /* 0x02 Used to manage receive packet flow control */ |
262 | #define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */ | 259 | #define PHB_status 0x04 /* 0x04 Internal port transmit/receive status */ |
263 | #define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */ | 260 | #define PHB_timeout 0x06 /* 0x06 Time period to wait for an ACK */ |
264 | #define PHB_link 0x08 /* 0x08 The host link associated with the PHB */ | 261 | #define PHB_link 0x08 /* 0x08 The host link associated with the PHB */ |
265 | #define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */ | 262 | #define PHB_destination 0x0A /* 0x0A Location of the remote port on the network */ |
266 | #define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */ | 263 | #define PHB_tx_start 0x0C /* 0x0C first entry in the packet array for transmit packets */ |
267 | #define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */ | 264 | #define PHB_tx_end 0x0E /* 0x0E last entry in the packet array for transmit packets */ |
268 | #define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */ | 265 | #define PHB_tx_add 0x10 /* 0x10 position in the packet array for new transmit packets */ |
269 | #define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */ | 266 | #define PHB_tx_remove 0x12 /* 0x12 current position in the packet pointer array */ |
270 | #define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */ | 267 | #define PHB_rx_start 0x14 /* 0x14 first entry in the packet array for receive packets */ |
271 | #define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */ | 268 | #define PHB_rx_end 0x16 /* 0x16 last entry in the packet array for receive packets */ |
272 | #define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */ | 269 | #define PHB_rx_add 0x18 /* 0x18 position in the packet array for new receive packets */ |
273 | #define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */ | 270 | #define PHB_rx_remove 0x1A /* 0x1A current position in the packet pointer array */ |
274 | #define sizeof_PHB 0x1C /* structure size = 0x1C */ | 271 | #define sizeof_PHB 0x1C /* structure size = 0x1C */ |
275 | 272 | ||
276 | /* PHB.handshake definitions... */ | 273 | /* PHB.handshake definitions... */ |
277 | #define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */ | 274 | #define PHB_HANDSHAKE_SET 0x0001 /* Set by LRT */ |
278 | #define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */ | 275 | #define PHB_HANDSHAKE_RESET 0x0002 /* Set by ISR / driver */ |
279 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET) | 276 | #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET) |
280 | /* Reset by ltt */ | 277 | /* Reset by ltt */ |
281 | 278 | ||
282 | #define MAX_PHB 128 /* range 0-127 */ | 279 | #define MAX_PHB 128 /* range 0-127 */ |
283 | 280 | ||
284 | /***************************************************************************** | 281 | /***************************************************************************** |
285 | ********************************** *********************************** | 282 | ********************************** *********************************** |
@@ -291,86 +288,85 @@ typedef struct _PHB | |||
291 | and there is normally an array of MAX_LINKS (=4) structures in a host card, | 288 | and there is normally an array of MAX_LINKS (=4) structures in a host card, |
292 | defined by PARM_MAP->link_str_ptr. */ | 289 | defined by PARM_MAP->link_str_ptr. */ |
293 | 290 | ||
294 | typedef struct _LPB | 291 | typedef struct _LPB { |
295 | { | 292 | _u16 link_number; /* 0x00 Link Number */ |
296 | _u16 link_number; /* 0x00 Link Number */ | 293 | _u16 in_ch; /* 0x02 Link In Channel */ |
297 | _u16 in_ch; /* 0x02 Link In Channel */ | 294 | _u16 out_ch; /* 0x04 Link Out Channel */ |
298 | _u16 out_ch; /* 0x04 Link Out Channel */ | 295 | _u8 attached_serial[4]; /* 0x06 Attached serial number */ |
299 | _u8 attached_serial[4]; /* 0x06 Attached serial number */ | 296 | _u8 attached_host_serial[4]; /* 0x0A Serial number of Host who booted other end */ |
300 | _u8 attached_host_serial[4];/* 0x0A Serial number of Host who booted other end */ | 297 | _u16 descheduled; /* 0x0E Currently Descheduled */ |
301 | _u16 descheduled; /* 0x0E Currently Descheduled */ | 298 | _u16 state; /* 0x10 Current state */ |
302 | _u16 state; /* 0x10 Current state */ | 299 | _u16 send_poll; /* 0x12 Send a Poll Packet */ |
303 | _u16 send_poll; /* 0x12 Send a Poll Packet */ | 300 | _u16 ltt_p; /* 0x14 Process Descriptor */ |
304 | _u16 ltt_p; /* 0x14 Process Descriptor */ | 301 | _u16 lrt_p; /* 0x16 Process Descriptor */ |
305 | _u16 lrt_p; /* 0x16 Process Descriptor */ | 302 | _u16 lrt_status; /* 0x18 Current lrt status */ |
306 | _u16 lrt_status; /* 0x18 Current lrt status */ | 303 | _u16 ltt_status; /* 0x1A Current ltt status */ |
307 | _u16 ltt_status; /* 0x1A Current ltt status */ | 304 | _u16 timeout; /* 0x1C Timeout value */ |
308 | _u16 timeout; /* 0x1C Timeout value */ | 305 | _u16 topology; /* 0x1E Topology bits */ |
309 | _u16 topology; /* 0x1E Topology bits */ | 306 | _u16 mon_ltt; /* 0x20 */ |
310 | _u16 mon_ltt; /* 0x20 */ | 307 | _u16 mon_lrt; /* 0x22 */ |
311 | _u16 mon_lrt; /* 0x22 */ | 308 | _u16 num_pkts; /* 0x24 */ |
312 | _u16 num_pkts; /* 0x24 */ | 309 | _u16 add_packet_list; /* 0x26 Add packets to here */ |
313 | _u16 add_packet_list; /* 0x26 Add packets to here */ | 310 | _u16 remove_packet_list; /* 0x28 Send packets from here */ |
314 | _u16 remove_packet_list; /* 0x28 Send packets from here */ | 311 | |
315 | 312 | _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */ | |
316 | _u16 lrt_fail_chan; /* 0x2A Lrt's failure channel */ | 313 | _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */ |
317 | _u16 ltt_fail_chan; /* 0x2C Ltt's failure channel */ | 314 | |
318 | 315 | RUP rup; /* 0x2E RUP structure for HOST to driver comms */ | |
319 | RUP rup; /* 0x2E RUP structure for HOST to driver comms */ | 316 | RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */ |
320 | RUP link_rup; /* 0x40 RUP for the link (POLL, topology etc.) */ | 317 | _u16 attached_link; /* 0x52 Number of attached link */ |
321 | _u16 attached_link; /* 0x52 Number of attached link */ | 318 | _u16 csum_errors; /* 0x54 csum errors */ |
322 | _u16 csum_errors; /* 0x54 csum errors */ | 319 | _u16 num_disconnects; /* 0x56 number of disconnects */ |
323 | _u16 num_disconnects; /* 0x56 number of disconnects */ | 320 | _u16 num_sync_rcvd; /* 0x58 # sync's received */ |
324 | _u16 num_sync_rcvd; /* 0x58 # sync's received */ | 321 | _u16 num_sync_rqst; /* 0x5A # sync requests */ |
325 | _u16 num_sync_rqst; /* 0x5A # sync requests */ | 322 | _u16 num_tx; /* 0x5C Num pkts sent */ |
326 | _u16 num_tx; /* 0x5C Num pkts sent */ | 323 | _u16 num_rx; /* 0x5E Num pkts received */ |
327 | _u16 num_rx; /* 0x5E Num pkts received */ | 324 | _u16 module_attached; /* 0x60 Module tpyes of attached */ |
328 | _u16 module_attached; /* 0x60 Module tpyes of attached */ | 325 | _u16 led_timeout; /* 0x62 LED timeout */ |
329 | _u16 led_timeout; /* 0x62 LED timeout */ | 326 | _u16 first_port; /* 0x64 First port to service */ |
330 | _u16 first_port; /* 0x64 First port to service */ | 327 | _u16 last_port; /* 0x66 Last port to service */ |
331 | _u16 last_port; /* 0x66 Last port to service */ | ||
332 | 328 | ||
333 | } LPB; | 329 | } LPB; |
334 | 330 | ||
335 | /* Same thing again, but defined as offsets... */ | 331 | /* Same thing again, but defined as offsets... */ |
336 | 332 | ||
337 | #define LPB_link_number 0x00 /* 0x00 Link Number */ | 333 | #define LPB_link_number 0x00 /* 0x00 Link Number */ |
338 | #define LPB_in_ch 0x02 /* 0x02 Link In Channel */ | 334 | #define LPB_in_ch 0x02 /* 0x02 Link In Channel */ |
339 | #define LPB_out_ch 0x04 /* 0x04 Link Out Channel */ | 335 | #define LPB_out_ch 0x04 /* 0x04 Link Out Channel */ |
340 | #define LPB_attached_serial 0x06 /* 0x06 Attached serial number */ | 336 | #define LPB_attached_serial 0x06 /* 0x06 Attached serial number */ |
341 | #define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */ | 337 | #define LPB_attached_host_serial 0x0A /* 0x0A Serial number of Host who booted other end */ |
342 | #define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */ | 338 | #define LPB_descheduled 0x0E /* 0x0E Currently Descheduled */ |
343 | #define LPB_state 0x10 /* 0x10 Current state */ | 339 | #define LPB_state 0x10 /* 0x10 Current state */ |
344 | #define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */ | 340 | #define LPB_send_poll 0x12 /* 0x12 Send a Poll Packet */ |
345 | #define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */ | 341 | #define LPB_ltt_p 0x14 /* 0x14 Process Descriptor */ |
346 | #define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */ | 342 | #define LPB_lrt_p 0x16 /* 0x16 Process Descriptor */ |
347 | #define LPB_lrt_status 0x18 /* 0x18 Current lrt status */ | 343 | #define LPB_lrt_status 0x18 /* 0x18 Current lrt status */ |
348 | #define LPB_ltt_status 0x1A /* 0x1A Current ltt status */ | 344 | #define LPB_ltt_status 0x1A /* 0x1A Current ltt status */ |
349 | #define LPB_timeout 0x1C /* 0x1C Timeout value */ | 345 | #define LPB_timeout 0x1C /* 0x1C Timeout value */ |
350 | #define LPB_topology 0x1E /* 0x1E Topology bits */ | 346 | #define LPB_topology 0x1E /* 0x1E Topology bits */ |
351 | #define LPB_mon_ltt 0x20 /* 0x20 */ | 347 | #define LPB_mon_ltt 0x20 /* 0x20 */ |
352 | #define LPB_mon_lrt 0x22 /* 0x22 */ | 348 | #define LPB_mon_lrt 0x22 /* 0x22 */ |
353 | #define LPB_num_pkts 0x24 /* 0x24 */ | 349 | #define LPB_num_pkts 0x24 /* 0x24 */ |
354 | #define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */ | 350 | #define LPB_add_packet_list 0x26 /* 0x26 Add packets to here */ |
355 | #define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */ | 351 | #define LPB_remove_packet_list 0x28 /* 0x28 Send packets from here */ |
356 | #define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */ | 352 | #define LPB_lrt_fail_chan 0x2A /* 0x2A Lrt's failure channel */ |
357 | #define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */ | 353 | #define LPB_ltt_fail_chan 0x2C /* 0x2C Ltt's failure channel */ |
358 | #define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */ | 354 | #define LPB_rup 0x2E /* 0x2E RUP structure for HOST to driver comms */ |
359 | #define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */ | 355 | #define LPB_link_rup 0x40 /* 0x40 RUP for the link (POLL, topology etc.) */ |
360 | #define LPB_attached_link 0x52 /* 0x52 Number of attached link */ | 356 | #define LPB_attached_link 0x52 /* 0x52 Number of attached link */ |
361 | #define LPB_csum_errors 0x54 /* 0x54 csum errors */ | 357 | #define LPB_csum_errors 0x54 /* 0x54 csum errors */ |
362 | #define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */ | 358 | #define LPB_num_disconnects 0x56 /* 0x56 number of disconnects */ |
363 | #define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */ | 359 | #define LPB_num_sync_rcvd 0x58 /* 0x58 # sync's received */ |
364 | #define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */ | 360 | #define LPB_num_sync_rqst 0x5A /* 0x5A # sync requests */ |
365 | #define LPB_num_tx 0x5C /* 0x5C Num pkts sent */ | 361 | #define LPB_num_tx 0x5C /* 0x5C Num pkts sent */ |
366 | #define LPB_num_rx 0x5E /* 0x5E Num pkts received */ | 362 | #define LPB_num_rx 0x5E /* 0x5E Num pkts received */ |
367 | #define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */ | 363 | #define LPB_module_attached 0x60 /* 0x60 Module tpyes of attached */ |
368 | #define LPB_led_timeout 0x62 /* 0x62 LED timeout */ | 364 | #define LPB_led_timeout 0x62 /* 0x62 LED timeout */ |
369 | #define LPB_first_port 0x64 /* 0x64 First port to service */ | 365 | #define LPB_first_port 0x64 /* 0x64 First port to service */ |
370 | #define LPB_last_port 0x66 /* 0x66 Last port to service */ | 366 | #define LPB_last_port 0x66 /* 0x66 Last port to service */ |
371 | #define sizeof_LPB 0x68 /* structure size = 0x68 */ | 367 | #define sizeof_LPB 0x68 /* structure size = 0x68 */ |
372 | 368 | ||
373 | #define LINKS_PER_UNIT 4 /* number of links from a host */ | 369 | #define LINKS_PER_UNIT 4 /* number of links from a host */ |
374 | 370 | ||
375 | /***************************************************************************** | 371 | /***************************************************************************** |
376 | ******************************** ******************************* | 372 | ******************************** ******************************* |
@@ -380,17 +376,16 @@ typedef struct _LPB | |||
380 | 376 | ||
381 | /* Used to overlay packet headers when allocating/freeing packets from the free list */ | 377 | /* Used to overlay packet headers when allocating/freeing packets from the free list */ |
382 | 378 | ||
383 | typedef struct _FREE_LIST | 379 | typedef struct _FREE_LIST { |
384 | { | 380 | _u16 next; /* 0x00 offset of next list item */ |
385 | _u16 next; /* 0x00 offset of next list item */ | 381 | _u16 prev; /* 0x02 offset of previous list item */ |
386 | _u16 prev; /* 0x02 offset of previous list item */ | ||
387 | 382 | ||
388 | } FREE_LIST; | 383 | } FREE_LIST; |
389 | 384 | ||
390 | /* Same thing again, but defined as offsets... */ | 385 | /* Same thing again, but defined as offsets... */ |
391 | 386 | ||
392 | #define FL_next 0x00 /* 0x00 offset of next list item */ | 387 | #define FL_next 0x00 /* 0x00 offset of next list item */ |
393 | #define FL_prev 0x02 /* 0x02 offset of previous list item */ | 388 | #define FL_prev 0x02 /* 0x02 offset of previous list item */ |
394 | 389 | ||
395 | /***************************************************************************** | 390 | /***************************************************************************** |
396 | ********************************** *********************************** | 391 | ********************************** *********************************** |
@@ -401,32 +396,31 @@ typedef struct _FREE_LIST | |||
401 | /* The PKT is the main unit of communication between Host Cards and RTAs across | 396 | /* The PKT is the main unit of communication between Host Cards and RTAs across |
402 | the RIO network. */ | 397 | the RIO network. */ |
403 | 398 | ||
404 | #define PKT_MAX_DATA_LEN 72 /* Size of packet data */ | 399 | #define PKT_MAX_DATA_LEN 72 /* Size of packet data */ |
405 | 400 | ||
406 | typedef struct _PKT | 401 | typedef struct _PKT { |
407 | { | 402 | _u8 dest_unit; /* 0x00 Destination Unit Id */ |
408 | _u8 dest_unit; /* 0x00 Destination Unit Id */ | 403 | _u8 dest_port; /* 0x01 Destination Port */ |
409 | _u8 dest_port; /* 0x01 Destination Port */ | 404 | _u8 src_unit; /* 0x02 Source Unit Id */ |
410 | _u8 src_unit; /* 0x02 Source Unit Id */ | 405 | _u8 src_port; /* 0x03 Source Port */ |
411 | _u8 src_port; /* 0x03 Source Port */ | 406 | _u8 len; /* 0x04 Length (in bytes) of data field */ |
412 | _u8 len; /* 0x04 Length (in bytes) of data field */ | 407 | _u8 control; /* 0x05 */ |
413 | _u8 control; /* 0x05 */ | 408 | _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */ |
414 | _u8 data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */ | 409 | _u16 csum; /* 0x4E C-SUM */ |
415 | _u16 csum; /* 0x4E C-SUM */ | ||
416 | 410 | ||
417 | } PKT; | 411 | } PKT; |
418 | 412 | ||
419 | /* Same thing again, but defined as offsets... */ | 413 | /* Same thing again, but defined as offsets... */ |
420 | 414 | ||
421 | #define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */ | 415 | #define PKT_dest_unit 0x00 /* 0x00 Destination Unit Id */ |
422 | #define PKT_dest_port 0x01 /* 0x01 Destination Port */ | 416 | #define PKT_dest_port 0x01 /* 0x01 Destination Port */ |
423 | #define PKT_src_unit 0x02 /* 0x02 Source Unit Id */ | 417 | #define PKT_src_unit 0x02 /* 0x02 Source Unit Id */ |
424 | #define PKT_src_port 0x03 /* 0x03 Source Port */ | 418 | #define PKT_src_port 0x03 /* 0x03 Source Port */ |
425 | #define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */ | 419 | #define PKT_len 0x04 /* 0x04 Length (in bytes) of data field */ |
426 | #define PKT_control 0x05 /* 0x05 */ | 420 | #define PKT_control 0x05 /* 0x05 */ |
427 | #define PKT_data 0x06 /* 0x06 Actual data */ | 421 | #define PKT_data 0x06 /* 0x06 Actual data */ |
428 | #define PKT_csum 0x4E /* 0x4E C-SUM */ | 422 | #define PKT_csum 0x4E /* 0x4E C-SUM */ |
429 | #define sizeof_PKT 0x50 /* structure size = 0x50 */ | 423 | #define sizeof_PKT 0x50 /* structure size = 0x50 */ |
430 | 424 | ||
431 | /* PKT.len definitions... */ | 425 | /* PKT.len definitions... */ |
432 | #define PKT_CMD_BIT 0x80 | 426 | #define PKT_CMD_BIT 0x80 |
@@ -449,38 +443,38 @@ typedef struct _PKT | |||
449 | /* The following definitions and structures define the control packets sent | 443 | /* The following definitions and structures define the control packets sent |
450 | between the driver and RIO Ports, RTAs and Host Cards. */ | 444 | between the driver and RIO Ports, RTAs and Host Cards. */ |
451 | 445 | ||
452 | #define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */ | 446 | #define PRE_EMPTIVE 0x80 /* Pre-emptive command (sent via port's RUP) */ |
453 | 447 | ||
454 | /* "in-band" and "pre-emptive" port commands... */ | 448 | /* "in-band" and "pre-emptive" port commands... */ |
455 | #define OPEN 0x00 /* Driver->RIO Open a port */ | 449 | #define OPEN 0x00 /* Driver->RIO Open a port */ |
456 | #define CONFIG 0x01 /* Driver->RIO Configure a port */ | 450 | #define CONFIG 0x01 /* Driver->RIO Configure a port */ |
457 | #define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */ | 451 | #define MOPEN 0x02 /* Driver->RIO Modem open (wait for DCD) */ |
458 | #define CLOSE 0x03 /* Driver->RIO Close a port */ | 452 | #define CLOSE 0x03 /* Driver->RIO Close a port */ |
459 | #define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */ | 453 | #define WFLUSH (0x04|PRE_EMPTIVE) /* Driver->RIO Write flush */ |
460 | #define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */ | 454 | #define RFLUSH (0x05|PRE_EMPTIVE) /* Driver->RIO Read flush */ |
461 | #define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */ | 455 | #define RESUME (0x06|PRE_EMPTIVE) /* Driver->RIO Behave as if XON received */ |
462 | #define SBREAK 0x07 /* Driver->RIO Start break */ | 456 | #define SBREAK 0x07 /* Driver->RIO Start break */ |
463 | #define EBREAK 0x08 /* Driver->RIO End break */ | 457 | #define EBREAK 0x08 /* Driver->RIO End break */ |
464 | #define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */ | 458 | #define SUSPEND (0x09|PRE_EMPTIVE) /* Driver->RIO Behave as if XOFF received */ |
465 | #define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */ | 459 | #define FCLOSE (0x0A|PRE_EMPTIVE) /* Driver->RIO Force close */ |
466 | #define XPRINT 0x0B /* Driver->RIO Xprint packet */ | 460 | #define XPRINT 0x0B /* Driver->RIO Xprint packet */ |
467 | #define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ | 461 | #define MBIS (0x0C|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ |
468 | #define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */ | 462 | #define MBIC (0x0D|PRE_EMPTIVE) /* Driver->RIO Clear modem lines */ |
469 | #define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ | 463 | #define MSET (0x0E|PRE_EMPTIVE) /* Driver->RIO Set modem lines */ |
470 | #define PCLOSE 0x0F /* Driver->RIO Pseudo close */ | 464 | #define PCLOSE 0x0F /* Driver->RIO Pseudo close */ |
471 | #define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */ | 465 | #define MGET (0x10|PRE_EMPTIVE) /* Driver->RIO Force update of modem status */ |
472 | #define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */ | 466 | #define MEMDUMP (0x11|PRE_EMPTIVE) /* Driver->RIO DEBUG request for RTA memory */ |
473 | #define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */ | 467 | #define READ_REGISTER (0x12|PRE_EMPTIVE) /* Driver->RIO DEBUG read CD1400 register */ |
474 | 468 | ||
475 | /* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */ | 469 | /* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */ |
476 | #define SYNC_RUP 0xFF /* Download internal */ | 470 | #define SYNC_RUP 0xFF /* Download internal */ |
477 | #define COMMAND_RUP 0xFE /* Command ack/status */ | 471 | #define COMMAND_RUP 0xFE /* Command ack/status */ |
478 | #define ERROR_RUP 0xFD /* Download internal */ | 472 | #define ERROR_RUP 0xFD /* Download internal */ |
479 | #define POLL_RUP 0xFC /* Download internal */ | 473 | #define POLL_RUP 0xFC /* Download internal */ |
480 | #define BOOT_RUP 0xFB /* Used to boot RTAs */ | 474 | #define BOOT_RUP 0xFB /* Used to boot RTAs */ |
481 | #define ROUTE_RUP 0xFA /* Used to specify routing/topology */ | 475 | #define ROUTE_RUP 0xFA /* Used to specify routing/topology */ |
482 | #define STATUS_RUP 0xF9 /* Not used */ | 476 | #define STATUS_RUP 0xF9 /* Not used */ |
483 | #define POWER_RUP 0xF8 /* Download internal */ | 477 | #define POWER_RUP 0xF8 /* Download internal */ |
484 | 478 | ||
485 | /* COMMAND_RUP definitions... */ | 479 | /* COMMAND_RUP definitions... */ |
486 | #define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */ | 480 | #define COMPLETE (0x20|PRE_EMPTIVE) /* RIO->Driver Command complete */ |
@@ -488,24 +482,24 @@ typedef struct _PKT | |||
488 | #define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */ | 482 | #define MODEM_STATUS (0x22|PRE_EMPTIVE) /* RIO->Driver Modem status change */ |
489 | 483 | ||
490 | /* BOOT_RUP definitions... */ | 484 | /* BOOT_RUP definitions... */ |
491 | #define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */ | 485 | #define BOOT_REQUEST 0x00 /* RIO->Driver Request for boot */ |
492 | #define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */ | 486 | #define BOOT_ABORT 0x01 /* Driver->RIO Abort a boot */ |
493 | #define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */ | 487 | #define BOOT_SEQUENCE 0x02 /* Driver->RIO Packet with firmware details */ |
494 | #define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */ | 488 | #define BOOT_COMPLETED 0x03 /* RIO->Driver Boot completed */ |
495 | #define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */ | 489 | #define IFOAD 0x2F /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */ |
496 | #define IDENTIFY 0x30 /* Driver->RIO Identify RTA */ | 490 | #define IDENTIFY 0x30 /* Driver->RIO Identify RTA */ |
497 | #define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */ | 491 | #define ZOMBIE 0x31 /* Driver->RIO Shutdown/Flash LEDs */ |
498 | #define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */ | 492 | #define UFOAD 0x32 /* Driver->RIO Shutdown/Reboot neighbouring RTA */ |
499 | #define IWAIT 0x33 /* Driver->RIO Pause booting process */ | 493 | #define IWAIT 0x33 /* Driver->RIO Pause booting process */ |
500 | 494 | ||
501 | /* ROUTE_RUP definitions... */ | 495 | /* ROUTE_RUP definitions... */ |
502 | #define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */ | 496 | #define ROUTE_REQUEST 0x00 /* RIO->Driver Request an ID */ |
503 | #define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */ | 497 | #define ROUTE_FOAD 0x01 /* Driver->RIO Shutdown/reboot RTA */ |
504 | #define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */ | 498 | #define ROUTE_ALREADY 0x02 /* Driver->RIO Not used */ |
505 | #define ROUTE_USED 0x03 /* Driver->RIO Not used */ | 499 | #define ROUTE_USED 0x03 /* Driver->RIO Not used */ |
506 | #define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */ | 500 | #define ROUTE_ALLOCATE 0x04 /* Driver->RIO Allocate RTA RUP numbers */ |
507 | #define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */ | 501 | #define ROUTE_REQ_TOP 0x05 /* Driver->RIO Not used */ |
508 | #define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */ | 502 | #define ROUTE_TOPOLOGY 0x06 /* RIO->Driver Route/Topology status */ |
509 | 503 | ||
510 | /***************************************************************************** | 504 | /***************************************************************************** |
511 | ********************************** ********************************** | 505 | ********************************** ********************************** |
@@ -518,89 +512,89 @@ typedef struct _PKT | |||
518 | Sent to open a port. | 512 | Sent to open a port. |
519 | Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */ | 513 | Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */ |
520 | 514 | ||
521 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 515 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
522 | #define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */ | 516 | #define PKT_Cor1 (PKT_Data+1) /* Channel Option Register 1 */ |
523 | #define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */ | 517 | #define PKT_Cor2 (PKT_Data+2) /* Channel Option Register 2 */ |
524 | #define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */ | 518 | #define PKT_Cor4 (PKT_Data+3) /* Channel Option Register 4 */ |
525 | #define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */ | 519 | #define PKT_Cor5 (PKT_Data+4) /* Channel Option Register 5 */ |
526 | #define PKT_TxXon (PKT_Data+5) /* Transmit XON character */ | 520 | #define PKT_TxXon (PKT_Data+5) /* Transmit XON character */ |
527 | #define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */ | 521 | #define PKT_TxXoff (PKT_Data+6) /* Transmit XOFF character */ |
528 | #define PKT_RxXon (PKT_Data+7) /* Receive XON character */ | 522 | #define PKT_RxXon (PKT_Data+7) /* Receive XON character */ |
529 | #define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */ | 523 | #define PKT_RxXoff (PKT_Data+8) /* Receive XOFF character */ |
530 | #define PKT_Lnext (PKT_Data+9) /* Lnext character */ | 524 | #define PKT_Lnext (PKT_Data+9) /* Lnext character */ |
531 | #define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */ | 525 | #define PKT_TxBaud (PKT_Data+10) /* Transmit baud rate */ |
532 | #define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */ | 526 | #define PKT_RxBaud (PKT_Data+11) /* Receive baud rate */ |
533 | 527 | ||
534 | /* COR1 definitions... */ | 528 | /* COR1 definitions... */ |
535 | #define COR1_PARITY 0xE0 /* Parity mask */ | 529 | #define COR1_PARITY 0xE0 /* Parity mask */ |
536 | #define COR1_NONE 0x00 /* No parity */ | 530 | #define COR1_NONE 0x00 /* No parity */ |
537 | #define COR1_SPACE 0x20 /* Space parity */ | 531 | #define COR1_SPACE 0x20 /* Space parity */ |
538 | #define COR1_EVEN 0x40 /* Even parity */ | 532 | #define COR1_EVEN 0x40 /* Even parity */ |
539 | #define COR1_MARK 0xA0 /* Mark parity */ | 533 | #define COR1_MARK 0xA0 /* Mark parity */ |
540 | #define COR1_ODD 0xC0 /* Odd parity */ | 534 | #define COR1_ODD 0xC0 /* Odd parity */ |
541 | 535 | ||
542 | #define COR1_STOPBITS 0x0C /* Stop bits mask */ | 536 | #define COR1_STOPBITS 0x0C /* Stop bits mask */ |
543 | #define COR1_STOP1 0x00 /* 1 stop bit */ | 537 | #define COR1_STOP1 0x00 /* 1 stop bit */ |
544 | #define COR1_STOP1_5 0x04 /* 1.5 stop bits */ | 538 | #define COR1_STOP1_5 0x04 /* 1.5 stop bits */ |
545 | #define COR1_STOP2 0x08 /* 2 stop bits */ | 539 | #define COR1_STOP2 0x08 /* 2 stop bits */ |
546 | 540 | ||
547 | #define COR1_DATABITS 0x03 /* Data bits mask */ | 541 | #define COR1_DATABITS 0x03 /* Data bits mask */ |
548 | #define COR1_DATA5 0x00 /* 5 data bits */ | 542 | #define COR1_DATA5 0x00 /* 5 data bits */ |
549 | #define COR1_DATA6 0x01 /* 6 data bits */ | 543 | #define COR1_DATA6 0x01 /* 6 data bits */ |
550 | #define COR1_DATA7 0x02 /* 7 data bits */ | 544 | #define COR1_DATA7 0x02 /* 7 data bits */ |
551 | #define COR1_DATA8 0x03 /* 8 data bits */ | 545 | #define COR1_DATA8 0x03 /* 8 data bits */ |
552 | 546 | ||
553 | /* COR2 definitions... */ | 547 | /* COR2 definitions... */ |
554 | #define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */ | 548 | #define COR2_XON_TXFLOW 0x40 /* XON/XOFF Transmit Flow */ |
555 | #define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */ | 549 | #define COR2_XANY_TXFLOW 0xC0 /* XON/XANY Transmit Flow */ |
556 | #define COR2_HUPCL 0x20 /* Hang Up On Close */ | 550 | #define COR2_HUPCL 0x20 /* Hang Up On Close */ |
557 | #define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */ | 551 | #define COR2_DSR_TXFLOW 0x08 /* DSR Transmit Flow Control */ |
558 | #define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */ | 552 | #define COR2_RTS_RXFLOW 0x04 /* RTS Receive Flow Control */ |
559 | #define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */ | 553 | #define COR2_CTS_TXFLOW 0x02 /* CTS Transmit Flow Control */ |
560 | #define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */ | 554 | #define COR2_XON_RXFLOW 0x01 /* XON/XOFF Receive Flow */ |
561 | 555 | ||
562 | /* COR4 definition... */ | 556 | /* COR4 definition... */ |
563 | #define COR4_IGNCR 0x80 /* Discard received CR */ | 557 | #define COR4_IGNCR 0x80 /* Discard received CR */ |
564 | #define COR4_ICRNL 0x40 /* Map received CR -> NL */ | 558 | #define COR4_ICRNL 0x40 /* Map received CR -> NL */ |
565 | #define COR4_INLCR 0x20 /* Map received NL -> CR */ | 559 | #define COR4_INLCR 0x20 /* Map received NL -> CR */ |
566 | #define COR4_IGNBRK 0x10 /* Ignore Received Break */ | 560 | #define COR4_IGNBRK 0x10 /* Ignore Received Break */ |
567 | #define COR4_NBRKINT 0x08 /* No interrupt on rx Break */ | 561 | #define COR4_NBRKINT 0x08 /* No interrupt on rx Break */ |
568 | #define COR4_IGNPAR 0x04 /* ignore rx parity error chars */ | 562 | #define COR4_IGNPAR 0x04 /* ignore rx parity error chars */ |
569 | #define COR4_PARMRK 0x02 /* Mark rx parity error chars */ | 563 | #define COR4_PARMRK 0x02 /* Mark rx parity error chars */ |
570 | #define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */ | 564 | #define COR4_RAISEMOD 0x01 /* Raise modem lines on !0 baud */ |
571 | 565 | ||
572 | /* COR5 definitions... */ | 566 | /* COR5 definitions... */ |
573 | #define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */ | 567 | #define COR5_ISTRIP 0x80 /* Strip input chars to 7 bits */ |
574 | #define COR5_LNE 0x40 /* Enable LNEXT processing */ | 568 | #define COR5_LNE 0x40 /* Enable LNEXT processing */ |
575 | #define COR5_CMOE 0x20 /* Match good & error characters */ | 569 | #define COR5_CMOE 0x20 /* Match good & error characters */ |
576 | #define COR5_TAB3 0x10 /* TAB3 mode */ | 570 | #define COR5_TAB3 0x10 /* TAB3 mode */ |
577 | #define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */ | 571 | #define COR5_TSTATE_ON 0x08 /* Enable tbusy/tstop monitoring */ |
578 | #define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */ | 572 | #define COR5_TSTATE_OFF 0x04 /* Disable tbusy/tstop monitoring */ |
579 | #define COR5_ONLCR 0x02 /* NL -> CR NL on output */ | 573 | #define COR5_ONLCR 0x02 /* NL -> CR NL on output */ |
580 | #define COR5_OCRNL 0x01 /* CR -> NL on output */ | 574 | #define COR5_OCRNL 0x01 /* CR -> NL on output */ |
581 | 575 | ||
582 | /* RxBaud and TxBaud definitions... */ | 576 | /* RxBaud and TxBaud definitions... */ |
583 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ | 577 | #define RIO_B0 0x00 /* RTS / DTR signals dropped */ |
584 | #define RIO_B50 0x01 /* 50 baud */ | 578 | #define RIO_B50 0x01 /* 50 baud */ |
585 | #define RIO_B75 0x02 /* 75 baud */ | 579 | #define RIO_B75 0x02 /* 75 baud */ |
586 | #define RIO_B110 0x03 /* 110 baud */ | 580 | #define RIO_B110 0x03 /* 110 baud */ |
587 | #define RIO_B134 0x04 /* 134.5 baud */ | 581 | #define RIO_B134 0x04 /* 134.5 baud */ |
588 | #define RIO_B150 0x05 /* 150 baud */ | 582 | #define RIO_B150 0x05 /* 150 baud */ |
589 | #define RIO_B200 0x06 /* 200 baud */ | 583 | #define RIO_B200 0x06 /* 200 baud */ |
590 | #define RIO_B300 0x07 /* 300 baud */ | 584 | #define RIO_B300 0x07 /* 300 baud */ |
591 | #define RIO_B600 0x08 /* 600 baud */ | 585 | #define RIO_B600 0x08 /* 600 baud */ |
592 | #define RIO_B1200 0x09 /* 1200 baud */ | 586 | #define RIO_B1200 0x09 /* 1200 baud */ |
593 | #define RIO_B1800 0x0A /* 1800 baud */ | 587 | #define RIO_B1800 0x0A /* 1800 baud */ |
594 | #define RIO_B2400 0x0B /* 2400 baud */ | 588 | #define RIO_B2400 0x0B /* 2400 baud */ |
595 | #define RIO_B4800 0x0C /* 4800 baud */ | 589 | #define RIO_B4800 0x0C /* 4800 baud */ |
596 | #define RIO_B9600 0x0D /* 9600 baud */ | 590 | #define RIO_B9600 0x0D /* 9600 baud */ |
597 | #define RIO_B19200 0x0E /* 19200 baud */ | 591 | #define RIO_B19200 0x0E /* 19200 baud */ |
598 | #define RIO_B38400 0x0F /* 38400 baud */ | 592 | #define RIO_B38400 0x0F /* 38400 baud */ |
599 | #define RIO_B56000 0x10 /* 56000 baud */ | 593 | #define RIO_B56000 0x10 /* 56000 baud */ |
600 | #define RIO_B57600 0x11 /* 57600 baud */ | 594 | #define RIO_B57600 0x11 /* 57600 baud */ |
601 | #define RIO_B64000 0x12 /* 64000 baud */ | 595 | #define RIO_B64000 0x12 /* 64000 baud */ |
602 | #define RIO_B115200 0x13 /* 115200 baud */ | 596 | #define RIO_B115200 0x13 /* 115200 baud */ |
603 | #define RIO_B2000 0x14 /* 2000 baud */ | 597 | #define RIO_B2000 0x14 /* 2000 baud */ |
604 | 598 | ||
605 | /***************************************************************************** | 599 | /***************************************************************************** |
606 | ********************************* ********************************* | 600 | ********************************* ********************************* |
@@ -636,7 +630,7 @@ typedef struct _PKT | |||
636 | No parameters. | 630 | No parameters. |
637 | */ | 631 | */ |
638 | #if 0 | 632 | #if 0 |
639 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 633 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
640 | #endif | 634 | #endif |
641 | /***************************************************************************** | 635 | /***************************************************************************** |
642 | ********************************* ********************************* | 636 | ********************************* ********************************* |
@@ -653,9 +647,9 @@ typedef struct _PKT | |||
653 | write flushing previously started by a pre-emptive WFLUSH packet. (in-band) | 647 | write flushing previously started by a pre-emptive WFLUSH packet. (in-band) |
654 | */ | 648 | */ |
655 | #if 0 | 649 | #if 0 |
656 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 650 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
657 | #endif | 651 | #endif |
658 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 652 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
659 | 653 | ||
660 | /***************************************************************************** | 654 | /***************************************************************************** |
661 | ********************************* ********************************* | 655 | ********************************* ********************************* |
@@ -669,8 +663,8 @@ typedef struct _PKT | |||
669 | packets of a port. | 663 | packets of a port. |
670 | */ | 664 | */ |
671 | #if 0 | 665 | #if 0 |
672 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 666 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
673 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 667 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
674 | #endif | 668 | #endif |
675 | 669 | ||
676 | /***************************************************************************** | 670 | /***************************************************************************** |
@@ -685,8 +679,8 @@ typedef struct _PKT | |||
685 | transmission of data if blocked by XOFF. (as if XON had been received) | 679 | transmission of data if blocked by XOFF. (as if XON had been received) |
686 | */ | 680 | */ |
687 | #if 0 | 681 | #if 0 |
688 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 682 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
689 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 683 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
690 | #endif | 684 | #endif |
691 | 685 | ||
692 | /***************************************************************************** | 686 | /***************************************************************************** |
@@ -707,9 +701,9 @@ typedef struct _PKT | |||
707 | specified number of mS. | 701 | specified number of mS. |
708 | */ | 702 | */ |
709 | #if 0 | 703 | #if 0 |
710 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 704 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
711 | #endif | 705 | #endif |
712 | #define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */ | 706 | #define PKT_BreakDelay (PKT_Data+1) /* Break delay in mS */ |
713 | 707 | ||
714 | /***************************************************************************** | 708 | /***************************************************************************** |
715 | ********************************* ********************************* | 709 | ********************************* ********************************* |
@@ -736,8 +730,8 @@ typedef struct _PKT | |||
736 | transmission of data. (as if XOFF had been received) | 730 | transmission of data. (as if XOFF had been received) |
737 | */ | 731 | */ |
738 | #if 0 | 732 | #if 0 |
739 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 733 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
740 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 734 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
741 | #endif | 735 | #endif |
742 | 736 | ||
743 | /***************************************************************************** | 737 | /***************************************************************************** |
@@ -753,8 +747,8 @@ typedef struct _PKT | |||
753 | modem signals if the COR5_HUPCL (Hang Up On Close) flag is set. | 747 | modem signals if the COR5_HUPCL (Hang Up On Close) flag is set. |
754 | */ | 748 | */ |
755 | #if 0 | 749 | #if 0 |
756 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 750 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
757 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 751 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
758 | #endif | 752 | #endif |
759 | 753 | ||
760 | /***************************************************************************** | 754 | /***************************************************************************** |
@@ -774,8 +768,8 @@ typedef struct _PKT | |||
774 | - Transparent Print Stop Sequence. | 768 | - Transparent Print Stop Sequence. |
775 | */ | 769 | */ |
776 | #if 0 | 770 | #if 0 |
777 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 771 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
778 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 772 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
779 | #endif | 773 | #endif |
780 | 774 | ||
781 | /***************************************************************************** | 775 | /***************************************************************************** |
@@ -789,14 +783,14 @@ typedef struct _PKT | |||
789 | MBIS is sent pre-emptively from the driver to set a port's modem signals. | 783 | MBIS is sent pre-emptively from the driver to set a port's modem signals. |
790 | */ | 784 | */ |
791 | #if 0 | 785 | #if 0 |
792 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 786 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
793 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 787 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
794 | #endif | 788 | #endif |
795 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ | 789 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ |
796 | 790 | ||
797 | /* ModemSet definitions... */ | 791 | /* ModemSet definitions... */ |
798 | #define MBIS_RTS 0x01 /* RTS modem signal */ | 792 | #define MBIS_RTS 0x01 /* RTS modem signal */ |
799 | #define MBIS_DTR 0x02 /* DTR modem signal */ | 793 | #define MBIS_DTR 0x02 /* DTR modem signal */ |
800 | 794 | ||
801 | /***************************************************************************** | 795 | /***************************************************************************** |
802 | ********************************** ********************************** | 796 | ********************************** ********************************** |
@@ -808,16 +802,16 @@ typedef struct _PKT | |||
808 | 802 | ||
809 | MBIC is sent pre-emptively from the driver to clear a port's modem signals. | 803 | MBIC is sent pre-emptively from the driver to clear a port's modem signals. |
810 | */ | 804 | */ |
811 | #if 0 | 805 | #if 0 |
812 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 806 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
813 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 807 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
814 | #endif | 808 | #endif |
815 | 809 | ||
816 | #define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */ | 810 | #define PKT_ModemClear (PKT_Data+4) /* Modem clear signals mask */ |
817 | 811 | ||
818 | /* ModemClear definitions... */ | 812 | /* ModemClear definitions... */ |
819 | #define MBIC_RTS 0x01 /* RTS modem signal */ | 813 | #define MBIC_RTS 0x01 /* RTS modem signal */ |
820 | #define MBIC_DTR 0x02 /* DTR modem signal */ | 814 | #define MBIC_DTR 0x02 /* DTR modem signal */ |
821 | 815 | ||
822 | /***************************************************************************** | 816 | /***************************************************************************** |
823 | ********************************** ********************************** | 817 | ********************************** ********************************** |
@@ -829,15 +823,15 @@ typedef struct _PKT | |||
829 | 823 | ||
830 | MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */ | 824 | MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */ |
831 | #if 0 | 825 | #if 0 |
832 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 826 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
833 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 827 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
834 | #endif | 828 | #endif |
835 | 829 | ||
836 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ | 830 | #define PKT_ModemSet (PKT_Data+4) /* Modem set signals mask */ |
837 | 831 | ||
838 | /* ModemSet definitions... */ | 832 | /* ModemSet definitions... */ |
839 | #define MSET_RTS 0x01 /* RTS modem signal */ | 833 | #define MSET_RTS 0x01 /* RTS modem signal */ |
840 | #define MSET_DTR 0x02 /* DTR modem signal */ | 834 | #define MSET_DTR 0x02 /* DTR modem signal */ |
841 | 835 | ||
842 | /***************************************************************************** | 836 | /***************************************************************************** |
843 | ********************************* ********************************* | 837 | ********************************* ********************************* |
@@ -853,7 +847,7 @@ typedef struct _PKT | |||
853 | port's transmit / receive and modem signals will be left enabled and the | 847 | port's transmit / receive and modem signals will be left enabled and the |
854 | port marked internally as Pseudo Closed. */ | 848 | port marked internally as Pseudo Closed. */ |
855 | 849 | ||
856 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 850 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
857 | 851 | ||
858 | /***************************************************************************** | 852 | /***************************************************************************** |
859 | ********************************** ********************************** | 853 | ********************************** ********************************** |
@@ -865,8 +859,8 @@ typedef struct _PKT | |||
865 | 859 | ||
866 | MGET is sent pre-emptively from the driver to request the port's current modem signals. */ | 860 | MGET is sent pre-emptively from the driver to request the port's current modem signals. */ |
867 | 861 | ||
868 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 862 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
869 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 863 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
870 | 864 | ||
871 | /***************************************************************************** | 865 | /***************************************************************************** |
872 | ********************************* ******************************** | 866 | ********************************* ******************************** |
@@ -880,11 +874,11 @@ typedef struct _PKT | |||
880 | of the specified port's RTA address space. | 874 | of the specified port's RTA address space. |
881 | */ | 875 | */ |
882 | #if 0 | 876 | #if 0 |
883 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 877 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
884 | #endif | 878 | #endif |
885 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 879 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
886 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 880 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
887 | #define PKT_Address (PKT_Data+6) /* Requested address */ | 881 | #define PKT_Address (PKT_Data+6) /* Requested address */ |
888 | 882 | ||
889 | /***************************************************************************** | 883 | /***************************************************************************** |
890 | ****************************** ***************************** | 884 | ****************************** ***************************** |
@@ -898,11 +892,11 @@ typedef struct _PKT | |||
898 | of the CD1400 register specified in address. | 892 | of the CD1400 register specified in address. |
899 | */ | 893 | */ |
900 | #if 0 | 894 | #if 0 |
901 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 895 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
902 | #endif | 896 | #endif |
903 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 897 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
904 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 898 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
905 | #define PKT_Address (PKT_Data+6) /* Requested address */ | 899 | #define PKT_Address (PKT_Data+6) /* Requested address */ |
906 | 900 | ||
907 | /***************************************************************************** | 901 | /***************************************************************************** |
908 | ************************ ************************** | 902 | ************************ ************************** |
@@ -916,33 +910,33 @@ typedef struct _PKT | |||
916 | packets, except MEMDUMP and READ_REGISTER. | 910 | packets, except MEMDUMP and READ_REGISTER. |
917 | */ | 911 | */ |
918 | #if 0 | 912 | #if 0 |
919 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 913 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
920 | #endif | 914 | #endif |
921 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 915 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
922 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 916 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
923 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 917 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
924 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 918 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
925 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 919 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
926 | 920 | ||
927 | /* ModemStatus definitions... */ | 921 | /* ModemStatus definitions... */ |
928 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ | 922 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ |
929 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ | 923 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ |
930 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ | 924 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ |
931 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ | 925 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ |
932 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ | 926 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ |
933 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ | 927 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ |
934 | #define MODEM_DTR 0x02 /* DTR modem output state */ | 928 | #define MODEM_DTR 0x02 /* DTR modem output state */ |
935 | #define MODEM_RTS 0x01 /* RTS modem output state */ | 929 | #define MODEM_RTS 0x01 /* RTS modem output state */ |
936 | 930 | ||
937 | /* PortStatus definitions... */ | 931 | /* PortStatus definitions... */ |
938 | #define PORT_ISOPEN 0x01 /* Port open ? */ | 932 | #define PORT_ISOPEN 0x01 /* Port open ? */ |
939 | #define PORT_HUPCL 0x02 /* Hangup on close? */ | 933 | #define PORT_HUPCL 0x02 /* Hangup on close? */ |
940 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ | 934 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ |
941 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ | 935 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ |
942 | #define PORT_BREAK 0x10 /* Port on break */ | 936 | #define PORT_BREAK 0x10 /* Port on break */ |
943 | #define PORT_STATUSPEND 0020 /* Status packet pending */ | 937 | #define PORT_STATUSPEND 0020 /* Status packet pending */ |
944 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ | 938 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ |
945 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ | 939 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ |
946 | 940 | ||
947 | /***************************************************************************** | 941 | /***************************************************************************** |
948 | ************************ ************************** | 942 | ************************ ************************** |
@@ -956,35 +950,35 @@ typedef struct _PKT | |||
956 | packets, except MEMDUMP and READ_REGISTER. | 950 | packets, except MEMDUMP and READ_REGISTER. |
957 | */ | 951 | */ |
958 | #if 0 | 952 | #if 0 |
959 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 953 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
960 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 954 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
961 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 955 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
962 | #endif | 956 | #endif |
963 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 957 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
964 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 958 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
965 | #if 0 | 959 | #if 0 |
966 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 960 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
967 | #endif | 961 | #endif |
968 | 962 | ||
969 | /* ModemStatus definitions... */ | 963 | /* ModemStatus definitions... */ |
970 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ | 964 | #define MODEM_DSR 0x80 /* Data Set Ready modem state */ |
971 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ | 965 | #define MODEM_CTS 0x40 /* Clear To Send modem state */ |
972 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ | 966 | #define MODEM_RI 0x20 /* Ring Indicate modem state */ |
973 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ | 967 | #define MODEM_CD 0x10 /* Carrier Detect modem state */ |
974 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ | 968 | #define MODEM_TSTOP 0x08 /* Transmit Stopped state */ |
975 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ | 969 | #define MODEM_TEMPTY 0x04 /* Transmit Empty state */ |
976 | #define MODEM_DTR 0x02 /* DTR modem output state */ | 970 | #define MODEM_DTR 0x02 /* DTR modem output state */ |
977 | #define MODEM_RTS 0x01 /* RTS modem output state */ | 971 | #define MODEM_RTS 0x01 /* RTS modem output state */ |
978 | 972 | ||
979 | /* PortStatus definitions... */ | 973 | /* PortStatus definitions... */ |
980 | #define PORT_ISOPEN 0x01 /* Port open ? */ | 974 | #define PORT_ISOPEN 0x01 /* Port open ? */ |
981 | #define PORT_HUPCL 0x02 /* Hangup on close? */ | 975 | #define PORT_HUPCL 0x02 /* Hangup on close? */ |
982 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ | 976 | #define PORT_MOPENPEND 0x04 /* Modem open pending */ |
983 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ | 977 | #define PORT_ISPARALLEL 0x08 /* Parallel port */ |
984 | #define PORT_BREAK 0x10 /* Port on break */ | 978 | #define PORT_BREAK 0x10 /* Port on break */ |
985 | #define PORT_STATUSPEND 0020 /* Status packet pending */ | 979 | #define PORT_STATUSPEND 0020 /* Status packet pending */ |
986 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ | 980 | #define PORT_BREAKPEND 0x40 /* Break packet pending */ |
987 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ | 981 | #define PORT_MODEMPEND 0x80 /* Modem status packet pending */ |
988 | 982 | ||
989 | /***************************************************************************** | 983 | /***************************************************************************** |
990 | ******************** ******************** | 984 | ******************** ******************** |
@@ -998,15 +992,15 @@ typedef struct _PKT | |||
998 | port I/O control command packet. | 992 | port I/O control command packet. |
999 | */ | 993 | */ |
1000 | #if 0 | 994 | #if 0 |
1001 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 995 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1002 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 996 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
1003 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 997 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1004 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 998 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
1005 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 999 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
1006 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 1000 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
1007 | #define PKT_Address (PKT_Data+6) /* Requested address */ | 1001 | #define PKT_Address (PKT_Data+6) /* Requested address */ |
1008 | #endif | 1002 | #endif |
1009 | #define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */ | 1003 | #define PKT_Dump (PKT_Data+8) /* 32bytes of requested dump data */ |
1010 | 1004 | ||
1011 | /***************************************************************************** | 1005 | /***************************************************************************** |
1012 | ***************** ***************** | 1006 | ***************** ***************** |
@@ -1020,14 +1014,14 @@ typedef struct _PKT | |||
1020 | READ_REGISTER port I/O control command packet. | 1014 | READ_REGISTER port I/O control command packet. |
1021 | */ | 1015 | */ |
1022 | #if 0 | 1016 | #if 0 |
1023 | #define PKT_Cmd (PKT_Data+0) /*Command code */ | 1017 | #define PKT_Cmd (PKT_Data+0) /*Command code */ |
1024 | #define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */ | 1018 | #define PKT_PhbNum (PKT_Data+1) /*Port number wrt RTA */ |
1025 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 1019 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1026 | #endif | 1020 | #endif |
1027 | #define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */ | 1021 | #define PKT_RegisterValue (PKT_Data+3) /* Modem signal status */ |
1028 | #if 0 | 1022 | #if 0 |
1029 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ | 1023 | #define PKT_PortStatus (PKT_Data+4) /* Port signal status */ |
1030 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ | 1024 | #define PKT_SubCmd (PKT_Data+5) /* Sub Command */ |
1031 | #endif | 1025 | #endif |
1032 | 1026 | ||
1033 | /***************************************************************************** | 1027 | /***************************************************************************** |
@@ -1041,9 +1035,9 @@ typedef struct _PKT | |||
1041 | COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal. | 1035 | COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal. |
1042 | */ | 1036 | */ |
1043 | #if 0 | 1037 | #if 0 |
1044 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1038 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1045 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 1039 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
1046 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 1040 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1047 | #endif | 1041 | #endif |
1048 | 1042 | ||
1049 | /***************************************************************************** | 1043 | /***************************************************************************** |
@@ -1059,10 +1053,10 @@ typedef struct _PKT | |||
1059 | 1053 | ||
1060 | */ | 1054 | */ |
1061 | #if 0 | 1055 | #if 0 |
1062 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1056 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1063 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ | 1057 | #define PKT_PhbNum (PKT_Data+1) /* Port number wrt RTA */ |
1064 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ | 1058 | #define PKT_Cmd2 (PKT_Data+2) /* Command code copy */ |
1065 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ | 1059 | #define PKT_ModemStatus (PKT_Data+3) /* Modem signal status */ |
1066 | #endif | 1060 | #endif |
1067 | 1061 | ||
1068 | /***************************************************************************** | 1062 | /***************************************************************************** |
@@ -1077,7 +1071,7 @@ typedef struct _PKT | |||
1077 | firmware code to load onto attached RTAs. | 1071 | firmware code to load onto attached RTAs. |
1078 | */ | 1072 | */ |
1079 | #if 0 | 1073 | #if 0 |
1080 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1074 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1081 | #endif | 1075 | #endif |
1082 | 1076 | ||
1083 | /***************************************************************************** | 1077 | /***************************************************************************** |
@@ -1092,12 +1086,12 @@ typedef struct _PKT | |||
1092 | to a BOOT_RUP - BOOT_REQUEST packet. | 1086 | to a BOOT_RUP - BOOT_REQUEST packet. |
1093 | */ | 1087 | */ |
1094 | #if 0 | 1088 | #if 0 |
1095 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1089 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1096 | #endif | 1090 | #endif |
1097 | #define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */ | 1091 | #define PKT_NumPackets (PKT_Data+2) /* Packets required to load firmware */ |
1098 | #define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */ | 1092 | #define PKT_LoadBase (PKT_Data+4) /* RTA firmware load address */ |
1099 | #define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */ | 1093 | #define PKT_CodeSize (PKT_Data+6) /* Size of firmware in bytes */ |
1100 | #define PKT_CmdString (PKT_Data+8) /* Command string */ | 1094 | #define PKT_CmdString (PKT_Data+8) /* Command string */ |
1101 | 1095 | ||
1102 | /***************************************************************************** | 1096 | /***************************************************************************** |
1103 | ************************ *********************** | 1097 | ************************ *********************** |
@@ -1111,10 +1105,10 @@ typedef struct _PKT | |||
1111 | RTA firmware has completed. | 1105 | RTA firmware has completed. |
1112 | */ | 1106 | */ |
1113 | #if 0 | 1107 | #if 0 |
1114 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1108 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1115 | #endif | 1109 | #endif |
1116 | #define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */ | 1110 | #define PKT_LinkNumber (PKT_Data+1) /* Link number RTA booted on */ |
1117 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ | 1111 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ |
1118 | 1112 | ||
1119 | /***************************************************************************** | 1113 | /***************************************************************************** |
1120 | ************************ *********************** | 1114 | ************************ *********************** |
@@ -1127,7 +1121,7 @@ typedef struct _PKT | |||
1127 | BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent | 1121 | BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent |
1128 | from RIO to the Driver as a request for a firmware boot packet. */ | 1122 | from RIO to the Driver as a request for a firmware boot packet. */ |
1129 | 1123 | ||
1130 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ | 1124 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ |
1131 | 1125 | ||
1132 | /***************************************************************************** | 1126 | /***************************************************************************** |
1133 | *********************** *********************** | 1127 | *********************** *********************** |
@@ -1141,9 +1135,9 @@ typedef struct _PKT | |||
1141 | packet with the 70 bytes of the requested sequence. | 1135 | packet with the 70 bytes of the requested sequence. |
1142 | */ | 1136 | */ |
1143 | #if 0 | 1137 | #if 0 |
1144 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ | 1138 | #define PKT_SequenceNumber (PKT_Data+0) /* Packet sequence number */ |
1145 | #endif | 1139 | #endif |
1146 | #define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */ | 1140 | #define PKT_FirmwarePacket (PKT_Data+2) /* Firmware packet */ |
1147 | 1141 | ||
1148 | /***************************************************************************** | 1142 | /***************************************************************************** |
1149 | **************************** **************************** | 1143 | **************************** **************************** |
@@ -1157,10 +1151,10 @@ typedef struct _PKT | |||
1157 | RTA to shut down and reboot. | 1151 | RTA to shut down and reboot. |
1158 | */ | 1152 | */ |
1159 | #if 0 | 1153 | #if 0 |
1160 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1154 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1161 | #endif | 1155 | #endif |
1162 | #define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */ | 1156 | #define PKT_IfoadId1 (PKT_Data+2) /* IFOAD Id 1 */ |
1163 | #define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */ | 1157 | #define PKT_IfoadId2 (PKT_Data+3) /* IFOAD Id 2 */ |
1164 | 1158 | ||
1165 | #define IFOADID1 0xAD | 1159 | #define IFOADID1 0xAD |
1166 | #define IFOADID2 0xF0 | 1160 | #define IFOADID2 0xF0 |
@@ -1177,9 +1171,9 @@ typedef struct _PKT | |||
1177 | RTA to flash its LEDs for a period of time. | 1171 | RTA to flash its LEDs for a period of time. |
1178 | */ | 1172 | */ |
1179 | #if 0 | 1173 | #if 0 |
1180 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1174 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1181 | #endif | 1175 | #endif |
1182 | #define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */ | 1176 | #define PKT_IdentifyId (PKT_Data+2) /* defines pattern to flash */ |
1183 | 1177 | ||
1184 | /***************************************************************************** | 1178 | /***************************************************************************** |
1185 | **************************** *************************** | 1179 | **************************** *************************** |
@@ -1193,10 +1187,10 @@ typedef struct _PKT | |||
1193 | RTA to shut down and flash it's LEDs. | 1187 | RTA to shut down and flash it's LEDs. |
1194 | */ | 1188 | */ |
1195 | #if 0 | 1189 | #if 0 |
1196 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1190 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1197 | #endif | 1191 | #endif |
1198 | #define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */ | 1192 | #define PKT_ZombieId1 (PKT_Data+2) /* ZOMBIE Id 1 */ |
1199 | #define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */ | 1193 | #define PKT_ZombieId2 (PKT_Data+3) /* ZOMBIE Id 2 */ |
1200 | 1194 | ||
1201 | #define ZOMBIEID1 0x52 | 1195 | #define ZOMBIEID1 0x52 |
1202 | #define ZOMBIEID2 0x21 | 1196 | #define ZOMBIEID2 0x21 |
@@ -1213,11 +1207,11 @@ typedef struct _PKT | |||
1213 | to ask it's neighbouring RTA to shut down and reboot. | 1207 | to ask it's neighbouring RTA to shut down and reboot. |
1214 | */ | 1208 | */ |
1215 | #if 0 | 1209 | #if 0 |
1216 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1210 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1217 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ | 1211 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ |
1218 | #endif | 1212 | #endif |
1219 | #define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */ | 1213 | #define PKT_UfoadId1 (PKT_Data+2) /* UFOAD Id 1 */ |
1220 | #define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */ | 1214 | #define PKT_UfoadId2 (PKT_Data+3) /* UFOAD Id 2 */ |
1221 | 1215 | ||
1222 | #define UFOADID1 0x1E | 1216 | #define UFOADID1 0x1E |
1223 | #define UFOADID2 0x0D | 1217 | #define UFOADID2 0x0D |
@@ -1234,11 +1228,11 @@ typedef struct _PKT | |||
1234 | to pause booting on the specified link for 30 seconds. | 1228 | to pause booting on the specified link for 30 seconds. |
1235 | */ | 1229 | */ |
1236 | #if 0 | 1230 | #if 0 |
1237 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1231 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1238 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ | 1232 | #define PKT_LinkNumber (PKT_Data+1) /* Link number of RTA to UFOAD */ |
1239 | #endif | 1233 | #endif |
1240 | #define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */ | 1234 | #define PKT_IwaitId1 (PKT_Data+2) /* IWAIT Id 1 */ |
1241 | #define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */ | 1235 | #define PKT_IwaitId2 (PKT_Data+3) /* IWAIT Id 2 */ |
1242 | 1236 | ||
1243 | #define IWAITID1 0xDE | 1237 | #define IWAITID1 0xDE |
1244 | #define IWAITID2 0xB1 | 1238 | #define IWAITID2 0xB1 |
@@ -1255,20 +1249,20 @@ typedef struct _PKT | |||
1255 | RTA to a Driver to request an ID (RUP or unit number). | 1249 | RTA to a Driver to request an ID (RUP or unit number). |
1256 | */ | 1250 | */ |
1257 | #if 0 | 1251 | #if 0 |
1258 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1252 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1259 | #endif | 1253 | #endif |
1260 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ | 1254 | #define PKT_SerialNumber (PKT_Data+2) /* 4 byte serial number */ |
1261 | #define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */ | 1255 | #define PKT_ModuleTypes (PKT_Data+6) /* RTA Module types */ |
1262 | 1256 | ||
1263 | /* ModuleTypes definitions... */ | 1257 | /* ModuleTypes definitions... */ |
1264 | #define MOD_BLANK 0x0F /* Blank plate attached */ | 1258 | #define MOD_BLANK 0x0F /* Blank plate attached */ |
1265 | #define MOD_RS232DB25 0x00 /* RS232 DB25 connector */ | 1259 | #define MOD_RS232DB25 0x00 /* RS232 DB25 connector */ |
1266 | #define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */ | 1260 | #define MOD_RS232RJ45 0x01 /* RS232 RJ45 connector */ |
1267 | #define MOD_RS422DB25 0x02 /* RS422 DB25 connector */ | 1261 | #define MOD_RS422DB25 0x02 /* RS422 DB25 connector */ |
1268 | #define MOD_RS485DB25 0x03 /* RS485 DB25 connector */ | 1262 | #define MOD_RS485DB25 0x03 /* RS485 DB25 connector */ |
1269 | #define MOD_PARALLEL 0x04 /* Centronics parallel */ | 1263 | #define MOD_PARALLEL 0x04 /* Centronics parallel */ |
1270 | 1264 | ||
1271 | #define MOD2 0x08 /* Set to indicate Rev2 module */ | 1265 | #define MOD2 0x08 /* Set to indicate Rev2 module */ |
1272 | 1266 | ||
1273 | /***************************************************************************** | 1267 | /***************************************************************************** |
1274 | ************************* ************************* | 1268 | ************************* ************************* |
@@ -1282,9 +1276,9 @@ typedef struct _PKT | |||
1282 | packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot. | 1276 | packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot. |
1283 | */ | 1277 | */ |
1284 | #if 0 | 1278 | #if 0 |
1285 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1279 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1286 | #endif | 1280 | #endif |
1287 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ | 1281 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ |
1288 | 1282 | ||
1289 | /***************************************************************************** | 1283 | /***************************************************************************** |
1290 | *********************** *********************** | 1284 | *********************** *********************** |
@@ -1298,13 +1292,13 @@ typedef struct _PKT | |||
1298 | packet to allocate the RTA's Id number (RUP number 1..16) | 1292 | packet to allocate the RTA's Id number (RUP number 1..16) |
1299 | */ | 1293 | */ |
1300 | #if 0 | 1294 | #if 0 |
1301 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1295 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1302 | #endif | 1296 | #endif |
1303 | #define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */ | 1297 | #define PKT_IdNum (PKT_Data+1) /* RUP number for ports 1..8 */ |
1304 | #if 0 | 1298 | #if 0 |
1305 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ | 1299 | #define PKT_RouteCmdString (PKT_Data+2) /* Command string */ |
1306 | #endif | 1300 | #endif |
1307 | #define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */ | 1301 | #define PKT_IdNum2 (PKT_Data+0x17) /* RUP number for ports 9..16 */ |
1308 | 1302 | ||
1309 | /***************************************************************************** | 1303 | /***************************************************************************** |
1310 | *********************** *********************** | 1304 | *********************** *********************** |
@@ -1318,18 +1312,18 @@ typedef struct _PKT | |||
1318 | current link status. | 1312 | current link status. |
1319 | */ | 1313 | */ |
1320 | #if 0 | 1314 | #if 0 |
1321 | #define PKT_Cmd (PKT_Data+0) /* Command code */ | 1315 | #define PKT_Cmd (PKT_Data+0) /* Command code */ |
1322 | #endif | 1316 | #endif |
1323 | #define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */ | 1317 | #define PKT_Link1Rup (PKT_Data+2) /* Link 1 RUP number */ |
1324 | #define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */ | 1318 | #define PKT_Link1Link (PKT_Data+3) /* Link 1 link number */ |
1325 | #define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */ | 1319 | #define PKT_Link2Rup (PKT_Data+4) /* Link 2 RUP number */ |
1326 | #define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */ | 1320 | #define PKT_Link2Link (PKT_Data+5) /* Link 2 link number */ |
1327 | #define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */ | 1321 | #define PKT_Link3Rup (PKT_Data+6) /* Link 3 RUP number */ |
1328 | #define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */ | 1322 | #define PKT_Link3Link (PKT_Data+7) /* Link 3 link number */ |
1329 | #define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */ | 1323 | #define PKT_Link4Rup (PKT_Data+8) /* Link 4 RUP number */ |
1330 | #define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */ | 1324 | #define PKT_Link4Link (PKT_Data+9) /* Link 4 link number */ |
1331 | #define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */ | 1325 | #define PKT_RtaVpdProm (PKT_Data+10) /* 32 bytes of RTA VPD PROM Contents */ |
1332 | 1326 | ||
1333 | #endif /* _sxwinif_h */ | 1327 | #endif /* _sxwinif_h */ |
1334 | 1328 | ||
1335 | /* End of RIOWINIF.H */ | 1329 | /* End of RIOWINIF.H */ |
diff --git a/drivers/char/rio/riscos.h b/drivers/char/rio/riscos.h index 7685cc1d9e7b..60d66d0056ae 100644 --- a/drivers/char/rio/riscos.h +++ b/drivers/char/rio/riscos.h | |||
@@ -60,4 +60,4 @@ static char *_riscos_h_sccs_ = "@(#)riscos.h 1.2"; | |||
60 | #define RINDW(A) (*(ushort *)(A)) | 60 | #define RINDW(A) (*(ushort *)(A)) |
61 | #define WINDW(A,V) (*(ushort *)(A)=(ushort)(V)) | 61 | #define WINDW(A,V) (*(ushort *)(A)=(ushort)(V)) |
62 | 62 | ||
63 | #endif /* __rio_riscos_h__ */ | 63 | #endif /* __rio_riscos_h__ */ |
diff --git a/drivers/char/rio/rom.h b/drivers/char/rio/rom.h index ee79b8e5b972..58a7843625ff 100644 --- a/drivers/char/rio/rom.h +++ b/drivers/char/rio/rom.h | |||
@@ -39,19 +39,19 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS | 41 | #ifdef SCCS |
42 | static char *_rio_rom_h_sccs = "@(#)rom.h 1.1" ; | 42 | static char *_rio_rom_h_sccs = "@(#)rom.h 1.1"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | typedef struct ROM ROM ; | 46 | typedef struct ROM ROM; |
47 | struct ROM { | 47 | struct ROM { |
48 | u_short slx ; | 48 | u_short slx; |
49 | char pcb_letter_rev ; | 49 | char pcb_letter_rev; |
50 | char pcb_number_rev ; | 50 | char pcb_number_rev; |
51 | char serial[4] ; | 51 | char serial[4]; |
52 | char year ; | 52 | char year; |
53 | char week ; | 53 | char week; |
54 | } ; | 54 | }; |
55 | 55 | ||
56 | #endif | 56 | #endif |
57 | 57 | ||
@@ -60,5 +60,3 @@ struct ROM { | |||
60 | #define ROM_LENGTH 0x20 | 60 | #define ROM_LENGTH 0x20 |
61 | 61 | ||
62 | /*********** end of file ***********/ | 62 | /*********** end of file ***********/ |
63 | |||
64 | |||
diff --git a/drivers/char/rio/route.h b/drivers/char/rio/route.h index c42dbb971718..769744e575ab 100644 --- a/drivers/char/rio/route.h +++ b/drivers/char/rio/route.h | |||
@@ -44,26 +44,26 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #define MAX_LINKS 4 | 46 | #define MAX_LINKS 4 |
47 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ | 47 | #define MAX_NODES 17 /* Maximum nodes in a subnet */ |
48 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for | 48 | #define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for |
49 | 1 bit per node */ | 49 | 1 bit per node */ |
50 | #define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete | 50 | #define ROUTE_DATA_SIZE (NODE_BYTES + 2) /* Number of bytes for complete |
51 | info about cost etc. */ | 51 | info about cost etc. */ |
52 | #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE) | 52 | #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE) |
53 | /* Number of nodes we can squeeze | 53 | /* Number of nodes we can squeeze |
54 | into one packet */ | 54 | into one packet */ |
55 | #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1) | 55 | #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1) |
56 | /************************************************ | 56 | /************************************************ |
57 | * Define the types of command for the ROUTE RUP. | 57 | * Define the types of command for the ROUTE RUP. |
58 | ************************************************/ | 58 | ************************************************/ |
59 | #define ROUTE_REQUEST 0 /* Request an ID */ | 59 | #define ROUTE_REQUEST 0 /* Request an ID */ |
60 | #define ROUTE_FOAD 1 /* Kill the RTA */ | 60 | #define ROUTE_FOAD 1 /* Kill the RTA */ |
61 | #define ROUTE_ALREADY 2 /* ID given already */ | 61 | #define ROUTE_ALREADY 2 /* ID given already */ |
62 | #define ROUTE_USED 3 /* All ID's used */ | 62 | #define ROUTE_USED 3 /* All ID's used */ |
63 | #define ROUTE_ALLOCATE 4 /* Here it is */ | 63 | #define ROUTE_ALLOCATE 4 /* Here it is */ |
64 | #define ROUTE_REQ_TOP 5 /* I bet you didn't expect.... | 64 | #define ROUTE_REQ_TOP 5 /* I bet you didn't expect.... |
65 | the Topological Inquisition */ | 65 | the Topological Inquisition */ |
66 | #define ROUTE_TOPOLOGY 6 /* Topology request answered FD */ | 66 | #define ROUTE_TOPOLOGY 6 /* Topology request answered FD */ |
67 | /******************************************************************* | 67 | /******************************************************************* |
68 | * Define the Route Map Structure | 68 | * Define the Route Map Structure |
69 | * | 69 | * |
@@ -72,22 +72,22 @@ | |||
72 | ******************************************************************/ | 72 | ******************************************************************/ |
73 | typedef struct COST_ROUTE COST_ROUTE; | 73 | typedef struct COST_ROUTE COST_ROUTE; |
74 | struct COST_ROUTE { | 74 | struct COST_ROUTE { |
75 | unsigned char cost; /* Cost down this link */ | 75 | unsigned char cost; /* Cost down this link */ |
76 | unsigned char route[NODE_BYTES]; /* Nodes thorough this route */ | 76 | unsigned char route[NODE_BYTES]; /* Nodes thorough this route */ |
77 | } ; | 77 | }; |
78 | 78 | ||
79 | typedef struct ROUTE_STR ROUTE_STR ; | 79 | typedef struct ROUTE_STR ROUTE_STR; |
80 | struct ROUTE_STR { | 80 | struct ROUTE_STR { |
81 | COST_ROUTE cost_route[MAX_LINKS]; | 81 | COST_ROUTE cost_route[MAX_LINKS]; |
82 | /* cost / route for this link */ | 82 | /* cost / route for this link */ |
83 | ushort favoured; /* favoured link */ | 83 | ushort favoured; /* favoured link */ |
84 | } ; | 84 | }; |
85 | 85 | ||
86 | 86 | ||
87 | #define NO_LINK (short) 5 /* Link unattached */ | 87 | #define NO_LINK (short) 5 /* Link unattached */ |
88 | #define ROUTE_NO_ID (short) 100 /* No Id */ | 88 | #define ROUTE_NO_ID (short) 100 /* No Id */ |
89 | #define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */ | 89 | #define ROUTE_DISCONNECT (ushort) 0xff /* Not connected */ |
90 | #define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */ | 90 | #define ROUTE_INTERCONNECT (ushort) 0x40 /* Sub-net interconnect */ |
91 | 91 | ||
92 | 92 | ||
93 | #define SYNC_RUP (ushort) 255 | 93 | #define SYNC_RUP (ushort) 255 |
@@ -99,10 +99,9 @@ struct ROUTE_STR { | |||
99 | #define STATUS_RUP (ushort) 249 | 99 | #define STATUS_RUP (ushort) 249 |
100 | #define POWER_RUP (ushort) 248 | 100 | #define POWER_RUP (ushort) 248 |
101 | 101 | ||
102 | #define HIGHEST_RUP (ushort) 255 /* Set to Top one */ | 102 | #define HIGHEST_RUP (ushort) 255 /* Set to Top one */ |
103 | #define LOWEST_RUP (ushort) 248 /* Set to bottom one */ | 103 | #define LOWEST_RUP (ushort) 248 /* Set to bottom one */ |
104 | 104 | ||
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | /*********** end of file ***********/ | 107 | /*********** end of file ***********/ |
108 | |||
diff --git a/drivers/char/rio/rtahw.h b/drivers/char/rio/rtahw.h index 06860118cbc5..e6c2cdfd3a1f 100644 --- a/drivers/char/rio/rtahw.h +++ b/drivers/char/rio/rtahw.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5" ; | 40 | static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -58,12 +58,12 @@ static char *_rio_rtahw_h_sccs = "@(#)rtahw.h 1.5" ; | |||
58 | ** Define the different types of modules we can have | 58 | ** Define the different types of modules we can have |
59 | */ | 59 | */ |
60 | enum module { | 60 | enum module { |
61 | MOD_BLANK = 0x0f, /* Blank plate attached */ | 61 | MOD_BLANK = 0x0f, /* Blank plate attached */ |
62 | MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */ | 62 | MOD_RS232DB25 = 0x00, /* RS232 DB25 connector */ |
63 | MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */ | 63 | MOD_RS232RJ45 = 0x01, /* RS232 RJ45 connector */ |
64 | MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */ | 64 | MOD_RS422DB25 = 0x02, /* RS422 DB25 connector */ |
65 | MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */ | 65 | MOD_RS485DB25 = 0x03, /* RS485 DB25 connector */ |
66 | MOD_PARALLEL = 0x04 /* Centronics parallel */ | 66 | MOD_PARALLEL = 0x04 /* Centronics parallel */ |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define TYPE_HOST 0 | 69 | #define TYPE_HOST 0 |
diff --git a/drivers/char/rio/rup.h b/drivers/char/rio/rup.h index b9d2bc03d14b..8d44fec91dd5 100644 --- a/drivers/char/rio/rup.h +++ b/drivers/char/rio/rup.h | |||
@@ -44,39 +44,38 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #if defined( HOST ) || defined( INKERNEL ) | 46 | #if defined( HOST ) || defined( INKERNEL ) |
47 | #define MAX_RUP ((short) 16) | 47 | #define MAX_RUP ((short) 16) |
48 | #endif | 48 | #endif |
49 | #ifdef RTA | 49 | #ifdef RTA |
50 | #define MAX_RUP ((short) 1) | 50 | #define MAX_RUP ((short) 1) |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ | 53 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ |
54 | 54 | ||
55 | /************************************************* | 55 | /************************************************* |
56 | * Define all the packet request stuff | 56 | * Define all the packet request stuff |
57 | ************************************************/ | 57 | ************************************************/ |
58 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ | 58 | #define TX_RUP_INACTIVE 0 /* Nothing to transmit */ |
59 | #define TX_PACKET_READY 1 /* Transmit packet ready */ | 59 | #define TX_PACKET_READY 1 /* Transmit packet ready */ |
60 | #define TX_LOCK_RUP 2 /* Transmit side locked */ | 60 | #define TX_LOCK_RUP 2 /* Transmit side locked */ |
61 | 61 | ||
62 | #define RX_RUP_INACTIVE 0 /* Nothing received */ | 62 | #define RX_RUP_INACTIVE 0 /* Nothing received */ |
63 | #define RX_PACKET_READY 1 /* Packet received */ | 63 | #define RX_PACKET_READY 1 /* Packet received */ |
64 | 64 | ||
65 | #define RUP_NO_OWNER 0xff /* RUP not owned by any process */ | 65 | #define RUP_NO_OWNER 0xff /* RUP not owned by any process */ |
66 | 66 | ||
67 | struct RUP { | 67 | struct RUP { |
68 | PKT_ptr txpkt; /* Outgoing packet */ | 68 | PKT_ptr txpkt; /* Outgoing packet */ |
69 | PKT_ptr rxpkt; /* Incoming packet */ | 69 | PKT_ptr rxpkt; /* Incoming packet */ |
70 | WORD link; /* Which link to send down? */ | 70 | WORD link; /* Which link to send down? */ |
71 | BYTE rup_dest_unit[2]; /* Destination unit */ | 71 | BYTE rup_dest_unit[2]; /* Destination unit */ |
72 | WORD handshake; /* For handshaking */ | 72 | WORD handshake; /* For handshaking */ |
73 | WORD timeout; /* Timeout */ | 73 | WORD timeout; /* Timeout */ |
74 | WORD status; /* Status */ | 74 | WORD status; /* Status */ |
75 | WORD txcontrol; /* Transmit control */ | 75 | WORD txcontrol; /* Transmit control */ |
76 | WORD rxcontrol; /* Receive control */ | 76 | WORD rxcontrol; /* Receive control */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | /*********** end of file ***********/ | 81 | /*********** end of file ***********/ |
82 | |||
diff --git a/drivers/char/rio/rupstat.h b/drivers/char/rio/rupstat.h index b4aafaff0d78..56d828c63d28 100644 --- a/drivers/char/rio/rupstat.h +++ b/drivers/char/rio/rupstat.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifndef lint | 40 | #ifndef lint |
41 | #ifdef SCCS_LABELS | 41 | #ifdef SCCS_LABELS |
42 | static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ; | 42 | static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1"; |
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
@@ -48,4 +48,3 @@ static char *_rio_rupstat_h_sccs = "@(#)rupstat.h 1.1" ; | |||
48 | #define STATUS_TOPOLOGY 2 | 48 | #define STATUS_TOPOLOGY 2 |
49 | 49 | ||
50 | #endif | 50 | #endif |
51 | |||
diff --git a/drivers/char/rio/sam.h b/drivers/char/rio/sam.h index c1accb8cb624..31494054b213 100644 --- a/drivers/char/rio/sam.h +++ b/drivers/char/rio/sam.h | |||
@@ -60,15 +60,12 @@ | |||
60 | #define RX FALSE | 60 | #define RX FALSE |
61 | 61 | ||
62 | 62 | ||
63 | typedef struct FREE_LIST FREE_LIST ; | 63 | typedef struct FREE_LIST FREE_LIST; |
64 | struct FREE_LIST { | 64 | struct FREE_LIST { |
65 | FREE_LIST_ptr next ; | 65 | FREE_LIST_ptr next; |
66 | FREE_LIST_ptr prev ; | 66 | FREE_LIST_ptr prev; |
67 | } ; | 67 | }; |
68 | 68 | ||
69 | 69 | ||
70 | #endif | 70 | #endif |
71 | /*********** end of file ***********/ | 71 | /*********** end of file ***********/ |
72 | |||
73 | |||
74 | |||
diff --git a/drivers/char/rio/selftest.h b/drivers/char/rio/selftest.h index deae48722a21..7a3dba352323 100644 --- a/drivers/char/rio/selftest.h +++ b/drivers/char/rio/selftest.h | |||
@@ -38,36 +38,36 @@ | |||
38 | ** selftest on a booting RTA. | 38 | ** selftest on a booting RTA. |
39 | */ | 39 | */ |
40 | typedef struct { | 40 | typedef struct { |
41 | short magic; /* Identifies packet type */ | 41 | short magic; /* Identifies packet type */ |
42 | int test; /* Test number, see below */ | 42 | int test; /* Test number, see below */ |
43 | unsigned int result; /* Result value */ | 43 | unsigned int result; /* Result value */ |
44 | unsigned int dataIn; | 44 | unsigned int dataIn; |
45 | unsigned int dataOut; | 45 | unsigned int dataOut; |
46 | }selftestStruct; | 46 | } selftestStruct; |
47 | 47 | ||
48 | /* | 48 | /* |
49 | ** The different tests are identified by the following data values. | 49 | ** The different tests are identified by the following data values. |
50 | */ | 50 | */ |
51 | enum test { | 51 | enum test { |
52 | TESTS_COMPLETE = 0x00, | 52 | TESTS_COMPLETE = 0x00, |
53 | MEMTEST_ADDR = 0x01, | 53 | MEMTEST_ADDR = 0x01, |
54 | MEMTEST_BIT = 0x02, | 54 | MEMTEST_BIT = 0x02, |
55 | MEMTEST_FILL = 0x03, | 55 | MEMTEST_FILL = 0x03, |
56 | MEMTEST_DATABUS = 0x04, | 56 | MEMTEST_DATABUS = 0x04, |
57 | MEMTEST_ADDRBUS = 0x05, | 57 | MEMTEST_ADDRBUS = 0x05, |
58 | CD1400_INIT = 0x10, | 58 | CD1400_INIT = 0x10, |
59 | CD1400_LOOP = 0x11, | 59 | CD1400_LOOP = 0x11, |
60 | CD1400_INTERRUPT = 0x12 | 60 | CD1400_INTERRUPT = 0x12 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | enum result { | 63 | enum result { |
64 | E_PORT = 0x10, | 64 | E_PORT = 0x10, |
65 | E_TX = 0x11, | 65 | E_TX = 0x11, |
66 | E_RX = 0x12, | 66 | E_RX = 0x12, |
67 | E_EXCEPT = 0x13, | 67 | E_EXCEPT = 0x13, |
68 | E_COMPARE = 0x14, | 68 | E_COMPARE = 0x14, |
69 | E_MODEM = 0x15, | 69 | E_MODEM = 0x15, |
70 | E_TIMEOUT = 0x16, | 70 | E_TIMEOUT = 0x16, |
71 | E_INTERRUPT = 0x17 | 71 | E_INTERRUPT = 0x17 |
72 | }; | 72 | }; |
73 | #endif /* _selftests_h_ */ | 73 | #endif /* _selftests_h_ */ |
diff --git a/drivers/char/rio/space.h b/drivers/char/rio/space.h index 72398d342051..1f12690f9d1f 100644 --- a/drivers/char/rio/space.h +++ b/drivers/char/rio/space.h | |||
@@ -42,4 +42,4 @@ extern int rio_bases[]; | |||
42 | extern int rio_limits[]; | 42 | extern int rio_limits[]; |
43 | extern int rio_vects[]; | 43 | extern int rio_vects[]; |
44 | 44 | ||
45 | #endif /* __rio_space_h__ */ | 45 | #endif /* __rio_space_h__ */ |
diff --git a/drivers/char/rio/sysmap.h b/drivers/char/rio/sysmap.h index fdc731393576..e1c6f1160dff 100644 --- a/drivers/char/rio/sysmap.h +++ b/drivers/char/rio/sysmap.h | |||
@@ -37,27 +37,26 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1" ; | 40 | static char *_rio_sysmap_h_sccs = "@(#)sysmap.h 1.1"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define SYSTEM_MAP_LEN 64 /* Len of System Map array */ | 44 | #define SYSTEM_MAP_LEN 64 /* Len of System Map array */ |
45 | 45 | ||
46 | 46 | ||
47 | typedef struct SYS_MAP SYS_MAP ; | 47 | typedef struct SYS_MAP SYS_MAP; |
48 | typedef struct SYS_MAP_LINK SYS_MAP_LINK ; | 48 | typedef struct SYS_MAP_LINK SYS_MAP_LINK; |
49 | 49 | ||
50 | struct SYS_MAP_LINK { | 50 | struct SYS_MAP_LINK { |
51 | short id ; /* Unit Id */ | 51 | short id; /* Unit Id */ |
52 | short link ; /* Id's Link */ | 52 | short link; /* Id's Link */ |
53 | short been_here ; /* Used by map_gen */ | 53 | short been_here; /* Used by map_gen */ |
54 | } ; | 54 | }; |
55 | 55 | ||
56 | struct SYS_MAP { | 56 | struct SYS_MAP { |
57 | char serial_num[4] ; | 57 | char serial_num[4]; |
58 | SYS_MAP_LINK link[4] ; | 58 | SYS_MAP_LINK link[4]; |
59 | } ; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | /*********** end of file ***********/ | 62 | /*********** end of file ***********/ |
63 | |||
diff --git a/drivers/char/rio/timeouts.h b/drivers/char/rio/timeouts.h index 11b31330c901..a8b5be3ca9bf 100644 --- a/drivers/char/rio/timeouts.h +++ b/drivers/char/rio/timeouts.h | |||
@@ -37,15 +37,14 @@ | |||
37 | 37 | ||
38 | #ifndef lint | 38 | #ifndef lint |
39 | #ifdef SCCS_LABELS | 39 | #ifdef SCCS_LABELS |
40 | static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3" ; | 40 | static char *_rio_defaults_h_sccs = "@(#)timeouts.h 1.3"; |
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ | 44 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ |
45 | #define SECOND (int) 15625 /* Low priority ticks */ | 45 | #define SECOND (int) 15625 /* Low priority ticks */ |
46 | 46 | ||
47 | #define TX_TIMEOUT (int) (200 * MILLISECOND) | 47 | #define TX_TIMEOUT (int) (200 * MILLISECOND) |
48 | 48 | ||
49 | 49 | ||
50 | /*********** end of file ***********/ | 50 | /*********** end of file ***********/ |
51 | |||
diff --git a/drivers/char/rio/top.h b/drivers/char/rio/top.h index 255c40d463a6..d15a11dc4f73 100644 --- a/drivers/char/rio/top.h +++ b/drivers/char/rio/top.h | |||
@@ -40,10 +40,9 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2"; | |||
40 | /* | 40 | /* |
41 | ** Topology information | 41 | ** Topology information |
42 | */ | 42 | */ |
43 | struct Top | 43 | struct Top { |
44 | { | 44 | uchar Unit; |
45 | uchar Unit; | 45 | uchar Link; |
46 | uchar Link; | ||
47 | }; | 46 | }; |
48 | 47 | ||
49 | #endif /* __rio_top_h__ */ | 48 | #endif /* __rio_top_h__ */ |
diff --git a/drivers/char/rio/typdef.h b/drivers/char/rio/typdef.h index 2cb9dd693fa1..185b889e1510 100644 --- a/drivers/char/rio/typdef.h +++ b/drivers/char/rio/typdef.h | |||
@@ -45,11 +45,11 @@ static char *_typdef_h_sccs_ = "@(#)typdef.h 1.2"; | |||
45 | ** These types are ONLY to be used for refering to data structures | 45 | ** These types are ONLY to be used for refering to data structures |
46 | ** on the RIO Host card! | 46 | ** on the RIO Host card! |
47 | */ | 47 | */ |
48 | typedef volatile unsigned char BYTE; | 48 | typedef volatile unsigned char BYTE; |
49 | typedef volatile unsigned short WORD; | 49 | typedef volatile unsigned short WORD; |
50 | typedef volatile unsigned int DWORD; | 50 | typedef volatile unsigned int DWORD; |
51 | typedef volatile unsigned short RIOP; | 51 | typedef volatile unsigned short RIOP; |
52 | typedef volatile short NUMBER; | 52 | typedef volatile short NUMBER; |
53 | 53 | ||
54 | 54 | ||
55 | /* | 55 | /* |
@@ -59,13 +59,13 @@ typedef volatile short NUMBER; | |||
59 | ** are here only to make the source compile. | 59 | ** are here only to make the source compile. |
60 | */ | 60 | */ |
61 | /* typedef unsigned int uint; */ | 61 | /* typedef unsigned int uint; */ |
62 | typedef unsigned long ulong_t; | 62 | typedef unsigned long ulong_t; |
63 | typedef unsigned short ushort_t; | 63 | typedef unsigned short ushort_t; |
64 | typedef unsigned char uchar_t; | 64 | typedef unsigned char uchar_t; |
65 | typedef unsigned char queue_t; | 65 | typedef unsigned char queue_t; |
66 | typedef unsigned char mblk_t; | 66 | typedef unsigned char mblk_t; |
67 | typedef unsigned int paddr_t; | 67 | typedef unsigned int paddr_t; |
68 | typedef unsigned char uchar; | 68 | typedef unsigned char uchar; |
69 | 69 | ||
70 | #define TPNULL ((ushort)(0x8000)) | 70 | #define TPNULL ((ushort)(0x8000)) |
71 | 71 | ||
@@ -73,10 +73,10 @@ typedef unsigned char uchar; | |||
73 | /* | 73 | /* |
74 | ** RIO structures defined in other include files. | 74 | ** RIO structures defined in other include files. |
75 | */ | 75 | */ |
76 | typedef struct PKT PKT; | 76 | typedef struct PKT PKT; |
77 | typedef struct LPB LPB; | 77 | typedef struct LPB LPB; |
78 | typedef struct RUP RUP; | 78 | typedef struct RUP RUP; |
79 | typedef struct Port Port; | 79 | typedef struct Port Port; |
80 | typedef struct DpRam DpRam; | 80 | typedef struct DpRam DpRam; |
81 | 81 | ||
82 | #endif /* __rio_typdef_h__ */ | 82 | #endif /* __rio_typdef_h__ */ |
diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h index eddf86278abc..a126c7cabac6 100644 --- a/drivers/char/rio/unixrup.h +++ b/drivers/char/rio/unixrup.h | |||
@@ -41,16 +41,15 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2"; | |||
41 | ** UnixRup data structure. This contains pointers to actual RUPs on the | 41 | ** UnixRup data structure. This contains pointers to actual RUPs on the |
42 | ** host card, and all the command/boot control stuff. | 42 | ** host card, and all the command/boot control stuff. |
43 | */ | 43 | */ |
44 | struct UnixRup | 44 | struct UnixRup { |
45 | { | 45 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ |
46 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ | 46 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ |
47 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ | 47 | struct RUP *RupP; /* the Rup to send it to */ |
48 | struct RUP *RupP; /* the Rup to send it to */ | 48 | uint Id; /* Id number */ |
49 | uint Id; /* Id number */ | 49 | uint BaseSysPort; /* SysPort of first tty on this RTA */ |
50 | uint BaseSysPort; /* SysPort of first tty on this RTA */ | 50 | uint ModTypes; /* Modules on this RTA */ |
51 | uint ModTypes; /* Modules on this RTA */ | 51 | spinlock_t RupLock; /* Lock structure for MPX */ |
52 | spinlock_t RupLock; /* Lock structure for MPX */ | 52 | /* struct lockb RupLock; *//* Lock structure for MPX */ |
53 | /* struct lockb RupLock; */ /* Lock structure for MPX */ | ||
54 | }; | 53 | }; |
55 | 54 | ||
56 | #endif /* __rio_unixrup_h__ */ | 55 | #endif /* __rio_unixrup_h__ */ |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index a7f099fb7dfe..7cac6d05d723 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -46,10 +46,10 @@ | |||
46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init | 46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init |
47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer | 47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer |
48 | * CONFIG_HPET_EMULATE_RTC | 48 | * CONFIG_HPET_EMULATE_RTC |
49 | * | 49 | * 1.12ac Alan Cox: Allow read access to the day of week register |
50 | */ | 50 | */ |
51 | 51 | ||
52 | #define RTC_VERSION "1.12" | 52 | #define RTC_VERSION "1.12ac" |
53 | 53 | ||
54 | #define RTC_IO_EXTENT 0x8 | 54 | #define RTC_IO_EXTENT 0x8 |
55 | 55 | ||
@@ -1250,9 +1250,9 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1250 | 1250 | ||
1251 | /* | 1251 | /* |
1252 | * Only the values that we read from the RTC are set. We leave | 1252 | * Only the values that we read from the RTC are set. We leave |
1253 | * tm_wday, tm_yday and tm_isdst untouched. Even though the | 1253 | * tm_wday, tm_yday and tm_isdst untouched. Note that while the |
1254 | * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated | 1254 | * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is |
1255 | * by the RTC when initially set to a non-zero value. | 1255 | * only updated by the RTC when initially set to a non-zero value. |
1256 | */ | 1256 | */ |
1257 | spin_lock_irq(&rtc_lock); | 1257 | spin_lock_irq(&rtc_lock); |
1258 | rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); | 1258 | rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); |
@@ -1261,6 +1261,9 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1261 | rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); | 1261 | rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH); |
1262 | rtc_tm->tm_mon = CMOS_READ(RTC_MONTH); | 1262 | rtc_tm->tm_mon = CMOS_READ(RTC_MONTH); |
1263 | rtc_tm->tm_year = CMOS_READ(RTC_YEAR); | 1263 | rtc_tm->tm_year = CMOS_READ(RTC_YEAR); |
1264 | /* Only set from 2.6.16 onwards */ | ||
1265 | rtc_tm->tm_wday = CMOS_READ(RTC_DAY_OF_WEEK); | ||
1266 | |||
1264 | #ifdef CONFIG_MACH_DECSTATION | 1267 | #ifdef CONFIG_MACH_DECSTATION |
1265 | real_year = CMOS_READ(RTC_DEC_YEAR); | 1268 | real_year = CMOS_READ(RTC_DEC_YEAR); |
1266 | #endif | 1269 | #endif |
@@ -1275,6 +1278,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1275 | BCD_TO_BIN(rtc_tm->tm_mday); | 1278 | BCD_TO_BIN(rtc_tm->tm_mday); |
1276 | BCD_TO_BIN(rtc_tm->tm_mon); | 1279 | BCD_TO_BIN(rtc_tm->tm_mon); |
1277 | BCD_TO_BIN(rtc_tm->tm_year); | 1280 | BCD_TO_BIN(rtc_tm->tm_year); |
1281 | BCD_TO_BIN(rtc_tm->tm_wday); | ||
1278 | } | 1282 | } |
1279 | 1283 | ||
1280 | #ifdef CONFIG_MACH_DECSTATION | 1284 | #ifdef CONFIG_MACH_DECSTATION |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 79c81def4104..07c9be6a6bbf 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: synclink_gt.c,v 4.20 2005/11/08 19:51:55 paulkf Exp $ | 2 | * $Id: synclink_gt.c,v 4.22 2006/01/09 20:16:06 paulkf Exp $ |
3 | * | 3 | * |
4 | * Device driver for Microgate SyncLink GT serial adapters. | 4 | * Device driver for Microgate SyncLink GT serial adapters. |
5 | * | 5 | * |
@@ -92,7 +92,7 @@ | |||
92 | * module identification | 92 | * module identification |
93 | */ | 93 | */ |
94 | static char *driver_name = "SyncLink GT"; | 94 | static char *driver_name = "SyncLink GT"; |
95 | static char *driver_version = "$Revision: 4.20 $"; | 95 | static char *driver_version = "$Revision: 4.22 $"; |
96 | static char *tty_driver_name = "synclink_gt"; | 96 | static char *tty_driver_name = "synclink_gt"; |
97 | static char *tty_dev_prefix = "ttySLG"; | 97 | static char *tty_dev_prefix = "ttySLG"; |
98 | MODULE_LICENSE("GPL"); | 98 | MODULE_LICENSE("GPL"); |
@@ -288,7 +288,6 @@ struct slgt_info { | |||
288 | 288 | ||
289 | unsigned char __iomem * reg_addr; /* memory mapped registers address */ | 289 | unsigned char __iomem * reg_addr; /* memory mapped registers address */ |
290 | u32 phys_reg_addr; | 290 | u32 phys_reg_addr; |
291 | u32 reg_offset; | ||
292 | int reg_addr_requested; | 291 | int reg_addr_requested; |
293 | 292 | ||
294 | MGSL_PARAMS params; /* communications parameters */ | 293 | MGSL_PARAMS params; /* communications parameters */ |
@@ -2976,14 +2975,13 @@ static int claim_resources(struct slgt_info *info) | |||
2976 | else | 2975 | else |
2977 | info->reg_addr_requested = 1; | 2976 | info->reg_addr_requested = 1; |
2978 | 2977 | ||
2979 | info->reg_addr = ioremap(info->phys_reg_addr, PAGE_SIZE); | 2978 | info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE); |
2980 | if (!info->reg_addr) { | 2979 | if (!info->reg_addr) { |
2981 | DBGERR(("%s cant map device registers, addr=%08X\n", | 2980 | DBGERR(("%s cant map device registers, addr=%08X\n", |
2982 | info->device_name, info->phys_reg_addr)); | 2981 | info->device_name, info->phys_reg_addr)); |
2983 | info->init_error = DiagStatus_CantAssignPciResources; | 2982 | info->init_error = DiagStatus_CantAssignPciResources; |
2984 | goto errout; | 2983 | goto errout; |
2985 | } | 2984 | } |
2986 | info->reg_addr += info->reg_offset; | ||
2987 | return 0; | 2985 | return 0; |
2988 | 2986 | ||
2989 | errout: | 2987 | errout: |
@@ -3004,7 +3002,7 @@ static void release_resources(struct slgt_info *info) | |||
3004 | } | 3002 | } |
3005 | 3003 | ||
3006 | if (info->reg_addr) { | 3004 | if (info->reg_addr) { |
3007 | iounmap(info->reg_addr - info->reg_offset); | 3005 | iounmap(info->reg_addr); |
3008 | info->reg_addr = NULL; | 3006 | info->reg_addr = NULL; |
3009 | } | 3007 | } |
3010 | } | 3008 | } |
@@ -3108,12 +3106,6 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev | |||
3108 | info->irq_level = pdev->irq; | 3106 | info->irq_level = pdev->irq; |
3109 | info->phys_reg_addr = pci_resource_start(pdev,0); | 3107 | info->phys_reg_addr = pci_resource_start(pdev,0); |
3110 | 3108 | ||
3111 | /* veremap works on page boundaries | ||
3112 | * map full page starting at the page boundary | ||
3113 | */ | ||
3114 | info->reg_offset = info->phys_reg_addr & (PAGE_SIZE-1); | ||
3115 | info->phys_reg_addr &= ~(PAGE_SIZE-1); | ||
3116 | |||
3117 | info->bus_type = MGSL_BUS_TYPE_PCI; | 3109 | info->bus_type = MGSL_BUS_TYPE_PCI; |
3118 | info->irq_flags = SA_SHIRQ; | 3110 | info->irq_flags = SA_SHIRQ; |
3119 | 3111 | ||
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 12167c04fa4c..bc56df8a3474 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -211,7 +211,7 @@ static int tlclk_open(struct inode *inode, struct file *filp) | |||
211 | result = request_irq(telclk_interrupt, &tlclk_interrupt, | 211 | result = request_irq(telclk_interrupt, &tlclk_interrupt, |
212 | SA_INTERRUPT, "telco_clock", tlclk_interrupt); | 212 | SA_INTERRUPT, "telco_clock", tlclk_interrupt); |
213 | if (result == -EBUSY) { | 213 | if (result == -EBUSY) { |
214 | printk(KERN_ERR "telco_clock: Interrupt can't be reserved!\n"); | 214 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); |
215 | return -EBUSY; | 215 | return -EBUSY; |
216 | } | 216 | } |
217 | inb(TLCLK_REG6); /* Clear interrupt events */ | 217 | inb(TLCLK_REG6); /* Clear interrupt events */ |
@@ -741,7 +741,7 @@ static int __init tlclk_init(void) | |||
741 | 741 | ||
742 | ret = register_chrdev(tlclk_major, "telco_clock", &tlclk_fops); | 742 | ret = register_chrdev(tlclk_major, "telco_clock", &tlclk_fops); |
743 | if (ret < 0) { | 743 | if (ret < 0) { |
744 | printk(KERN_ERR "telco_clock: can't get major! %d\n", tlclk_major); | 744 | printk(KERN_ERR "tlclk: can't get major %d.\n", tlclk_major); |
745 | return ret; | 745 | return ret; |
746 | } | 746 | } |
747 | alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL); | 747 | alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL); |
@@ -750,7 +750,7 @@ static int __init tlclk_init(void) | |||
750 | 750 | ||
751 | /* Read telecom clock IRQ number (Set by BIOS) */ | 751 | /* Read telecom clock IRQ number (Set by BIOS) */ |
752 | if (!request_region(TLCLK_BASE, 8, "telco_clock")) { | 752 | if (!request_region(TLCLK_BASE, 8, "telco_clock")) { |
753 | printk(KERN_ERR "tlclk: request_region failed! 0x%X\n", | 753 | printk(KERN_ERR "tlclk: request_region 0x%X failed.\n", |
754 | TLCLK_BASE); | 754 | TLCLK_BASE); |
755 | ret = -EBUSY; | 755 | ret = -EBUSY; |
756 | goto out2; | 756 | goto out2; |
@@ -758,7 +758,7 @@ static int __init tlclk_init(void) | |||
758 | telclk_interrupt = (inb(TLCLK_REG7) & 0x0f); | 758 | telclk_interrupt = (inb(TLCLK_REG7) & 0x0f); |
759 | 759 | ||
760 | if (0x0F == telclk_interrupt ) { /* not MCPBL0010 ? */ | 760 | if (0x0F == telclk_interrupt ) { /* not MCPBL0010 ? */ |
761 | printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw\n", | 761 | printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw.\n", |
762 | telclk_interrupt); | 762 | telclk_interrupt); |
763 | ret = -ENXIO; | 763 | ret = -ENXIO; |
764 | goto out3; | 764 | goto out3; |
@@ -768,7 +768,7 @@ static int __init tlclk_init(void) | |||
768 | 768 | ||
769 | ret = misc_register(&tlclk_miscdev); | 769 | ret = misc_register(&tlclk_miscdev); |
770 | if (ret < 0) { | 770 | if (ret < 0) { |
771 | printk(KERN_ERR " misc_register retruns %d\n", ret); | 771 | printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret); |
772 | ret = -EBUSY; | 772 | ret = -EBUSY; |
773 | goto out3; | 773 | goto out3; |
774 | } | 774 | } |
@@ -776,8 +776,7 @@ static int __init tlclk_init(void) | |||
776 | tlclk_device = platform_device_register_simple("telco_clock", | 776 | tlclk_device = platform_device_register_simple("telco_clock", |
777 | -1, NULL, 0); | 777 | -1, NULL, 0); |
778 | if (!tlclk_device) { | 778 | if (!tlclk_device) { |
779 | printk(KERN_ERR " platform_device_register retruns 0x%X\n", | 779 | printk(KERN_ERR "tlclk: platform_device_register failed.\n"); |
780 | (unsigned int) tlclk_device); | ||
781 | ret = -EBUSY; | 780 | ret = -EBUSY; |
782 | goto out4; | 781 | goto out4; |
783 | } | 782 | } |
@@ -785,7 +784,7 @@ static int __init tlclk_init(void) | |||
785 | ret = sysfs_create_group(&tlclk_device->dev.kobj, | 784 | ret = sysfs_create_group(&tlclk_device->dev.kobj, |
786 | &tlclk_attribute_group); | 785 | &tlclk_attribute_group); |
787 | if (ret) { | 786 | if (ret) { |
788 | printk(KERN_ERR "failed to create sysfs device attributes\n"); | 787 | printk(KERN_ERR "tlclk: failed to create sysfs device attributes.\n"); |
789 | sysfs_remove_group(&tlclk_device->dev.kobj, | 788 | sysfs_remove_group(&tlclk_device->dev.kobj, |
790 | &tlclk_attribute_group); | 789 | &tlclk_attribute_group); |
791 | goto out5; | 790 | goto out5; |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 1eda82b31a61..eb8b5be4e249 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -312,7 +312,7 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | |||
312 | 312 | ||
313 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) | 313 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) |
314 | { | 314 | { |
315 | struct tty_buffer *b = tty->buf.head, *n; | 315 | struct tty_buffer *b = tty->buf.tail, *n; |
316 | int left = 0; | 316 | int left = 0; |
317 | 317 | ||
318 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to | 318 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to |
@@ -326,7 +326,6 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
326 | n = tty_buffer_find(tty, size); | 326 | n = tty_buffer_find(tty, size); |
327 | if(n == NULL) | 327 | if(n == NULL) |
328 | return left; | 328 | return left; |
329 | n->next = b; | ||
330 | if(b != NULL) | 329 | if(b != NULL) |
331 | b->next = n; | 330 | b->next = n; |
332 | else | 331 | else |
@@ -2751,6 +2750,8 @@ static void flush_to_ldisc(void *private_) | |||
2751 | spin_lock_irqsave(&tty->read_lock, flags); | 2750 | spin_lock_irqsave(&tty->read_lock, flags); |
2752 | while((tbuf = tty->buf.head) != NULL) { | 2751 | while((tbuf = tty->buf.head) != NULL) { |
2753 | tty->buf.head = tbuf->next; | 2752 | tty->buf.head = tbuf->next; |
2753 | if (tty->buf.head == NULL) | ||
2754 | tty->buf.tail = NULL; | ||
2754 | spin_unlock_irqrestore(&tty->read_lock, flags); | 2755 | spin_unlock_irqrestore(&tty->read_lock, flags); |
2755 | /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ | 2756 | /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ |
2756 | disc->receive_buf(tty, tbuf->char_buf_ptr, | 2757 | disc->receive_buf(tty, tbuf->char_buf_ptr, |
@@ -2759,7 +2760,6 @@ static void flush_to_ldisc(void *private_) | |||
2759 | spin_lock_irqsave(&tty->read_lock, flags); | 2760 | spin_lock_irqsave(&tty->read_lock, flags); |
2760 | tty_buffer_free(tty, tbuf); | 2761 | tty_buffer_free(tty, tbuf); |
2761 | } | 2762 | } |
2762 | tty->buf.tail = NULL; | ||
2763 | spin_unlock_irqrestore(&tty->read_lock, flags); | 2763 | spin_unlock_irqrestore(&tty->read_lock, flags); |
2764 | out: | 2764 | out: |
2765 | tty_ldisc_deref(disc); | 2765 | tty_ldisc_deref(disc); |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index cb82ebf4cb07..faee5e7acaf7 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -131,7 +131,7 @@ static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp); | |||
131 | 131 | ||
132 | static struct tty_driver *viotty_driver; | 132 | static struct tty_driver *viotty_driver; |
133 | 133 | ||
134 | void hvlog(char *fmt, ...) | 134 | static void hvlog(char *fmt, ...) |
135 | { | 135 | { |
136 | int i; | 136 | int i; |
137 | unsigned long flags; | 137 | unsigned long flags; |
@@ -147,7 +147,7 @@ void hvlog(char *fmt, ...) | |||
147 | spin_unlock_irqrestore(&consoleloglock, flags); | 147 | spin_unlock_irqrestore(&consoleloglock, flags); |
148 | } | 148 | } |
149 | 149 | ||
150 | void hvlogOutput(const char *buf, int count) | 150 | static void hvlogOutput(const char *buf, int count) |
151 | { | 151 | { |
152 | unsigned long flags; | 152 | unsigned long flags; |
153 | int begin; | 153 | int begin; |
@@ -904,6 +904,7 @@ static void vioHandleData(struct HvLpEvent *event) | |||
904 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | 904 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; |
905 | struct port_info *pi; | 905 | struct port_info *pi; |
906 | int index; | 906 | int index; |
907 | int num_pushed; | ||
907 | u8 port = cevent->virtual_device; | 908 | u8 port = cevent->virtual_device; |
908 | 909 | ||
909 | if (port >= VTTY_PORTS) { | 910 | if (port >= VTTY_PORTS) { |
@@ -964,6 +965,7 @@ static void vioHandleData(struct HvLpEvent *event) | |||
964 | * functionality will only work if built into the kernel and | 965 | * functionality will only work if built into the kernel and |
965 | * then only if sysrq is enabled through the proc filesystem. | 966 | * then only if sysrq is enabled through the proc filesystem. |
966 | */ | 967 | */ |
968 | num_pushed = 0; | ||
967 | for (index = 0; index < cevent->len; index++) { | 969 | for (index = 0; index < cevent->len; index++) { |
968 | #ifdef CONFIG_MAGIC_SYSRQ | 970 | #ifdef CONFIG_MAGIC_SYSRQ |
969 | if (sysrq_enabled) { | 971 | if (sysrq_enabled) { |
@@ -997,11 +999,10 @@ static void vioHandleData(struct HvLpEvent *event) | |||
997 | printk(VIOCONS_KERN_WARN "input buffer overflow!\n"); | 999 | printk(VIOCONS_KERN_WARN "input buffer overflow!\n"); |
998 | break; | 1000 | break; |
999 | } | 1001 | } |
1002 | num_pushed++; | ||
1000 | } | 1003 | } |
1001 | 1004 | ||
1002 | /* if cevent->len == 0 then no data was added to the buffer and flip.count == 0 */ | 1005 | if (num_pushed) |
1003 | if (tty->flip.count) | ||
1004 | /* The next call resets flip.count when the data is flushed. */ | ||
1005 | tty_flip_buffer_push(tty); | 1006 | tty_flip_buffer_push(tty); |
1006 | } | 1007 | } |
1007 | 1008 | ||
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index bda5bce681b6..343379f23a53 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -65,11 +65,11 @@ | |||
65 | * v0.01 release to linux-ia64@linuxia64.org | 65 | * v0.01 release to linux-ia64@linuxia64.org |
66 | */ | 66 | */ |
67 | 67 | ||
68 | #include <linux/capability.h> | ||
68 | #include <linux/config.h> | 69 | #include <linux/config.h> |
69 | #include <linux/types.h> | 70 | #include <linux/types.h> |
70 | #include <linux/errno.h> | 71 | #include <linux/errno.h> |
71 | #include <linux/init.h> | 72 | #include <linux/init.h> |
72 | #include <linux/sched.h> /* for capable() */ | ||
73 | #include <linux/mm.h> | 73 | #include <linux/mm.h> |
74 | #include <linux/module.h> | 74 | #include <linux/module.h> |
75 | #include <linux/string.h> | 75 | #include <linux/string.h> |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index f7490a015d18..362b33556b1a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -154,8 +154,10 @@ struct input_event_compat { | |||
154 | __s32 value; | 154 | __s32 value; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | /* Note to the author of this code: did it ever occur to | ||
158 | you why the ifdefs are needed? Think about it again. -AK */ | ||
157 | #ifdef CONFIG_X86_64 | 159 | #ifdef CONFIG_X86_64 |
158 | # define COMPAT_TEST test_thread_flag(TIF_IA32) | 160 | # define COMPAT_TEST is_compat_task() |
159 | #elif defined(CONFIG_IA64) | 161 | #elif defined(CONFIG_IA64) |
160 | # define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current)) | 162 | # define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current)) |
161 | #elif defined(CONFIG_S390) | 163 | #elif defined(CONFIG_S390) |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index ef47edc15081..5c15f3e9ea07 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1397,7 +1397,7 @@ config CS89x0 | |||
1397 | 1397 | ||
1398 | To compile this driver as a module, choose M here and read | 1398 | To compile this driver as a module, choose M here and read |
1399 | <file:Documentation/networking/net-modules.txt>. The module will be | 1399 | <file:Documentation/networking/net-modules.txt>. The module will be |
1400 | called cs89x. | 1400 | called cs89x0. |
1401 | 1401 | ||
1402 | config TC35815 | 1402 | config TC35815 |
1403 | tristate "TOSHIBA TC35815 Ethernet support" | 1403 | tristate "TOSHIBA TC35815 Ethernet support" |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 907c01009746..e2cfde7e31ec 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -100,7 +100,7 @@ | |||
100 | * Note that even if DMA is turned off we still support the 'dma' and 'use_dma' | 100 | * Note that even if DMA is turned off we still support the 'dma' and 'use_dma' |
101 | * module options so we don't break any startup scripts. | 101 | * module options so we don't break any startup scripts. |
102 | */ | 102 | */ |
103 | #ifndef CONFIG_ARCH_IXDP2X01 | 103 | #ifndef CONFIG_ISA_DMA_API |
104 | #define ALLOW_DMA 0 | 104 | #define ALLOW_DMA 0 |
105 | #else | 105 | #else |
106 | #define ALLOW_DMA 1 | 106 | #define ALLOW_DMA 1 |
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 166bca790133..b80318f03420 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/vmalloc.h> | 15 | #include <linux/vmalloc.h> |
16 | #include <linux/oprofile.h> | 16 | #include <linux/oprofile.h> |
17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
18 | #include <linux/capability.h> | ||
18 | #include <linux/dcookies.h> | 19 | #include <linux/dcookies.h> |
19 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index f357d3f60360..3627a2d7f79f 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
32 | #include <linux/utsname.h> | 32 | #include <linux/utsname.h> |
33 | #include <linux/capability.h> | ||
33 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
34 | #include <linux/netdevice.h> | 35 | #include <linux/netdevice.h> |
35 | #include <linux/inetdevice.h> | 36 | #include <linux/inetdevice.h> |
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 38bdca2fac6b..42a3c54e8e6c 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -42,9 +42,9 @@ | |||
42 | 42 | ||
43 | #include <linux/module.h> | 43 | #include <linux/module.h> |
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/sched.h> /* for capable() */ | ||
46 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
47 | #include <linux/string.h> | 46 | #include <linux/string.h> |
47 | #include <linux/capability.h> | ||
48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | #include <linux/sysfs.h> | 49 | #include <linux/sysfs.h> |
50 | #include <linux/kobject.h> | 50 | #include <linux/kobject.h> |
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
13 | #include <linux/capability.h> | ||
13 | #include <linux/fsnotify.h> | 14 | #include <linux/fsnotify.h> |
14 | #include <linux/fcntl.h> | 15 | #include <linux/fcntl.h> |
15 | #include <linux/quotaops.h> | 16 | #include <linux/quotaops.h> |
diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 808134a5a2fa..870e2cf33016 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * | 10 | * |
11 | * ------------------------------------------------------------------------- */ | 11 | * ------------------------------------------------------------------------- */ |
12 | 12 | ||
13 | #include <linux/capability.h> | ||
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
14 | #include <linux/stat.h> | 15 | #include <linux/stat.h> |
15 | #include <linux/param.h> | 16 | #include <linux/param.h> |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 14aa70282e8c..e93a7ae467c9 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * | 12 | * |
13 | * ------------------------------------------------------------------------- */ | 13 | * ------------------------------------------------------------------------- */ |
14 | 14 | ||
15 | #include <linux/capability.h> | ||
15 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
16 | #include <linux/stat.h> | 17 | #include <linux/stat.h> |
17 | #include <linux/param.h> | 18 | #include <linux/param.h> |
diff --git a/fs/buffer.c b/fs/buffer.c index 6466bc8a3dc7..b9bb7ad6897b 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/percpu.h> | 26 | #include <linux/percpu.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | 28 | #include <linux/smp_lock.h> |
29 | #include <linux/capability.h> | ||
29 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
30 | #include <linux/file.h> | 31 | #include <linux/file.h> |
31 | #include <linux/quotaops.h> | 32 | #include <linux/quotaops.h> |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 890bc30fbe20..f0b7256b2f87 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/compat.h> | 15 | #include <linux/compat.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/capability.h> | ||
17 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
18 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
19 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
@@ -915,6 +916,40 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
915 | return err; | 916 | return err; |
916 | } | 917 | } |
917 | 918 | ||
919 | struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */ | ||
920 | char req_state; | ||
921 | char orphan; | ||
922 | char sg_io_owned; | ||
923 | char problem; | ||
924 | int pack_id; | ||
925 | compat_uptr_t usr_ptr; | ||
926 | unsigned int duration; | ||
927 | int unused; | ||
928 | }; | ||
929 | |||
930 | static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
931 | { | ||
932 | int err, i; | ||
933 | sg_req_info_t *r; | ||
934 | struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; | ||
935 | r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); | ||
936 | err = sys_ioctl(fd,cmd,(unsigned long)r); | ||
937 | if (err < 0) | ||
938 | return err; | ||
939 | for (i = 0; i < SG_MAX_QUEUE; i++) { | ||
940 | void __user *ptr; | ||
941 | int d; | ||
942 | |||
943 | if (copy_in_user(o + i, r + i, offsetof(sg_req_info_t, usr_ptr)) || | ||
944 | get_user(ptr, &r[i].usr_ptr) || | ||
945 | get_user(d, &r[i].duration) || | ||
946 | put_user((u32)(unsigned long)(ptr), &o[i].usr_ptr) || | ||
947 | put_user(d, &o[i].duration)) | ||
948 | return -EFAULT; | ||
949 | } | ||
950 | return err; | ||
951 | } | ||
952 | |||
918 | struct sock_fprog32 { | 953 | struct sock_fprog32 { |
919 | unsigned short len; | 954 | unsigned short len; |
920 | compat_caddr_t filter; | 955 | compat_caddr_t filter; |
@@ -2793,6 +2828,7 @@ HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans) | |||
2793 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) | 2828 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) |
2794 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) | 2829 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) |
2795 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) | 2830 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
2831 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) | ||
2796 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) | 2832 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) |
2797 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) | 2833 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) |
2798 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) | 2834 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) |
diff --git a/fs/dcookies.c b/fs/dcookies.c index 02aa0ddc582a..f8274a8f83bd 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/mount.h> | 20 | #include <linux/mount.h> |
21 | #include <linux/capability.h> | ||
21 | #include <linux/dcache.h> | 22 | #include <linux/dcache.h> |
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
diff --git a/fs/dquot.c b/fs/dquot.c index cb6d5bfbdfd5..1966c890b48d 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include <linux/kmod.h> | 77 | #include <linux/kmod.h> |
78 | #include <linux/namei.h> | 78 | #include <linux/namei.h> |
79 | #include <linux/buffer_head.h> | 79 | #include <linux/buffer_head.h> |
80 | #include <linux/capability.h> | ||
80 | #include <linux/quotaops.h> | 81 | #include <linux/quotaops.h> |
81 | 82 | ||
82 | #include <asm/uaccess.h> | 83 | #include <asm/uaccess.h> |
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index 239133d01d91..35acc43b897f 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> | 4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/capability.h> | ||
7 | #include <linux/init.h> | 8 | #include <linux/init.h> |
8 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index bb6908066494..2c00953d4b0b 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/quotaops.h> | 16 | #include <linux/quotaops.h> |
17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
18 | #include <linux/buffer_head.h> | 18 | #include <linux/buffer_head.h> |
19 | #include <linux/capability.h> | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * balloc.c contains the blocks allocation and deallocation routines | 22 | * balloc.c contains the blocks allocation and deallocation routines |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 709d8676b962..3ca9afdf713d 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "ext2.h" | 10 | #include "ext2.h" |
11 | #include <linux/capability.h> | ||
11 | #include <linux/time.h> | 12 | #include <linux/time.h> |
12 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
13 | #include <asm/current.h> | 14 | #include <asm/current.h> |
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c index 2c072bfea23b..f28a6a499c96 100644 --- a/fs/ext2/xattr_trusted.c +++ b/fs/ext2/xattr_trusted.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/string.h> | 9 | #include <linux/string.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
11 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
12 | #include <linux/ext2_fs.h> | 13 | #include <linux/ext2_fs.h> |
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index 9ed132c96034..47a9da2dfb4f 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
11 | #include <linux/ext3_jbd.h> | 12 | #include <linux/ext3_jbd.h> |
12 | #include <linux/ext3_fs.h> | 13 | #include <linux/ext3_fs.h> |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index c6393fb4c35a..6250fcdf14a1 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/config.h> | 14 | #include <linux/config.h> |
15 | #include <linux/time.h> | 15 | #include <linux/time.h> |
16 | #include <linux/capability.h> | ||
16 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
17 | #include <linux/jbd.h> | 18 | #include <linux/jbd.h> |
18 | #include <linux/ext3_fs.h> | 19 | #include <linux/ext3_fs.h> |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 706d68608381..556cd5510078 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/jbd.h> | 11 | #include <linux/jbd.h> |
12 | #include <linux/capability.h> | ||
12 | #include <linux/ext3_fs.h> | 13 | #include <linux/ext3_fs.h> |
13 | #include <linux/ext3_jbd.h> | 14 | #include <linux/ext3_jbd.h> |
14 | #include <linux/time.h> | 15 | #include <linux/time.h> |
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index 7c693c94f14d..86d91f1186dc 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/string.h> | 9 | #include <linux/string.h> |
10 | #include <linux/capability.h> | ||
10 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
11 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
12 | #include <linux/ext3_jbd.h> | 13 | #include <linux/ext3_jbd.h> |
diff --git a/fs/fat/file.c b/fs/fat/file.c index d30876cf35f5..e99c5a73b39e 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * regular file handling primitives for fat-based filesystems | 6 | * regular file handling primitives for fat-based filesystems |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/capability.h> | ||
9 | #include <linux/module.h> | 10 | #include <linux/module.h> |
10 | #include <linux/time.h> | 11 | #include <linux/time.h> |
11 | #include <linux/msdos_fs.h> | 12 | #include <linux/msdos_fs.h> |
diff --git a/fs/fcntl.c b/fs/fcntl.c index 9903bde475f2..d0767fe58362 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/file.h> | 11 | #include <linux/file.h> |
12 | #include <linux/capability.h> | ||
12 | #include <linux/dnotify.h> | 13 | #include <linux/dnotify.h> |
13 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
14 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
diff --git a/fs/file_table.c b/fs/file_table.c index 6142250104a6..768b58167543 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/eventpoll.h> | 16 | #include <linux/eventpoll.h> |
17 | #include <linux/rcupdate.h> | 17 | #include <linux/rcupdate.h> |
18 | #include <linux/mount.h> | 18 | #include <linux/mount.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/cdev.h> | 20 | #include <linux/cdev.h> |
20 | #include <linux/fsnotify.h> | 21 | #include <linux/fsnotify.h> |
21 | 22 | ||
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index e07aa096e07c..13cf848ac833 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * hfsplus ioctls | 12 | * hfsplus ioctls |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/capability.h> | ||
15 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
17 | #include <linux/xattr.h> | 18 | #include <linux/xattr.h> |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ff1b7d108bd0..ab4c3a9d51b8 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/capability.h> | ||
21 | #include <linux/backing-dev.h> | 22 | #include <linux/backing-dev.h> |
22 | #include <linux/hugetlb.h> | 23 | #include <linux/hugetlb.h> |
23 | #include <linux/pagevec.h> | 24 | #include <linux/pagevec.h> |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 569209181425..f8aeec3ca10c 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/syscalls.h> | 8 | #include <linux/syscalls.h> |
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/smp_lock.h> | 10 | #include <linux/smp_lock.h> |
11 | #include <linux/capability.h> | ||
11 | #include <linux/file.h> | 12 | #include <linux/file.h> |
12 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
13 | #include <linux/security.h> | 14 | #include <linux/security.h> |
diff --git a/fs/ioprio.c b/fs/ioprio.c index 4bf1c6365a19..ca77008146c0 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/ioprio.h> | 23 | #include <linux/ioprio.h> |
24 | #include <linux/blkdev.h> | 24 | #include <linux/blkdev.h> |
25 | #include <linux/capability.h> | ||
25 | #include <linux/syscalls.h> | 26 | #include <linux/syscalls.h> |
26 | 27 | ||
27 | static int set_task_ioprio(struct task_struct *task, int ioprio) | 28 | static int set_task_ioprio(struct task_struct *task, int ioprio) |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index d0fcc5f3497e..09e5d10b8840 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | ||
14 | #include <linux/config.h> | 15 | #include <linux/config.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 952da5f917cd..f23048f9471f 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/capability.h> | ||
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
21 | #include <linux/xattr.h> | 22 | #include <linux/xattr.h> |
22 | #include <linux/posix_acl_xattr.h> | 23 | #include <linux/posix_acl_xattr.h> |
diff --git a/fs/namei.c b/fs/namei.c index 0a8f073435af..1e5746eb1380 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/syscalls.h> | 28 | #include <linux/syscalls.h> |
29 | #include <linux/mount.h> | 29 | #include <linux/mount.h> |
30 | #include <linux/audit.h> | 30 | #include <linux/audit.h> |
31 | #include <linux/capability.h> | ||
31 | #include <linux/file.h> | 32 | #include <linux/file.h> |
32 | #include <asm/namei.h> | 33 | #include <asm/namei.h> |
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
diff --git a/fs/namespace.c b/fs/namespace.c index 2ca6145f43d6..8bc15b362d23 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/quotaops.h> | 17 | #include <linux/quotaops.h> |
18 | #include <linux/acct.h> | 18 | #include <linux/acct.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
21 | #include <linux/namespace.h> | 22 | #include <linux/namespace.h> |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index fd3efdca5ae3..d6e0c089e1b1 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/config.h> | 10 | #include <linux/config.h> |
11 | 11 | ||
12 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
13 | #include <linux/capability.h> | ||
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
14 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
15 | #include <linux/ioctl.h> | 16 | #include <linux/ioctl.h> |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index ca5f9f90d794..eaf33caa0a1f 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * Boston, MA 021110-1307, USA. | 23 | * Boston, MA 021110-1307, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/capability.h> | ||
26 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
27 | #include <linux/types.h> | 28 | #include <linux/types.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/tty.h> | 16 | #include <linux/tty.h> |
17 | #include <linux/namei.h> | 17 | #include <linux/namei.h> |
18 | #include <linux/backing-dev.h> | 18 | #include <linux/backing-dev.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/security.h> | 20 | #include <linux/security.h> |
20 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
21 | #include <linux/vfs.h> | 22 | #include <linux/vfs.h> |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 634355e16986..20feb7568deb 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/proc_fs.h> | 55 | #include <linux/proc_fs.h> |
56 | #include <linux/stat.h> | 56 | #include <linux/stat.h> |
57 | #include <linux/init.h> | 57 | #include <linux/init.h> |
58 | #include <linux/capability.h> | ||
58 | #include <linux/file.h> | 59 | #include <linux/file.h> |
59 | #include <linux/string.h> | 60 | #include <linux/string.h> |
60 | #include <linux/seq_file.h> | 61 | #include <linux/seq_file.h> |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 1c7da988fcc3..adc2cd95169a 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
15 | #include <linux/user.h> | 15 | #include <linux/user.h> |
16 | #include <linux/a.out.h> | 16 | #include <linux/a.out.h> |
17 | #include <linux/capability.h> | ||
17 | #include <linux/elf.h> | 18 | #include <linux/elf.h> |
18 | #include <linux/elfcore.h> | 19 | #include <linux/elfcore.h> |
19 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 124e35442ac8..4063fb32f78c 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -41,7 +41,7 @@ struct proc_dir_entry *proc_vmcore = NULL; | |||
41 | 41 | ||
42 | /* Reads a page from the oldmem device from given offset. */ | 42 | /* Reads a page from the oldmem device from given offset. */ |
43 | static ssize_t read_from_oldmem(char *buf, size_t count, | 43 | static ssize_t read_from_oldmem(char *buf, size_t count, |
44 | loff_t *ppos, int userbuf) | 44 | u64 *ppos, int userbuf) |
45 | { | 45 | { |
46 | unsigned long pfn, offset; | 46 | unsigned long pfn, offset; |
47 | size_t nr_bytes; | 47 | size_t nr_bytes; |
diff --git a/fs/quota.c b/fs/quota.c index d14d872646d4..ba9e0bf32f67 100644 --- a/fs/quota.c +++ b/fs/quota.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/security.h> | 15 | #include <linux/security.h> |
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <linux/buffer_head.h> | 17 | #include <linux/buffer_head.h> |
18 | #include <linux/capability.h> | ||
18 | #include <linux/quotaops.h> | 19 | #include <linux/quotaops.h> |
19 | 20 | ||
20 | /* Check validity of generic quotactl commands */ | 21 | /* Check validity of generic quotactl commands */ |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index ba8bf8df6dc7..745c88100895 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README | 2 | * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/capability.h> | ||
5 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
6 | #include <linux/reiserfs_fs.h> | 7 | #include <linux/reiserfs_fs.h> |
7 | #include <linux/time.h> | 8 | #include <linux/time.h> |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 3f17ef844fb6..4491fcf2a0e6 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -3925,10 +3925,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3925 | flush = 1; | 3925 | flush = 1; |
3926 | } | 3926 | } |
3927 | #ifdef REISERFS_PREALLOCATE | 3927 | #ifdef REISERFS_PREALLOCATE |
3928 | /* quota ops might need to nest, setup the journal_info pointer for them */ | 3928 | /* quota ops might need to nest, setup the journal_info pointer for them |
3929 | * and raise the refcount so that it is > 0. */ | ||
3929 | current->journal_info = th; | 3930 | current->journal_info = th; |
3931 | th->t_refcount++; | ||
3930 | reiserfs_discard_all_prealloc(th); /* it should not involve new blocks into | 3932 | reiserfs_discard_all_prealloc(th); /* it should not involve new blocks into |
3931 | * the transaction */ | 3933 | * the transaction */ |
3934 | th->t_refcount--; | ||
3932 | current->journal_info = th->t_handle_save; | 3935 | current->journal_info = th->t_handle_save; |
3933 | #endif | 3936 | #endif |
3934 | 3937 | ||
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 6f99e01f94ab..cc061bfd437b 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -30,6 +30,7 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/reiserfs_fs.h> | 32 | #include <linux/reiserfs_fs.h> |
33 | #include <linux/capability.h> | ||
33 | #include <linux/dcache.h> | 34 | #include <linux/dcache.h> |
34 | #include <linux/namei.h> | 35 | #include <linux/namei.h> |
35 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 2dc953504cc0..43de3ba83332 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/capability.h> | ||
1 | #include <linux/fs.h> | 2 | #include <linux/fs.h> |
2 | #include <linux/posix_acl.h> | 3 | #include <linux/posix_acl.h> |
3 | #include <linux/reiserfs_fs.h> | 4 | #include <linux/reiserfs_fs.h> |
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index 2501f7e66ab9..024a938ca60f 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/reiserfs_fs.h> | 1 | #include <linux/reiserfs_fs.h> |
2 | #include <linux/capability.h> | ||
2 | #include <linux/errno.h> | 3 | #include <linux/errno.h> |
3 | #include <linux/fs.h> | 4 | #include <linux/fs.h> |
4 | #include <linux/pagemap.h> | 5 | #include <linux/pagemap.h> |
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index d6baec0f24ad..b1b878b81730 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/capability.h> | ||
11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
12 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
13 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index c3133219941c..689f7bcfaf30 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/namei.h> | 12 | #include <linux/namei.h> |
13 | #include <linux/backing-dev.h> | 13 | #include <linux/backing-dev.h> |
14 | #include <linux/capability.h> | ||
14 | #include "sysfs.h" | 15 | #include "sysfs.h" |
15 | 16 | ||
16 | extern struct super_block * sysfs_sb; | 17 | extern struct super_block * sysfs_sb; |
diff --git a/fs/udf/file.c b/fs/udf/file.c index 8a388289040d..a6f2acc1f15c 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/string.h> /* memset */ | 33 | #include <linux/string.h> /* memset */ |
34 | #include <linux/capability.h> | ||
34 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
35 | #include <linux/smp_lock.h> | 36 | #include <linux/smp_lock.h> |
36 | #include <linux/pagemap.h> | 37 | #include <linux/pagemap.h> |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index faf1512173eb..a9f4421ddb6f 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/quotaops.h> | 14 | #include <linux/quotaops.h> |
15 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
16 | #include <linux/capability.h> | ||
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
17 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
18 | #include <asm/byteorder.h> | 19 | #include <asm/byteorder.h> |
diff --git a/fs/xfs/linux-2.6/xfs_cred.h b/fs/xfs/linux-2.6/xfs_cred.h index 4af491024727..e7f3da61c6c3 100644 --- a/fs/xfs/linux-2.6/xfs_cred.h +++ b/fs/xfs/linux-2.6/xfs_cred.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #ifndef __XFS_CRED_H__ | 18 | #ifndef __XFS_CRED_H__ |
19 | #define __XFS_CRED_H__ | 19 | #define __XFS_CRED_H__ |
20 | 20 | ||
21 | #include <linux/capability.h> | ||
22 | |||
21 | /* | 23 | /* |
22 | * Credentials | 24 | * Credentials |
23 | */ | 25 | */ |
@@ -27,7 +29,7 @@ typedef struct cred { | |||
27 | 29 | ||
28 | extern struct cred *sys_cred; | 30 | extern struct cred *sys_cred; |
29 | 31 | ||
30 | /* this is a hack.. (assums sys_cred is the only cred_t in the system) */ | 32 | /* this is a hack.. (assumes sys_cred is the only cred_t in the system) */ |
31 | static __inline int capable_cred(cred_t *cr, int cid) | 33 | static __inline int capable_cred(cred_t *cr, int cid) |
32 | { | 34 | { |
33 | return (cr == sys_cred) ? 1 : capable(cid); | 35 | return (cr == sys_cred) ? 1 : capable(cid); |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index f98c5be3dfe7..21667ba6dcd5 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "xfs_dfrag.h" | 52 | #include "xfs_dfrag.h" |
53 | #include "xfs_fsops.h" | 53 | #include "xfs_fsops.h" |
54 | 54 | ||
55 | #include <linux/capability.h> | ||
55 | #include <linux/dcache.h> | 56 | #include <linux/dcache.h> |
56 | #include <linux/mount.h> | 57 | #include <linux/mount.h> |
57 | #include <linux/namei.h> | 58 | #include <linux/namei.h> |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 97fb1470cf28..9b8ee3470ecc 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include "xfs_buf_item.h" | 51 | #include "xfs_buf_item.h" |
52 | #include "xfs_utils.h" | 52 | #include "xfs_utils.h" |
53 | 53 | ||
54 | #include <linux/capability.h> | ||
54 | #include <linux/xattr.h> | 55 | #include <linux/xattr.h> |
55 | #include <linux/namei.h> | 56 | #include <linux/namei.h> |
56 | 57 | ||
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index 86a1d09f48d5..676884394aae 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c | |||
@@ -15,6 +15,9 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | |||
19 | #include <linux/capability.h> | ||
20 | |||
18 | #include "xfs.h" | 21 | #include "xfs.h" |
19 | #include "xfs_fs.h" | 22 | #include "xfs_fs.h" |
20 | #include "xfs_bit.h" | 23 | #include "xfs_bit.h" |
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index cc9c91b9e771..4ff0f4e41c61 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "xfs_mac.h" | 36 | #include "xfs_mac.h" |
37 | #include "xfs_attr.h" | 37 | #include "xfs_attr.h" |
38 | 38 | ||
39 | #include <linux/capability.h> | ||
39 | #include <linux/posix_acl_xattr.h> | 40 | #include <linux/posix_acl_xattr.h> |
40 | 41 | ||
41 | STATIC int xfs_acl_setmode(vnode_t *, xfs_acl_t *, int *); | 42 | STATIC int xfs_acl_setmode(vnode_t *, xfs_acl_t *, int *); |
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 1a11c2b51701..e5e91e9c7e89 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -15,6 +15,9 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | |||
19 | #include <linux/capability.h> | ||
20 | |||
18 | #include "xfs.h" | 21 | #include "xfs.h" |
19 | #include "xfs_fs.h" | 22 | #include "xfs_fs.h" |
20 | #include "xfs_types.h" | 23 | #include "xfs_types.h" |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index e03fa2a3d5ed..e92cacde02f5 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -15,6 +15,9 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | |||
19 | #include <linux/capability.h> | ||
20 | |||
18 | #include "xfs.h" | 21 | #include "xfs.h" |
19 | #include "xfs_fs.h" | 22 | #include "xfs_fs.h" |
20 | #include "xfs_types.h" | 23 | #include "xfs_types.h" |
diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h index 74b18cda169f..40c6d1f86598 100644 --- a/include/asm-generic/mutex-dec.h +++ b/include/asm-generic/mutex-dec.h | |||
@@ -97,7 +97,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) | |||
97 | * the mutex state would be. | 97 | * the mutex state would be. |
98 | */ | 98 | */ |
99 | #ifdef __HAVE_ARCH_CMPXCHG | 99 | #ifdef __HAVE_ARCH_CMPXCHG |
100 | if (likely(atomic_cmpxchg(count, 1, 0)) == 1) { | 100 | if (likely(atomic_cmpxchg(count, 1, 0) == 1)) { |
101 | smp_mb(); | 101 | smp_mb(); |
102 | return 1; | 102 | return 1; |
103 | } | 103 | } |
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h index e8c02b8c2d99..cd35b1cc6cde 100644 --- a/include/asm-h8300/page.h +++ b/include/asm-h8300/page.h | |||
@@ -13,12 +13,6 @@ | |||
13 | 13 | ||
14 | #include <asm/setup.h> | 14 | #include <asm/setup.h> |
15 | 15 | ||
16 | #if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13 | ||
17 | #define KTHREAD_SIZE (8192) | ||
18 | #else | ||
19 | #define KTHREAD_SIZE PAGE_SIZE | ||
20 | #endif | ||
21 | |||
22 | #ifndef __ASSEMBLY__ | 16 | #ifndef __ASSEMBLY__ |
23 | 17 | ||
24 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) | 18 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) |
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h index 8c454aa58ac6..d30b8571573f 100644 --- a/include/asm-i386/apic.h +++ b/include/asm-i386/apic.h | |||
@@ -132,6 +132,11 @@ extern unsigned int nmi_watchdog; | |||
132 | 132 | ||
133 | extern int disable_timer_pin_1; | 133 | extern int disable_timer_pin_1; |
134 | 134 | ||
135 | void smp_send_timer_broadcast_ipi(struct pt_regs *regs); | ||
136 | void switch_APIC_timer_to_ipi(void *cpumask); | ||
137 | void switch_ipi_to_APIC_timer(void *cpumask); | ||
138 | #define ARCH_APICTIMER_STOPS_ON_C3 1 | ||
139 | |||
135 | #else /* !CONFIG_X86_LOCAL_APIC */ | 140 | #else /* !CONFIG_X86_LOCAL_APIC */ |
136 | static inline void lapic_shutdown(void) { } | 141 | static inline void lapic_shutdown(void) { } |
137 | 142 | ||
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 65679aca4b22..fe0819fe9c64 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h | |||
@@ -43,7 +43,7 @@ static inline void set_bit(int nr, volatile unsigned long * addr) | |||
43 | { | 43 | { |
44 | __asm__ __volatile__( LOCK_PREFIX | 44 | __asm__ __volatile__( LOCK_PREFIX |
45 | "btsl %1,%0" | 45 | "btsl %1,%0" |
46 | :"=m" (ADDR) | 46 | :"+m" (ADDR) |
47 | :"Ir" (nr)); | 47 | :"Ir" (nr)); |
48 | } | 48 | } |
49 | 49 | ||
@@ -60,7 +60,7 @@ static inline void __set_bit(int nr, volatile unsigned long * addr) | |||
60 | { | 60 | { |
61 | __asm__( | 61 | __asm__( |
62 | "btsl %1,%0" | 62 | "btsl %1,%0" |
63 | :"=m" (ADDR) | 63 | :"+m" (ADDR) |
64 | :"Ir" (nr)); | 64 | :"Ir" (nr)); |
65 | } | 65 | } |
66 | 66 | ||
@@ -78,7 +78,7 @@ static inline void clear_bit(int nr, volatile unsigned long * addr) | |||
78 | { | 78 | { |
79 | __asm__ __volatile__( LOCK_PREFIX | 79 | __asm__ __volatile__( LOCK_PREFIX |
80 | "btrl %1,%0" | 80 | "btrl %1,%0" |
81 | :"=m" (ADDR) | 81 | :"+m" (ADDR) |
82 | :"Ir" (nr)); | 82 | :"Ir" (nr)); |
83 | } | 83 | } |
84 | 84 | ||
@@ -86,7 +86,7 @@ static inline void __clear_bit(int nr, volatile unsigned long * addr) | |||
86 | { | 86 | { |
87 | __asm__ __volatile__( | 87 | __asm__ __volatile__( |
88 | "btrl %1,%0" | 88 | "btrl %1,%0" |
89 | :"=m" (ADDR) | 89 | :"+m" (ADDR) |
90 | :"Ir" (nr)); | 90 | :"Ir" (nr)); |
91 | } | 91 | } |
92 | #define smp_mb__before_clear_bit() barrier() | 92 | #define smp_mb__before_clear_bit() barrier() |
@@ -105,7 +105,7 @@ static inline void __change_bit(int nr, volatile unsigned long * addr) | |||
105 | { | 105 | { |
106 | __asm__ __volatile__( | 106 | __asm__ __volatile__( |
107 | "btcl %1,%0" | 107 | "btcl %1,%0" |
108 | :"=m" (ADDR) | 108 | :"+m" (ADDR) |
109 | :"Ir" (nr)); | 109 | :"Ir" (nr)); |
110 | } | 110 | } |
111 | 111 | ||
@@ -123,7 +123,7 @@ static inline void change_bit(int nr, volatile unsigned long * addr) | |||
123 | { | 123 | { |
124 | __asm__ __volatile__( LOCK_PREFIX | 124 | __asm__ __volatile__( LOCK_PREFIX |
125 | "btcl %1,%0" | 125 | "btcl %1,%0" |
126 | :"=m" (ADDR) | 126 | :"+m" (ADDR) |
127 | :"Ir" (nr)); | 127 | :"Ir" (nr)); |
128 | } | 128 | } |
129 | 129 | ||
@@ -142,7 +142,7 @@ static inline int test_and_set_bit(int nr, volatile unsigned long * addr) | |||
142 | 142 | ||
143 | __asm__ __volatile__( LOCK_PREFIX | 143 | __asm__ __volatile__( LOCK_PREFIX |
144 | "btsl %2,%1\n\tsbbl %0,%0" | 144 | "btsl %2,%1\n\tsbbl %0,%0" |
145 | :"=r" (oldbit),"=m" (ADDR) | 145 | :"=r" (oldbit),"+m" (ADDR) |
146 | :"Ir" (nr) : "memory"); | 146 | :"Ir" (nr) : "memory"); |
147 | return oldbit; | 147 | return oldbit; |
148 | } | 148 | } |
@@ -162,7 +162,7 @@ static inline int __test_and_set_bit(int nr, volatile unsigned long * addr) | |||
162 | 162 | ||
163 | __asm__( | 163 | __asm__( |
164 | "btsl %2,%1\n\tsbbl %0,%0" | 164 | "btsl %2,%1\n\tsbbl %0,%0" |
165 | :"=r" (oldbit),"=m" (ADDR) | 165 | :"=r" (oldbit),"+m" (ADDR) |
166 | :"Ir" (nr)); | 166 | :"Ir" (nr)); |
167 | return oldbit; | 167 | return oldbit; |
168 | } | 168 | } |
@@ -182,7 +182,7 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long * addr) | |||
182 | 182 | ||
183 | __asm__ __volatile__( LOCK_PREFIX | 183 | __asm__ __volatile__( LOCK_PREFIX |
184 | "btrl %2,%1\n\tsbbl %0,%0" | 184 | "btrl %2,%1\n\tsbbl %0,%0" |
185 | :"=r" (oldbit),"=m" (ADDR) | 185 | :"=r" (oldbit),"+m" (ADDR) |
186 | :"Ir" (nr) : "memory"); | 186 | :"Ir" (nr) : "memory"); |
187 | return oldbit; | 187 | return oldbit; |
188 | } | 188 | } |
@@ -202,7 +202,7 @@ static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) | |||
202 | 202 | ||
203 | __asm__( | 203 | __asm__( |
204 | "btrl %2,%1\n\tsbbl %0,%0" | 204 | "btrl %2,%1\n\tsbbl %0,%0" |
205 | :"=r" (oldbit),"=m" (ADDR) | 205 | :"=r" (oldbit),"+m" (ADDR) |
206 | :"Ir" (nr)); | 206 | :"Ir" (nr)); |
207 | return oldbit; | 207 | return oldbit; |
208 | } | 208 | } |
@@ -214,7 +214,7 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr) | |||
214 | 214 | ||
215 | __asm__ __volatile__( | 215 | __asm__ __volatile__( |
216 | "btcl %2,%1\n\tsbbl %0,%0" | 216 | "btcl %2,%1\n\tsbbl %0,%0" |
217 | :"=r" (oldbit),"=m" (ADDR) | 217 | :"=r" (oldbit),"+m" (ADDR) |
218 | :"Ir" (nr) : "memory"); | 218 | :"Ir" (nr) : "memory"); |
219 | return oldbit; | 219 | return oldbit; |
220 | } | 220 | } |
@@ -233,7 +233,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long* addr) | |||
233 | 233 | ||
234 | __asm__ __volatile__( LOCK_PREFIX | 234 | __asm__ __volatile__( LOCK_PREFIX |
235 | "btcl %2,%1\n\tsbbl %0,%0" | 235 | "btcl %2,%1\n\tsbbl %0,%0" |
236 | :"=r" (oldbit),"=m" (ADDR) | 236 | :"=r" (oldbit),"+m" (ADDR) |
237 | :"Ir" (nr) : "memory"); | 237 | :"Ir" (nr) : "memory"); |
238 | return oldbit; | 238 | return oldbit; |
239 | } | 239 | } |
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h index ff1187e80c32..c4ec2a4d8fdf 100644 --- a/include/asm-i386/cpufeature.h +++ b/include/asm-i386/cpufeature.h | |||
@@ -69,6 +69,7 @@ | |||
69 | #define X86_FEATURE_K7 (3*32+ 5) /* Athlon */ | 69 | #define X86_FEATURE_K7 (3*32+ 5) /* Athlon */ |
70 | #define X86_FEATURE_P3 (3*32+ 6) /* P3 */ | 70 | #define X86_FEATURE_P3 (3*32+ 6) /* P3 */ |
71 | #define X86_FEATURE_P4 (3*32+ 7) /* P4 */ | 71 | #define X86_FEATURE_P4 (3*32+ 7) /* P4 */ |
72 | #define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ | ||
72 | 73 | ||
73 | /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ | 74 | /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ |
74 | #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ | 75 | #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ |
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h index 6c37a9ab8d60..9cf20cacf76e 100644 --- a/include/asm-i386/dma-mapping.h +++ b/include/asm-i386/dma-mapping.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <asm/cache.h> | 6 | #include <asm/cache.h> |
7 | #include <asm/io.h> | 7 | #include <asm/io.h> |
8 | #include <asm/scatterlist.h> | 8 | #include <asm/scatterlist.h> |
9 | #include <asm/bug.h> | ||
9 | 10 | ||
10 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 11 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
11 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 12 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
@@ -20,7 +21,9 @@ static inline dma_addr_t | |||
20 | dma_map_single(struct device *dev, void *ptr, size_t size, | 21 | dma_map_single(struct device *dev, void *ptr, size_t size, |
21 | enum dma_data_direction direction) | 22 | enum dma_data_direction direction) |
22 | { | 23 | { |
23 | BUG_ON(direction == DMA_NONE); | 24 | if (direction == DMA_NONE) |
25 | BUG(); | ||
26 | WARN_ON(size == 0); | ||
24 | flush_write_buffers(); | 27 | flush_write_buffers(); |
25 | return virt_to_phys(ptr); | 28 | return virt_to_phys(ptr); |
26 | } | 29 | } |
@@ -29,7 +32,8 @@ static inline void | |||
29 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | 32 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, |
30 | enum dma_data_direction direction) | 33 | enum dma_data_direction direction) |
31 | { | 34 | { |
32 | BUG_ON(direction == DMA_NONE); | 35 | if (direction == DMA_NONE) |
36 | BUG(); | ||
33 | } | 37 | } |
34 | 38 | ||
35 | static inline int | 39 | static inline int |
@@ -38,7 +42,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
38 | { | 42 | { |
39 | int i; | 43 | int i; |
40 | 44 | ||
41 | BUG_ON(direction == DMA_NONE); | 45 | if (direction == DMA_NONE) |
46 | BUG(); | ||
47 | WARN_ON(nents == 0 || sg[0].length == 0); | ||
42 | 48 | ||
43 | for (i = 0; i < nents; i++ ) { | 49 | for (i = 0; i < nents; i++ ) { |
44 | BUG_ON(!sg[i].page); | 50 | BUG_ON(!sg[i].page); |
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index 7babb97a02eb..03233c2ab820 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h | |||
@@ -131,6 +131,11 @@ extern void iounmap(volatile void __iomem *addr); | |||
131 | extern void *bt_ioremap(unsigned long offset, unsigned long size); | 131 | extern void *bt_ioremap(unsigned long offset, unsigned long size); |
132 | extern void bt_iounmap(void *addr, unsigned long size); | 132 | extern void bt_iounmap(void *addr, unsigned long size); |
133 | 133 | ||
134 | /* Use early IO mappings for DMI because it's initialized early */ | ||
135 | #define dmi_ioremap bt_ioremap | ||
136 | #define dmi_iounmap bt_iounmap | ||
137 | #define dmi_alloc alloc_bootmem | ||
138 | |||
134 | /* | 139 | /* |
135 | * ISA I/O bus memory addresses are 1:1 with the physical address. | 140 | * ISA I/O bus memory addresses are 1:1 with the physical address. |
136 | */ | 141 | */ |
diff --git a/include/asm-i386/mach-default/mach_ipi.h b/include/asm-i386/mach-default/mach_ipi.h index cc756a67cd63..a1d0072e36bc 100644 --- a/include/asm-i386/mach-default/mach_ipi.h +++ b/include/asm-i386/mach-default/mach_ipi.h | |||
@@ -15,11 +15,9 @@ static inline void __local_send_IPI_allbutself(int vector) | |||
15 | { | 15 | { |
16 | if (no_broadcast) { | 16 | if (no_broadcast) { |
17 | cpumask_t mask = cpu_online_map; | 17 | cpumask_t mask = cpu_online_map; |
18 | int this_cpu = get_cpu(); | ||
19 | 18 | ||
20 | cpu_clear(this_cpu, mask); | 19 | cpu_clear(smp_processor_id(), mask); |
21 | send_IPI_mask(mask, vector); | 20 | send_IPI_mask(mask, vector); |
22 | put_cpu(); | ||
23 | } else | 21 | } else |
24 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); | 22 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); |
25 | } | 23 | } |
diff --git a/include/asm-i386/mutex.h b/include/asm-i386/mutex.h index c657d4b09f0a..9b2199e829f3 100644 --- a/include/asm-i386/mutex.h +++ b/include/asm-i386/mutex.h | |||
@@ -125,7 +125,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) | |||
125 | * the mutex state would be. | 125 | * the mutex state would be. |
126 | */ | 126 | */ |
127 | #ifdef __HAVE_ARCH_CMPXCHG | 127 | #ifdef __HAVE_ARCH_CMPXCHG |
128 | if (likely(atomic_cmpxchg(count, 1, 0)) == 1) | 128 | if (likely(atomic_cmpxchg(count, 1, 0) == 1)) |
129 | return 1; | 129 | return 1; |
130 | return 0; | 130 | return 0; |
131 | #else | 131 | #else |
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 5c96cf6dcb39..13ecf66b098c 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -61,9 +61,11 @@ struct cpuinfo_x86 { | |||
61 | int x86_cache_size; /* in KB - valid for CPUS which support this | 61 | int x86_cache_size; /* in KB - valid for CPUS which support this |
62 | call */ | 62 | call */ |
63 | int x86_cache_alignment; /* In bytes */ | 63 | int x86_cache_alignment; /* In bytes */ |
64 | int fdiv_bug; | 64 | char fdiv_bug; |
65 | int f00f_bug; | 65 | char f00f_bug; |
66 | int coma_bug; | 66 | char coma_bug; |
67 | char pad0; | ||
68 | int x86_power; | ||
67 | unsigned long loops_per_jiffy; | 69 | unsigned long loops_per_jiffy; |
68 | unsigned char x86_max_cores; /* cpuid returned max cores value */ | 70 | unsigned char x86_max_cores; /* cpuid returned max cores value */ |
69 | unsigned char booted_cores; /* number of cores as seen by OS */ | 71 | unsigned char booted_cores; /* number of cores as seen by OS */ |
@@ -279,9 +281,11 @@ static inline void clear_in_cr4 (unsigned long mask) | |||
279 | outb((data), 0x23); \ | 281 | outb((data), 0x23); \ |
280 | } while (0) | 282 | } while (0) |
281 | 283 | ||
282 | static inline void serialize_cpu(void) | 284 | /* Stop speculative execution */ |
285 | static inline void sync_core(void) | ||
283 | { | 286 | { |
284 | __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); | 287 | int tmp; |
288 | asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); | ||
285 | } | 289 | } |
286 | 290 | ||
287 | static inline void __monitor(const void *eax, unsigned long ecx, | 291 | static inline void __monitor(const void *eax, unsigned long ecx, |
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index 3ae52d9dc9ff..a64b4d425dab 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h | |||
@@ -65,6 +65,7 @@ struct paca_struct { | |||
65 | u64 stab_real; /* Absolute address of segment table */ | 65 | u64 stab_real; /* Absolute address of segment table */ |
66 | u64 stab_addr; /* Virtual address of segment table */ | 66 | u64 stab_addr; /* Virtual address of segment table */ |
67 | void *emergency_sp; /* pointer to emergency stack */ | 67 | void *emergency_sp; /* pointer to emergency stack */ |
68 | u64 data_offset; /* per cpu data offset */ | ||
68 | s16 hw_cpu_id; /* Physical processor number */ | 69 | s16 hw_cpu_id; /* Physical processor number */ |
69 | u8 cpu_start; /* At startup, processor spins until */ | 70 | u8 cpu_start; /* At startup, processor spins until */ |
70 | /* this becomes non-zero. */ | 71 | /* this becomes non-zero. */ |
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h index 76d7cb4b4ffc..0b82df483f7f 100644 --- a/include/asm-powerpc/page.h +++ b/include/asm-powerpc/page.h | |||
@@ -178,7 +178,7 @@ typedef unsigned long pmd_t; | |||
178 | #define pmd_val(x) (x) | 178 | #define pmd_val(x) (x) |
179 | #define __pmd(x) (x) | 179 | #define __pmd(x) (x) |
180 | 180 | ||
181 | #ifndef CONFIG_PPC_64K_PAGES | 181 | #if defined(CONFIG_PPC64) && !defined(CONFIG_PPC_64K_PAGES) |
182 | typedef unsigned long pud_t; | 182 | typedef unsigned long pud_t; |
183 | #define pud_val(x) (x) | 183 | #define pud_val(x) (x) |
184 | #define __pud(x) (x) | 184 | #define __pud(x) (x) |
diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h index 897e49a88a6b..3fca21ddf546 100644 --- a/include/asm-powerpc/parport.h +++ b/include/asm-powerpc/parport.h | |||
@@ -10,10 +10,34 @@ | |||
10 | #define _ASM_POWERPC_PARPORT_H | 10 | #define _ASM_POWERPC_PARPORT_H |
11 | #ifdef __KERNEL__ | 11 | #ifdef __KERNEL__ |
12 | 12 | ||
13 | static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); | 13 | #include <asm/prom.h> |
14 | |||
15 | extern struct parport *parport_pc_probe_port (unsigned long int base, | ||
16 | unsigned long int base_hi, | ||
17 | int irq, int dma, | ||
18 | struct pci_dev *dev); | ||
19 | |||
14 | static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) | 20 | static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) |
15 | { | 21 | { |
16 | return parport_pc_find_isa_ports (autoirq, autodma); | 22 | struct device_node *np; |
23 | u32 *prop; | ||
24 | u32 io1, io2; | ||
25 | int propsize; | ||
26 | int count = 0; | ||
27 | for (np = NULL; (np = of_find_compatible_node(np, | ||
28 | "parallel", | ||
29 | "pnpPNP,400")) != NULL;) { | ||
30 | prop = (u32 *)get_property(np, "reg", &propsize); | ||
31 | if (!prop || propsize > 6*sizeof(u32)) | ||
32 | continue; | ||
33 | io1 = prop[1]; io2 = prop[2]; | ||
34 | prop = (u32 *)get_property(np, "interrupts", NULL); | ||
35 | if (!prop) | ||
36 | continue; | ||
37 | if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL) | ||
38 | count++; | ||
39 | } | ||
40 | return count; | ||
17 | } | 41 | } |
18 | 42 | ||
19 | #endif /* __KERNEL__ */ | 43 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h index 06a959d67234..e31922c50e53 100644 --- a/include/asm-powerpc/percpu.h +++ b/include/asm-powerpc/percpu.h | |||
@@ -1 +1,57 @@ | |||
1 | #ifndef _ASM_POWERPC_PERCPU_H_ | ||
2 | #define _ASM_POWERPC_PERCPU_H_ | ||
3 | #ifdef __powerpc64__ | ||
4 | #include <linux/compiler.h> | ||
5 | |||
6 | /* | ||
7 | * Same as asm-generic/percpu.h, except that we store the per cpu offset | ||
8 | * in the paca. Based on the x86-64 implementation. | ||
9 | */ | ||
10 | |||
11 | #ifdef CONFIG_SMP | ||
12 | |||
13 | #include <asm/paca.h> | ||
14 | |||
15 | #define __per_cpu_offset(cpu) (paca[cpu].data_offset) | ||
16 | #define __my_cpu_offset() get_paca()->data_offset | ||
17 | |||
18 | /* Separate out the type, so (int[3], foo) works. */ | ||
19 | #define DEFINE_PER_CPU(type, name) \ | ||
20 | __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name | ||
21 | |||
22 | /* var is in discarded region: offset to particular copy we want */ | ||
23 | #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) | ||
24 | #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) | ||
25 | |||
26 | /* A macro to avoid #include hell... */ | ||
27 | #define percpu_modcopy(pcpudst, src, size) \ | ||
28 | do { \ | ||
29 | unsigned int __i; \ | ||
30 | for (__i = 0; __i < NR_CPUS; __i++) \ | ||
31 | if (cpu_possible(__i)) \ | ||
32 | memcpy((pcpudst)+__per_cpu_offset(__i), \ | ||
33 | (src), (size)); \ | ||
34 | } while (0) | ||
35 | |||
36 | extern void setup_per_cpu_areas(void); | ||
37 | |||
38 | #else /* ! SMP */ | ||
39 | |||
40 | #define DEFINE_PER_CPU(type, name) \ | ||
41 | __typeof__(type) per_cpu__##name | ||
42 | |||
43 | #define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var)) | ||
44 | #define __get_cpu_var(var) per_cpu__##var | ||
45 | |||
46 | #endif /* SMP */ | ||
47 | |||
48 | #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name | ||
49 | |||
50 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | ||
51 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | ||
52 | |||
53 | #else | ||
1 | #include <asm-generic/percpu.h> | 54 | #include <asm-generic/percpu.h> |
55 | #endif | ||
56 | |||
57 | #endif /* _ASM_POWERPC_PERCPU_H_ */ | ||
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h index 3428889e27b7..f43c6835e62a 100644 --- a/include/asm-powerpc/rtas.h +++ b/include/asm-powerpc/rtas.h | |||
@@ -161,7 +161,6 @@ extern struct rtas_t rtas; | |||
161 | extern void enter_rtas(unsigned long); | 161 | extern void enter_rtas(unsigned long); |
162 | extern int rtas_token(const char *service); | 162 | extern int rtas_token(const char *service); |
163 | extern int rtas_call(int token, int, int, int *, ...); | 163 | extern int rtas_call(int token, int, int, int *, ...); |
164 | extern void call_rtas_display_status(unsigned char); | ||
165 | extern void rtas_restart(char *cmd); | 164 | extern void rtas_restart(char *cmd); |
166 | extern void rtas_power_off(void); | 165 | extern void rtas_power_off(void); |
167 | extern void rtas_halt(void); | 166 | extern void rtas_halt(void); |
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h index 479f2d8ff74a..5c4236c342bb 100644 --- a/include/asm-powerpc/udbg.h +++ b/include/asm-powerpc/udbg.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * c 2001 PPC 64 Team, IBM Corp | 2 | * (c) 2001, 2006 IBM Corporation. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
@@ -36,5 +36,12 @@ extern void udbg_scc_init(int force_scc); | |||
36 | extern int udbg_adb_init(int force_btext); | 36 | extern int udbg_adb_init(int force_btext); |
37 | extern void udbg_adb_init_early(void); | 37 | extern void udbg_adb_init_early(void); |
38 | 38 | ||
39 | extern void __init udbg_early_init(void); | ||
40 | extern void __init udbg_init_debug_lpar(void); | ||
41 | extern void __init udbg_init_pmac_realmode(void); | ||
42 | extern void __init udbg_init_maple_realmode(void); | ||
43 | extern void __init udbg_init_iseries(void); | ||
44 | extern void __init udbg_init_rtas(void); | ||
45 | |||
39 | #endif /* __KERNEL__ */ | 46 | #endif /* __KERNEL__ */ |
40 | #endif /* _ASM_POWERPC_UDBG_H */ | 47 | #endif /* _ASM_POWERPC_UDBG_H */ |
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index 5647b7de1749..4f6a4dc455bb 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h | |||
@@ -42,11 +42,6 @@ static __inline void apic_write(unsigned long reg, unsigned int v) | |||
42 | *((volatile unsigned int *)(APIC_BASE+reg)) = v; | 42 | *((volatile unsigned int *)(APIC_BASE+reg)) = v; |
43 | } | 43 | } |
44 | 44 | ||
45 | static __inline void apic_write_atomic(unsigned long reg, unsigned int v) | ||
46 | { | ||
47 | xchg((volatile unsigned int *)(APIC_BASE+reg), v); | ||
48 | } | ||
49 | |||
50 | static __inline unsigned int apic_read(unsigned long reg) | 45 | static __inline unsigned int apic_read(unsigned long reg) |
51 | { | 46 | { |
52 | return *((volatile unsigned int *)(APIC_BASE+reg)); | 47 | return *((volatile unsigned int *)(APIC_BASE+reg)); |
@@ -57,10 +52,6 @@ static __inline__ void apic_wait_icr_idle(void) | |||
57 | while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ); | 52 | while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ); |
58 | } | 53 | } |
59 | 54 | ||
60 | #define FORCE_READ_AROUND_WRITE 0 | ||
61 | #define apic_read_around(x) | ||
62 | #define apic_write_around(x,y) apic_write((x),(y)) | ||
63 | |||
64 | static inline void ack_APIC_irq(void) | 55 | static inline void ack_APIC_irq(void) |
65 | { | 56 | { |
66 | /* | 57 | /* |
@@ -71,7 +62,7 @@ static inline void ack_APIC_irq(void) | |||
71 | */ | 62 | */ |
72 | 63 | ||
73 | /* Docs say use 0 for future compatibility */ | 64 | /* Docs say use 0 for future compatibility */ |
74 | apic_write_around(APIC_EOI, 0); | 65 | apic_write(APIC_EOI, 0); |
75 | } | 66 | } |
76 | 67 | ||
77 | extern int get_maxlvt (void); | 68 | extern int get_maxlvt (void); |
@@ -113,6 +104,12 @@ extern int disable_timer_pin_1; | |||
113 | 104 | ||
114 | extern void setup_threshold_lvt(unsigned long lvt_off); | 105 | extern void setup_threshold_lvt(unsigned long lvt_off); |
115 | 106 | ||
107 | void smp_send_timer_broadcast_ipi(void); | ||
108 | void switch_APIC_timer_to_ipi(void *cpumask); | ||
109 | void switch_ipi_to_APIC_timer(void *cpumask); | ||
110 | |||
111 | #define ARCH_APICTIMER_STOPS_ON_C3 1 | ||
112 | |||
116 | #endif /* CONFIG_X86_LOCAL_APIC */ | 113 | #endif /* CONFIG_X86_LOCAL_APIC */ |
117 | 114 | ||
118 | extern unsigned boot_cpu_id; | 115 | extern unsigned boot_cpu_id; |
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index fb1c99ac669f..decaa2d540e8 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define APIC_ID 0x20 | 13 | #define APIC_ID 0x20 |
14 | #define APIC_ID_MASK (0xFFu<<24) | 14 | #define APIC_ID_MASK (0xFFu<<24) |
15 | #define GET_APIC_ID(x) (((x)>>24)&0xFFu) | 15 | #define GET_APIC_ID(x) (((x)>>24)&0xFFu) |
16 | #define SET_APIC_ID(x) (((x)<<24)) | ||
16 | #define APIC_LVR 0x30 | 17 | #define APIC_LVR 0x30 |
17 | #define APIC_LVR_MASK 0xFF00FF | 18 | #define APIC_LVR_MASK 0xFF00FF |
18 | #define GET_APIC_VERSION(x) ((x)&0xFFu) | 19 | #define GET_APIC_VERSION(x) ((x)&0xFFu) |
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h index 6b540237a2f8..4b5cd553e772 100644 --- a/include/asm-x86_64/atomic.h +++ b/include/asm-x86_64/atomic.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ARCH_X86_64_ATOMIC__ | 2 | #define __ARCH_X86_64_ATOMIC__ |
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | #include <asm/types.h> | ||
5 | 6 | ||
6 | /* atomic_t should be 32 bit signed type */ | 7 | /* atomic_t should be 32 bit signed type */ |
7 | 8 | ||
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index a4d5d0909453..eb4df23e1e41 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -29,7 +29,7 @@ static __inline__ void set_bit(int nr, volatile void * addr) | |||
29 | { | 29 | { |
30 | __asm__ __volatile__( LOCK_PREFIX | 30 | __asm__ __volatile__( LOCK_PREFIX |
31 | "btsl %1,%0" | 31 | "btsl %1,%0" |
32 | :"=m" (ADDR) | 32 | :"+m" (ADDR) |
33 | :"dIr" (nr) : "memory"); | 33 | :"dIr" (nr) : "memory"); |
34 | } | 34 | } |
35 | 35 | ||
@@ -46,7 +46,7 @@ static __inline__ void __set_bit(int nr, volatile void * addr) | |||
46 | { | 46 | { |
47 | __asm__ volatile( | 47 | __asm__ volatile( |
48 | "btsl %1,%0" | 48 | "btsl %1,%0" |
49 | :"=m" (ADDR) | 49 | :"+m" (ADDR) |
50 | :"dIr" (nr) : "memory"); | 50 | :"dIr" (nr) : "memory"); |
51 | } | 51 | } |
52 | 52 | ||
@@ -64,7 +64,7 @@ static __inline__ void clear_bit(int nr, volatile void * addr) | |||
64 | { | 64 | { |
65 | __asm__ __volatile__( LOCK_PREFIX | 65 | __asm__ __volatile__( LOCK_PREFIX |
66 | "btrl %1,%0" | 66 | "btrl %1,%0" |
67 | :"=m" (ADDR) | 67 | :"+m" (ADDR) |
68 | :"dIr" (nr)); | 68 | :"dIr" (nr)); |
69 | } | 69 | } |
70 | 70 | ||
@@ -72,7 +72,7 @@ static __inline__ void __clear_bit(int nr, volatile void * addr) | |||
72 | { | 72 | { |
73 | __asm__ __volatile__( | 73 | __asm__ __volatile__( |
74 | "btrl %1,%0" | 74 | "btrl %1,%0" |
75 | :"=m" (ADDR) | 75 | :"+m" (ADDR) |
76 | :"dIr" (nr)); | 76 | :"dIr" (nr)); |
77 | } | 77 | } |
78 | 78 | ||
@@ -92,7 +92,7 @@ static __inline__ void __change_bit(int nr, volatile void * addr) | |||
92 | { | 92 | { |
93 | __asm__ __volatile__( | 93 | __asm__ __volatile__( |
94 | "btcl %1,%0" | 94 | "btcl %1,%0" |
95 | :"=m" (ADDR) | 95 | :"+m" (ADDR) |
96 | :"dIr" (nr)); | 96 | :"dIr" (nr)); |
97 | } | 97 | } |
98 | 98 | ||
@@ -109,7 +109,7 @@ static __inline__ void change_bit(int nr, volatile void * addr) | |||
109 | { | 109 | { |
110 | __asm__ __volatile__( LOCK_PREFIX | 110 | __asm__ __volatile__( LOCK_PREFIX |
111 | "btcl %1,%0" | 111 | "btcl %1,%0" |
112 | :"=m" (ADDR) | 112 | :"+m" (ADDR) |
113 | :"dIr" (nr)); | 113 | :"dIr" (nr)); |
114 | } | 114 | } |
115 | 115 | ||
@@ -127,7 +127,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr) | |||
127 | 127 | ||
128 | __asm__ __volatile__( LOCK_PREFIX | 128 | __asm__ __volatile__( LOCK_PREFIX |
129 | "btsl %2,%1\n\tsbbl %0,%0" | 129 | "btsl %2,%1\n\tsbbl %0,%0" |
130 | :"=r" (oldbit),"=m" (ADDR) | 130 | :"=r" (oldbit),"+m" (ADDR) |
131 | :"dIr" (nr) : "memory"); | 131 | :"dIr" (nr) : "memory"); |
132 | return oldbit; | 132 | return oldbit; |
133 | } | 133 | } |
@@ -147,7 +147,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile void * addr) | |||
147 | 147 | ||
148 | __asm__( | 148 | __asm__( |
149 | "btsl %2,%1\n\tsbbl %0,%0" | 149 | "btsl %2,%1\n\tsbbl %0,%0" |
150 | :"=r" (oldbit),"=m" (ADDR) | 150 | :"=r" (oldbit),"+m" (ADDR) |
151 | :"dIr" (nr)); | 151 | :"dIr" (nr)); |
152 | return oldbit; | 152 | return oldbit; |
153 | } | 153 | } |
@@ -166,7 +166,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr) | |||
166 | 166 | ||
167 | __asm__ __volatile__( LOCK_PREFIX | 167 | __asm__ __volatile__( LOCK_PREFIX |
168 | "btrl %2,%1\n\tsbbl %0,%0" | 168 | "btrl %2,%1\n\tsbbl %0,%0" |
169 | :"=r" (oldbit),"=m" (ADDR) | 169 | :"=r" (oldbit),"+m" (ADDR) |
170 | :"dIr" (nr) : "memory"); | 170 | :"dIr" (nr) : "memory"); |
171 | return oldbit; | 171 | return oldbit; |
172 | } | 172 | } |
@@ -186,7 +186,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile void * addr) | |||
186 | 186 | ||
187 | __asm__( | 187 | __asm__( |
188 | "btrl %2,%1\n\tsbbl %0,%0" | 188 | "btrl %2,%1\n\tsbbl %0,%0" |
189 | :"=r" (oldbit),"=m" (ADDR) | 189 | :"=r" (oldbit),"+m" (ADDR) |
190 | :"dIr" (nr)); | 190 | :"dIr" (nr)); |
191 | return oldbit; | 191 | return oldbit; |
192 | } | 192 | } |
@@ -198,7 +198,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr) | |||
198 | 198 | ||
199 | __asm__ __volatile__( | 199 | __asm__ __volatile__( |
200 | "btcl %2,%1\n\tsbbl %0,%0" | 200 | "btcl %2,%1\n\tsbbl %0,%0" |
201 | :"=r" (oldbit),"=m" (ADDR) | 201 | :"=r" (oldbit),"+m" (ADDR) |
202 | :"dIr" (nr) : "memory"); | 202 | :"dIr" (nr) : "memory"); |
203 | return oldbit; | 203 | return oldbit; |
204 | } | 204 | } |
@@ -217,7 +217,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) | |||
217 | 217 | ||
218 | __asm__ __volatile__( LOCK_PREFIX | 218 | __asm__ __volatile__( LOCK_PREFIX |
219 | "btcl %2,%1\n\tsbbl %0,%0" | 219 | "btcl %2,%1\n\tsbbl %0,%0" |
220 | :"=r" (oldbit),"=m" (ADDR) | 220 | :"=r" (oldbit),"+m" (ADDR) |
221 | :"dIr" (nr) : "memory"); | 221 | :"dIr" (nr) : "memory"); |
222 | return oldbit; | 222 | return oldbit; |
223 | } | 223 | } |
@@ -397,6 +397,22 @@ static __inline__ int fls64(__u64 x) | |||
397 | } | 397 | } |
398 | 398 | ||
399 | /** | 399 | /** |
400 | * fls - find last bit set | ||
401 | * @x: the word to search | ||
402 | * | ||
403 | * This is defined the same way as ffs. | ||
404 | */ | ||
405 | static __inline__ int fls(int x) | ||
406 | { | ||
407 | int r; | ||
408 | |||
409 | __asm__("bsrl %1,%0\n\t" | ||
410 | "cmovzl %2,%0" | ||
411 | : "=&r" (r) : "rm" (x), "rm" (-1)); | ||
412 | return r+1; | ||
413 | } | ||
414 | |||
415 | /** | ||
400 | * hweightN - returns the hamming weight of a N-bit word | 416 | * hweightN - returns the hamming weight of a N-bit word |
401 | * @x: the word to weigh | 417 | * @x: the word to weigh |
402 | * | 418 | * |
@@ -434,9 +450,6 @@ static __inline__ int fls64(__u64 x) | |||
434 | #define minix_find_first_zero_bit(addr,size) \ | 450 | #define minix_find_first_zero_bit(addr,size) \ |
435 | find_first_zero_bit((void*)addr,size) | 451 | find_first_zero_bit((void*)addr,size) |
436 | 452 | ||
437 | /* find last set bit */ | ||
438 | #define fls(x) generic_fls(x) | ||
439 | |||
440 | #endif /* __KERNEL__ */ | 453 | #endif /* __KERNEL__ */ |
441 | 454 | ||
442 | #endif /* _X86_64_BITOPS_H */ | 455 | #endif /* _X86_64_BITOPS_H */ |
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h index b4a2401de77b..263f0a211ed7 100644 --- a/include/asm-x86_64/cache.h +++ b/include/asm-x86_64/cache.h | |||
@@ -10,4 +10,16 @@ | |||
10 | #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) | 10 | #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) |
11 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | 11 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) |
12 | 12 | ||
13 | #ifdef CONFIG_X86_VSMP | ||
14 | |||
15 | /* vSMP Internode cacheline shift */ | ||
16 | #define INTERNODE_CACHE_SHIFT (12) | ||
17 | #ifdef CONFIG_SMP | ||
18 | #define __cacheline_aligned_in_smp \ | ||
19 | __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \ | ||
20 | __attribute__((__section__(".data.page_aligned"))) | ||
21 | #endif | ||
22 | |||
23 | #endif | ||
24 | |||
13 | #endif | 25 | #endif |
diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h index f0155c38f639..3863a7da372b 100644 --- a/include/asm-x86_64/compat.h +++ b/include/asm-x86_64/compat.h | |||
@@ -202,4 +202,9 @@ static __inline__ void __user *compat_alloc_user_space(long len) | |||
202 | return (void __user *)regs->rsp - len; | 202 | return (void __user *)regs->rsp - len; |
203 | } | 203 | } |
204 | 204 | ||
205 | static inline int is_compat_task(void) | ||
206 | { | ||
207 | return current_thread_info()->status & TS_COMPAT; | ||
208 | } | ||
209 | |||
205 | #endif /* _ASM_X86_64_COMPAT_H */ | 210 | #endif /* _ASM_X86_64_COMPAT_H */ |
diff --git a/include/asm-x86_64/cpufeature.h b/include/asm-x86_64/cpufeature.h index aea308c65709..41c0ac8559be 100644 --- a/include/asm-x86_64/cpufeature.h +++ b/include/asm-x86_64/cpufeature.h | |||
@@ -61,8 +61,9 @@ | |||
61 | #define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ | 61 | #define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ |
62 | #define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ | 62 | #define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ |
63 | #define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ | 63 | #define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ |
64 | #define X86_FEATURE_K8_C (3*32+ 4) /* C stepping K8 */ | 64 | /* 4 free */ |
65 | #define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */ | 65 | #define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */ |
66 | #define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */ | ||
66 | 67 | ||
67 | /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ | 68 | /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ |
68 | #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ | 69 | #define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ |
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h index 33764869387b..eb7723a46790 100644 --- a/include/asm-x86_64/desc.h +++ b/include/asm-x86_64/desc.h | |||
@@ -25,7 +25,7 @@ struct n_desc_struct { | |||
25 | unsigned int a,b; | 25 | unsigned int a,b; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | extern struct desc_struct cpu_gdt_table[NR_CPUS][GDT_ENTRIES]; | 28 | extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; |
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | GATE_INTERRUPT = 0xE, | 31 | GATE_INTERRUPT = 0xE, |
@@ -79,6 +79,9 @@ extern struct desc_struct default_ldt[]; | |||
79 | extern struct gate_struct idt_table[]; | 79 | extern struct gate_struct idt_table[]; |
80 | extern struct desc_ptr cpu_gdt_descr[]; | 80 | extern struct desc_ptr cpu_gdt_descr[]; |
81 | 81 | ||
82 | /* the cpu gdt accessor */ | ||
83 | #define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) | ||
84 | |||
82 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) | 85 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) |
83 | { | 86 | { |
84 | struct gate_struct s; | 87 | struct gate_struct s; |
@@ -114,6 +117,11 @@ static inline void set_system_gate(int nr, void *func) | |||
114 | _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); | 117 | _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); |
115 | } | 118 | } |
116 | 119 | ||
120 | static inline void set_system_gate_ist(int nr, void *func, unsigned ist) | ||
121 | { | ||
122 | _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); | ||
123 | } | ||
124 | |||
117 | static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, | 125 | static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, |
118 | unsigned size) | 126 | unsigned size) |
119 | { | 127 | { |
@@ -139,20 +147,20 @@ static inline void set_tss_desc(unsigned cpu, void *addr) | |||
139 | * -1? seg base+limit should be pointing to the address of the | 147 | * -1? seg base+limit should be pointing to the address of the |
140 | * last valid byte | 148 | * last valid byte |
141 | */ | 149 | */ |
142 | set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_TSS], | 150 | set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_TSS], |
143 | (unsigned long)addr, DESC_TSS, | 151 | (unsigned long)addr, DESC_TSS, |
144 | IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1); | 152 | IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1); |
145 | } | 153 | } |
146 | 154 | ||
147 | static inline void set_ldt_desc(unsigned cpu, void *addr, int size) | 155 | static inline void set_ldt_desc(unsigned cpu, void *addr, int size) |
148 | { | 156 | { |
149 | set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (unsigned long)addr, | 157 | set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_LDT], (unsigned long)addr, |
150 | DESC_LDT, size * 8 - 1); | 158 | DESC_LDT, size * 8 - 1); |
151 | } | 159 | } |
152 | 160 | ||
153 | static inline void set_seg_base(unsigned cpu, int entry, void *base) | 161 | static inline void set_seg_base(unsigned cpu, int entry, void *base) |
154 | { | 162 | { |
155 | struct desc_struct *d = &cpu_gdt_table[cpu][entry]; | 163 | struct desc_struct *d = &cpu_gdt(cpu)[entry]; |
156 | u32 addr = (u32)(u64)base; | 164 | u32 addr = (u32)(u64)base; |
157 | BUG_ON((u64)base >> 32); | 165 | BUG_ON((u64)base >> 32); |
158 | d->base0 = addr & 0xffff; | 166 | d->base0 = addr & 0xffff; |
@@ -194,7 +202,7 @@ static inline void set_seg_base(unsigned cpu, int entry, void *base) | |||
194 | 202 | ||
195 | static inline void load_TLS(struct thread_struct *t, unsigned int cpu) | 203 | static inline void load_TLS(struct thread_struct *t, unsigned int cpu) |
196 | { | 204 | { |
197 | u64 *gdt = (u64 *)(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN); | 205 | u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN); |
198 | gdt[0] = t->tls_array[0]; | 206 | gdt[0] = t->tls_array[0]; |
199 | gdt[1] = t->tls_array[1]; | 207 | gdt[1] = t->tls_array[1]; |
200 | gdt[2] = t->tls_array[2]; | 208 | gdt[2] = t->tls_array[2]; |
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h index 36d16dfbac88..49a81a66516e 100644 --- a/include/asm-x86_64/dma-mapping.h +++ b/include/asm-x86_64/dma-mapping.h | |||
@@ -12,155 +12,176 @@ | |||
12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
13 | #include <asm/swiotlb.h> | 13 | #include <asm/swiotlb.h> |
14 | 14 | ||
15 | extern dma_addr_t bad_dma_address; | 15 | struct dma_mapping_ops { |
16 | #define dma_mapping_error(x) \ | 16 | int (*mapping_error)(dma_addr_t dma_addr); |
17 | (swiotlb ? swiotlb_dma_mapping_error(x) : ((x) == bad_dma_address)) | 17 | void* (*alloc_coherent)(struct device *dev, size_t size, |
18 | 18 | dma_addr_t *dma_handle, gfp_t gfp); | |
19 | void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | 19 | void (*free_coherent)(struct device *dev, size_t size, |
20 | gfp_t gfp); | 20 | void *vaddr, dma_addr_t dma_handle); |
21 | void dma_free_coherent(struct device *dev, size_t size, void *vaddr, | 21 | dma_addr_t (*map_single)(struct device *hwdev, void *ptr, |
22 | dma_addr_t dma_handle); | 22 | size_t size, int direction); |
23 | /* like map_single, but doesn't check the device mask */ | ||
24 | dma_addr_t (*map_simple)(struct device *hwdev, char *ptr, | ||
25 | size_t size, int direction); | ||
26 | void (*unmap_single)(struct device *dev, dma_addr_t addr, | ||
27 | size_t size, int direction); | ||
28 | void (*sync_single_for_cpu)(struct device *hwdev, | ||
29 | dma_addr_t dma_handle, size_t size, | ||
30 | int direction); | ||
31 | void (*sync_single_for_device)(struct device *hwdev, | ||
32 | dma_addr_t dma_handle, size_t size, | ||
33 | int direction); | ||
34 | void (*sync_single_range_for_cpu)(struct device *hwdev, | ||
35 | dma_addr_t dma_handle, unsigned long offset, | ||
36 | size_t size, int direction); | ||
37 | void (*sync_single_range_for_device)(struct device *hwdev, | ||
38 | dma_addr_t dma_handle, unsigned long offset, | ||
39 | size_t size, int direction); | ||
40 | void (*sync_sg_for_cpu)(struct device *hwdev, | ||
41 | struct scatterlist *sg, int nelems, | ||
42 | int direction); | ||
43 | void (*sync_sg_for_device)(struct device *hwdev, | ||
44 | struct scatterlist *sg, int nelems, | ||
45 | int direction); | ||
46 | int (*map_sg)(struct device *hwdev, struct scatterlist *sg, | ||
47 | int nents, int direction); | ||
48 | void (*unmap_sg)(struct device *hwdev, | ||
49 | struct scatterlist *sg, int nents, | ||
50 | int direction); | ||
51 | int (*dma_supported)(struct device *hwdev, u64 mask); | ||
52 | int is_phys; | ||
53 | }; | ||
23 | 54 | ||
24 | #ifdef CONFIG_GART_IOMMU | 55 | extern dma_addr_t bad_dma_address; |
56 | extern struct dma_mapping_ops* dma_ops; | ||
57 | extern int iommu_merge; | ||
25 | 58 | ||
26 | extern dma_addr_t dma_map_single(struct device *hwdev, void *ptr, size_t size, | 59 | static inline int dma_mapping_error(dma_addr_t dma_addr) |
27 | int direction); | 60 | { |
28 | extern void dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size, | 61 | if (dma_ops->mapping_error) |
29 | int direction); | 62 | return dma_ops->mapping_error(dma_addr); |
30 | 63 | ||
31 | #else | 64 | return (dma_addr == bad_dma_address); |
65 | } | ||
32 | 66 | ||
33 | /* No IOMMU */ | 67 | extern void *dma_alloc_coherent(struct device *dev, size_t size, |
68 | dma_addr_t *dma_handle, gfp_t gfp); | ||
69 | extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr, | ||
70 | dma_addr_t dma_handle); | ||
34 | 71 | ||
35 | static inline dma_addr_t dma_map_single(struct device *hwdev, void *ptr, | 72 | static inline dma_addr_t |
36 | size_t size, int direction) | 73 | dma_map_single(struct device *hwdev, void *ptr, size_t size, |
74 | int direction) | ||
37 | { | 75 | { |
38 | dma_addr_t addr; | 76 | return dma_ops->map_single(hwdev, ptr, size, direction); |
39 | |||
40 | if (direction == DMA_NONE) | ||
41 | out_of_line_bug(); | ||
42 | addr = virt_to_bus(ptr); | ||
43 | |||
44 | if ((addr+size) & ~*hwdev->dma_mask) | ||
45 | out_of_line_bug(); | ||
46 | return addr; | ||
47 | } | 77 | } |
48 | 78 | ||
49 | static inline void dma_unmap_single(struct device *hwdev, dma_addr_t dma_addr, | 79 | static inline void |
50 | size_t size, int direction) | 80 | dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size, |
81 | int direction) | ||
51 | { | 82 | { |
52 | if (direction == DMA_NONE) | 83 | dma_ops->unmap_single(dev, addr, size, direction); |
53 | out_of_line_bug(); | ||
54 | /* Nothing to do */ | ||
55 | } | 84 | } |
56 | 85 | ||
57 | #endif | ||
58 | |||
59 | #define dma_map_page(dev,page,offset,size,dir) \ | 86 | #define dma_map_page(dev,page,offset,size,dir) \ |
60 | dma_map_single((dev), page_address(page)+(offset), (size), (dir)) | 87 | dma_map_single((dev), page_address(page)+(offset), (size), (dir)) |
61 | 88 | ||
62 | static inline void dma_sync_single_for_cpu(struct device *hwdev, | 89 | #define dma_unmap_page dma_unmap_single |
63 | dma_addr_t dma_handle, | ||
64 | size_t size, int direction) | ||
65 | { | ||
66 | if (direction == DMA_NONE) | ||
67 | out_of_line_bug(); | ||
68 | |||
69 | if (swiotlb) | ||
70 | return swiotlb_sync_single_for_cpu(hwdev,dma_handle,size,direction); | ||
71 | 90 | ||
91 | static inline void | ||
92 | dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle, | ||
93 | size_t size, int direction) | ||
94 | { | ||
95 | if (dma_ops->sync_single_for_cpu) | ||
96 | dma_ops->sync_single_for_cpu(hwdev, dma_handle, size, | ||
97 | direction); | ||
72 | flush_write_buffers(); | 98 | flush_write_buffers(); |
73 | } | 99 | } |
74 | 100 | ||
75 | static inline void dma_sync_single_for_device(struct device *hwdev, | 101 | static inline void |
76 | dma_addr_t dma_handle, | 102 | dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle, |
77 | size_t size, int direction) | 103 | size_t size, int direction) |
78 | { | 104 | { |
79 | if (direction == DMA_NONE) | 105 | if (dma_ops->sync_single_for_device) |
80 | out_of_line_bug(); | 106 | dma_ops->sync_single_for_device(hwdev, dma_handle, size, |
81 | 107 | direction); | |
82 | if (swiotlb) | ||
83 | return swiotlb_sync_single_for_device(hwdev,dma_handle,size,direction); | ||
84 | |||
85 | flush_write_buffers(); | 108 | flush_write_buffers(); |
86 | } | 109 | } |
87 | 110 | ||
88 | static inline void dma_sync_single_range_for_cpu(struct device *hwdev, | 111 | static inline void |
89 | dma_addr_t dma_handle, | 112 | dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle, |
90 | unsigned long offset, | 113 | unsigned long offset, size_t size, int direction) |
91 | size_t size, int direction) | ||
92 | { | 114 | { |
93 | if (direction == DMA_NONE) | 115 | if (dma_ops->sync_single_range_for_cpu) { |
94 | out_of_line_bug(); | 116 | dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset, size, direction); |
95 | 117 | } | |
96 | if (swiotlb) | ||
97 | return swiotlb_sync_single_range_for_cpu(hwdev,dma_handle,offset,size,direction); | ||
98 | 118 | ||
99 | flush_write_buffers(); | 119 | flush_write_buffers(); |
100 | } | 120 | } |
101 | 121 | ||
102 | static inline void dma_sync_single_range_for_device(struct device *hwdev, | 122 | static inline void |
103 | dma_addr_t dma_handle, | 123 | dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle, |
104 | unsigned long offset, | 124 | unsigned long offset, size_t size, int direction) |
105 | size_t size, int direction) | ||
106 | { | 125 | { |
107 | if (direction == DMA_NONE) | 126 | if (dma_ops->sync_single_range_for_device) |
108 | out_of_line_bug(); | 127 | dma_ops->sync_single_range_for_device(hwdev, dma_handle, |
109 | 128 | offset, size, direction); | |
110 | if (swiotlb) | ||
111 | return swiotlb_sync_single_range_for_device(hwdev,dma_handle,offset,size,direction); | ||
112 | 129 | ||
113 | flush_write_buffers(); | 130 | flush_write_buffers(); |
114 | } | 131 | } |
115 | 132 | ||
116 | static inline void dma_sync_sg_for_cpu(struct device *hwdev, | 133 | static inline void |
117 | struct scatterlist *sg, | 134 | dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, |
118 | int nelems, int direction) | 135 | int nelems, int direction) |
119 | { | 136 | { |
120 | if (direction == DMA_NONE) | 137 | if (dma_ops->sync_sg_for_cpu) |
121 | out_of_line_bug(); | 138 | dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction); |
122 | |||
123 | if (swiotlb) | ||
124 | return swiotlb_sync_sg_for_cpu(hwdev,sg,nelems,direction); | ||
125 | |||
126 | flush_write_buffers(); | 139 | flush_write_buffers(); |
127 | } | 140 | } |
128 | 141 | ||
129 | static inline void dma_sync_sg_for_device(struct device *hwdev, | 142 | static inline void |
130 | struct scatterlist *sg, | 143 | dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, |
131 | int nelems, int direction) | 144 | int nelems, int direction) |
132 | { | 145 | { |
133 | if (direction == DMA_NONE) | 146 | if (dma_ops->sync_sg_for_device) { |
134 | out_of_line_bug(); | 147 | dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction); |
135 | 148 | } | |
136 | if (swiotlb) | ||
137 | return swiotlb_sync_sg_for_device(hwdev,sg,nelems,direction); | ||
138 | 149 | ||
139 | flush_write_buffers(); | 150 | flush_write_buffers(); |
140 | } | 151 | } |
141 | 152 | ||
142 | extern int dma_map_sg(struct device *hwdev, struct scatterlist *sg, | 153 | static inline int |
143 | int nents, int direction); | 154 | dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction) |
144 | extern void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, | 155 | { |
145 | int nents, int direction); | 156 | return dma_ops->map_sg(hwdev, sg, nents, direction); |
157 | } | ||
146 | 158 | ||
147 | #define dma_unmap_page dma_unmap_single | 159 | static inline void |
160 | dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, | ||
161 | int direction) | ||
162 | { | ||
163 | dma_ops->unmap_sg(hwdev, sg, nents, direction); | ||
164 | } | ||
148 | 165 | ||
149 | extern int dma_supported(struct device *hwdev, u64 mask); | 166 | extern int dma_supported(struct device *hwdev, u64 mask); |
150 | extern int dma_get_cache_alignment(void); | ||
151 | #define dma_is_consistent(h) 1 | ||
152 | 167 | ||
153 | static inline int dma_set_mask(struct device *dev, u64 mask) | 168 | /* same for gart, swiotlb, and nommu */ |
169 | static inline int dma_get_cache_alignment(void) | ||
154 | { | 170 | { |
155 | if (!dev->dma_mask || !dma_supported(dev, mask)) | 171 | return boot_cpu_data.x86_clflush_size; |
156 | return -EIO; | ||
157 | *dev->dma_mask = mask; | ||
158 | return 0; | ||
159 | } | 172 | } |
160 | 173 | ||
161 | static inline void dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir) | 174 | #define dma_is_consistent(h) 1 |
175 | |||
176 | extern int dma_set_mask(struct device *dev, u64 mask); | ||
177 | |||
178 | static inline void | ||
179 | dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir) | ||
162 | { | 180 | { |
163 | flush_write_buffers(); | 181 | flush_write_buffers(); |
164 | } | 182 | } |
165 | 183 | ||
166 | #endif | 184 | extern struct device fallback_dev; |
185 | extern int panic_on_overflow; | ||
186 | |||
187 | #endif /* _X8664_DMA_MAPPING_H */ | ||
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h index 582757fc0365..07654bd155bf 100644 --- a/include/asm-x86_64/dwarf2.h +++ b/include/asm-x86_64/dwarf2.h | |||
@@ -14,7 +14,7 @@ | |||
14 | away for older version. | 14 | away for older version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifdef CONFIG_DEBUG_INFO | 17 | #ifdef CONFIG_UNWIND_INFO |
18 | 18 | ||
19 | #define CFI_STARTPROC .cfi_startproc | 19 | #define CFI_STARTPROC .cfi_startproc |
20 | #define CFI_ENDPROC .cfi_endproc | 20 | #define CFI_ENDPROC .cfi_endproc |
@@ -28,6 +28,7 @@ | |||
28 | #define CFI_RESTORE .cfi_restore | 28 | #define CFI_RESTORE .cfi_restore |
29 | #define CFI_REMEMBER_STATE .cfi_remember_state | 29 | #define CFI_REMEMBER_STATE .cfi_remember_state |
30 | #define CFI_RESTORE_STATE .cfi_restore_state | 30 | #define CFI_RESTORE_STATE .cfi_restore_state |
31 | #define CFI_UNDEFINED .cfi_undefined | ||
31 | 32 | ||
32 | #else | 33 | #else |
33 | 34 | ||
@@ -44,6 +45,7 @@ | |||
44 | #define CFI_RESTORE # | 45 | #define CFI_RESTORE # |
45 | #define CFI_REMEMBER_STATE # | 46 | #define CFI_REMEMBER_STATE # |
46 | #define CFI_RESTORE_STATE # | 47 | #define CFI_RESTORE_STATE # |
48 | #define CFI_UNDEFINED # | ||
47 | 49 | ||
48 | #endif | 50 | #endif |
49 | 51 | ||
diff --git a/include/asm-x86_64/gart-mapping.h b/include/asm-x86_64/gart-mapping.h new file mode 100644 index 000000000000..ada497b0b55b --- /dev/null +++ b/include/asm-x86_64/gart-mapping.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _X8664_GART_MAPPING_H | ||
2 | #define _X8664_GART_MAPPING_H 1 | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/types.h> | ||
6 | |||
7 | struct device; | ||
8 | |||
9 | extern void* | ||
10 | gart_alloc_coherent(struct device *dev, size_t size, | ||
11 | dma_addr_t *dma_handle, gfp_t gfp); | ||
12 | |||
13 | extern int | ||
14 | gart_dma_supported(struct device *hwdev, u64 mask); | ||
15 | |||
16 | #endif /* _X8664_GART_MAPPING_H */ | ||
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h index c14a8c7267a6..0df1715dee71 100644 --- a/include/asm-x86_64/hw_irq.h +++ b/include/asm-x86_64/hw_irq.h | |||
@@ -46,18 +46,18 @@ struct hw_interrupt_type; | |||
46 | * some of the following vectors are 'rare', they are merged | 46 | * some of the following vectors are 'rare', they are merged |
47 | * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. | 47 | * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. |
48 | * TLB, reschedule and local APIC vectors are performance-critical. | 48 | * TLB, reschedule and local APIC vectors are performance-critical. |
49 | * | ||
50 | * Vectors 0xf0-0xf9 are free (reserved for future Linux use). | ||
51 | */ | 49 | */ |
52 | #define SPURIOUS_APIC_VECTOR 0xff | 50 | #define SPURIOUS_APIC_VECTOR 0xff |
53 | #define ERROR_APIC_VECTOR 0xfe | 51 | #define ERROR_APIC_VECTOR 0xfe |
54 | #define RESCHEDULE_VECTOR 0xfd | 52 | #define RESCHEDULE_VECTOR 0xfd |
55 | #define CALL_FUNCTION_VECTOR 0xfc | 53 | #define CALL_FUNCTION_VECTOR 0xfc |
56 | #define KDB_VECTOR 0xfb /* reserved for KDB */ | 54 | /* fb free - please don't readd KDB here because it's useless |
55 | (hint - think what a NMI bit does to a vector) */ | ||
57 | #define THERMAL_APIC_VECTOR 0xfa | 56 | #define THERMAL_APIC_VECTOR 0xfa |
58 | #define THRESHOLD_APIC_VECTOR 0xf9 | 57 | #define THRESHOLD_APIC_VECTOR 0xf9 |
59 | #define INVALIDATE_TLB_VECTOR_END 0xf8 | 58 | /* f8 free */ |
60 | #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */ | 59 | #define INVALIDATE_TLB_VECTOR_END 0xf7 |
60 | #define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */ | ||
61 | 61 | ||
62 | #define NUM_INVALIDATE_TLB_VECTORS 8 | 62 | #define NUM_INVALIDATE_TLB_VECTORS 8 |
63 | 63 | ||
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h index aa39cfd0e001..57f7e1433849 100644 --- a/include/asm-x86_64/i387.h +++ b/include/asm-x86_64/i387.h | |||
@@ -75,7 +75,8 @@ extern int set_fpregs(struct task_struct *tsk, | |||
75 | static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | 75 | static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) |
76 | { | 76 | { |
77 | int err; | 77 | int err; |
78 | asm volatile("1: rex64 ; fxrstor (%[fx])\n\t" | 78 | |
79 | asm volatile("1: rex64/fxrstor (%[fx])\n\t" | ||
79 | "2:\n" | 80 | "2:\n" |
80 | ".section .fixup,\"ax\"\n" | 81 | ".section .fixup,\"ax\"\n" |
81 | "3: movl $-1,%[err]\n" | 82 | "3: movl $-1,%[err]\n" |
@@ -86,7 +87,11 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | |||
86 | " .quad 1b,3b\n" | 87 | " .quad 1b,3b\n" |
87 | ".previous" | 88 | ".previous" |
88 | : [err] "=r" (err) | 89 | : [err] "=r" (err) |
89 | : [fx] "r" (fx), "0" (0)); | 90 | #if 0 /* See comment in __fxsave_clear() below. */ |
91 | : [fx] "r" (fx), "m" (*fx), "0" (0)); | ||
92 | #else | ||
93 | : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0)); | ||
94 | #endif | ||
90 | if (unlikely(err)) | 95 | if (unlikely(err)) |
91 | init_fpu(current); | 96 | init_fpu(current); |
92 | return err; | 97 | return err; |
@@ -95,7 +100,8 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | |||
95 | static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | 100 | static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) |
96 | { | 101 | { |
97 | int err; | 102 | int err; |
98 | asm volatile("1: rex64 ; fxsave (%[fx])\n\t" | 103 | |
104 | asm volatile("1: rex64/fxsave (%[fx])\n\t" | ||
99 | "2:\n" | 105 | "2:\n" |
100 | ".section .fixup,\"ax\"\n" | 106 | ".section .fixup,\"ax\"\n" |
101 | "3: movl $-1,%[err]\n" | 107 | "3: movl $-1,%[err]\n" |
@@ -105,20 +111,53 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | |||
105 | " .align 8\n" | 111 | " .align 8\n" |
106 | " .quad 1b,3b\n" | 112 | " .quad 1b,3b\n" |
107 | ".previous" | 113 | ".previous" |
108 | : [err] "=r" (err) | 114 | : [err] "=r" (err), "=m" (*fx) |
109 | : [fx] "r" (fx), "0" (0)); | 115 | #if 0 /* See comment in __fxsave_clear() below. */ |
116 | : [fx] "r" (fx), "0" (0)); | ||
117 | #else | ||
118 | : [fx] "cdaSDb" (fx), "0" (0)); | ||
119 | #endif | ||
110 | if (unlikely(err)) | 120 | if (unlikely(err)) |
111 | __clear_user(fx, sizeof(struct i387_fxsave_struct)); | 121 | __clear_user(fx, sizeof(struct i387_fxsave_struct)); |
112 | return err; | 122 | return err; |
113 | } | 123 | } |
114 | 124 | ||
125 | static inline void __fxsave_clear(struct task_struct *tsk) | ||
126 | { | ||
127 | /* Using "rex64; fxsave %0" is broken because, if the memory operand | ||
128 | uses any extended registers for addressing, a second REX prefix | ||
129 | will be generated (to the assembler, rex64 followed by semicolon | ||
130 | is a separate instruction), and hence the 64-bitness is lost. */ | ||
131 | #if 0 | ||
132 | /* Using "fxsaveq %0" would be the ideal choice, but is only supported | ||
133 | starting with gas 2.16. */ | ||
134 | __asm__ __volatile__("fxsaveq %0" | ||
135 | : "=m" (tsk->thread.i387.fxsave)); | ||
136 | #elif 0 | ||
137 | /* Using, as a workaround, the properly prefixed form below isn't | ||
138 | accepted by any binutils version so far released, complaining that | ||
139 | the same type of prefix is used twice if an extended register is | ||
140 | needed for addressing (fix submitted to mainline 2005-11-21). */ | ||
141 | __asm__ __volatile__("rex64/fxsave %0" | ||
142 | : "=m" (tsk->thread.i387.fxsave)); | ||
143 | #else | ||
144 | /* This, however, we can work around by forcing the compiler to select | ||
145 | an addressing mode that doesn't require extended registers. */ | ||
146 | __asm__ __volatile__("rex64/fxsave %P2(%1)" | ||
147 | : "=m" (tsk->thread.i387.fxsave) | ||
148 | : "cdaSDb" (tsk), | ||
149 | "i" (offsetof(__typeof__(*tsk), | ||
150 | thread.i387.fxsave))); | ||
151 | #endif | ||
152 | __asm__ __volatile__("fnclex"); | ||
153 | } | ||
154 | |||
115 | static inline void kernel_fpu_begin(void) | 155 | static inline void kernel_fpu_begin(void) |
116 | { | 156 | { |
117 | struct thread_info *me = current_thread_info(); | 157 | struct thread_info *me = current_thread_info(); |
118 | preempt_disable(); | 158 | preempt_disable(); |
119 | if (me->status & TS_USEDFPU) { | 159 | if (me->status & TS_USEDFPU) { |
120 | asm volatile("rex64 ; fxsave %0 ; fnclex" | 160 | __fxsave_clear(me->task); |
121 | : "=m" (me->task->thread.i387.fxsave)); | ||
122 | me->status &= ~TS_USEDFPU; | 161 | me->status &= ~TS_USEDFPU; |
123 | return; | 162 | return; |
124 | } | 163 | } |
@@ -133,8 +172,7 @@ static inline void kernel_fpu_end(void) | |||
133 | 172 | ||
134 | static inline void save_init_fpu( struct task_struct *tsk ) | 173 | static inline void save_init_fpu( struct task_struct *tsk ) |
135 | { | 174 | { |
136 | asm volatile( "rex64 ; fxsave %0 ; fnclex" | 175 | __fxsave_clear(tsk); |
137 | : "=m" (tsk->thread.i387.fxsave)); | ||
138 | tsk->thread_info->status &= ~TS_USEDFPU; | 176 | tsk->thread_info->status &= ~TS_USEDFPU; |
139 | stts(); | 177 | stts(); |
140 | } | 178 | } |
diff --git a/include/asm-x86_64/idle.h b/include/asm-x86_64/idle.h new file mode 100644 index 000000000000..6bd47dcf2067 --- /dev/null +++ b/include/asm-x86_64/idle.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _ASM_X86_64_IDLE_H | ||
2 | #define _ASM_X86_64_IDLE_H 1 | ||
3 | |||
4 | #define IDLE_START 1 | ||
5 | #define IDLE_END 2 | ||
6 | |||
7 | struct notifier_block; | ||
8 | void idle_notifier_register(struct notifier_block *n); | ||
9 | void idle_notifier_unregister(struct notifier_block *n); | ||
10 | |||
11 | void enter_idle(void); | ||
12 | void exit_idle(void); | ||
13 | |||
14 | #endif | ||
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h index 52ff269fe054..9dac18db8291 100644 --- a/include/asm-x86_64/io.h +++ b/include/asm-x86_64/io.h | |||
@@ -143,6 +143,11 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size) | |||
143 | extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); | 143 | extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); |
144 | extern void iounmap(volatile void __iomem *addr); | 144 | extern void iounmap(volatile void __iomem *addr); |
145 | 145 | ||
146 | /* Use normal IO mappings for DMI */ | ||
147 | #define dmi_ioremap ioremap | ||
148 | #define dmi_iounmap(x,l) iounmap(x) | ||
149 | #define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) | ||
150 | |||
146 | /* | 151 | /* |
147 | * ISA I/O bus memory addresses are 1:1 with the physical address. | 152 | * ISA I/O bus memory addresses are 1:1 with the physical address. |
148 | */ | 153 | */ |
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h index 022e9d340ad7..2a5c162b7d92 100644 --- a/include/asm-x86_64/ipi.h +++ b/include/asm-x86_64/ipi.h | |||
@@ -38,10 +38,6 @@ static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, uns | |||
38 | icr |= APIC_DM_FIXED | vector; | 38 | icr |= APIC_DM_FIXED | vector; |
39 | break; | 39 | break; |
40 | case NMI_VECTOR: | 40 | case NMI_VECTOR: |
41 | /* | ||
42 | * Setup KDB IPI to be delivered as an NMI | ||
43 | */ | ||
44 | case KDB_VECTOR: | ||
45 | icr |= APIC_DM_NMI; | 41 | icr |= APIC_DM_NMI; |
46 | break; | 42 | break; |
47 | } | 43 | } |
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h index f604e84c5303..b9ed4c0c8783 100644 --- a/include/asm-x86_64/kdebug.h +++ b/include/asm-x86_64/kdebug.h | |||
@@ -35,9 +35,16 @@ enum die_val { | |||
35 | DIE_PAGE_FAULT, | 35 | DIE_PAGE_FAULT, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) | 38 | static inline int notify_die(enum die_val val, const char *str, |
39 | { | 39 | struct pt_regs *regs, long err, int trap, int sig) |
40 | struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; | 40 | { |
41 | struct die_args args = { | ||
42 | .regs = regs, | ||
43 | .str = str, | ||
44 | .err = err, | ||
45 | .trapnr = trap, | ||
46 | .signr = sig | ||
47 | }; | ||
41 | return notifier_call_chain(&die_chain, val, &args); | 48 | return notifier_call_chain(&die_chain, val, &args); |
42 | } | 49 | } |
43 | 50 | ||
diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h index b630d52bdfb1..16e4be4de0c5 100644 --- a/include/asm-x86_64/mmu_context.h +++ b/include/asm-x86_64/mmu_context.h | |||
@@ -15,18 +15,13 @@ | |||
15 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | 15 | int init_new_context(struct task_struct *tsk, struct mm_struct *mm); |
16 | void destroy_context(struct mm_struct *mm); | 16 | void destroy_context(struct mm_struct *mm); |
17 | 17 | ||
18 | #ifdef CONFIG_SMP | ||
19 | |||
20 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | 18 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
21 | { | 19 | { |
20 | #ifdef CONFIG_SMP | ||
22 | if (read_pda(mmu_state) == TLBSTATE_OK) | 21 | if (read_pda(mmu_state) == TLBSTATE_OK) |
23 | write_pda(mmu_state, TLBSTATE_LAZY); | 22 | write_pda(mmu_state, TLBSTATE_LAZY); |
24 | } | ||
25 | #else | ||
26 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
27 | { | ||
28 | } | ||
29 | #endif | 23 | #endif |
24 | } | ||
30 | 25 | ||
31 | static inline void load_cr3(pgd_t *pgd) | 26 | static inline void load_cr3(pgd_t *pgd) |
32 | { | 27 | { |
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h index 69baaa8a3ce0..972c9359f7d7 100644 --- a/include/asm-x86_64/mmzone.h +++ b/include/asm-x86_64/mmzone.h | |||
@@ -36,22 +36,12 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
36 | NODE_DATA(nid)->node_spanned_pages) | 36 | NODE_DATA(nid)->node_spanned_pages) |
37 | 37 | ||
38 | #ifdef CONFIG_DISCONTIGMEM | 38 | #ifdef CONFIG_DISCONTIGMEM |
39 | |||
40 | #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) | 39 | #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) |
41 | #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) | 40 | #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) |
42 | 41 | ||
43 | /* Requires pfn_valid(pfn) to be true */ | 42 | extern struct page *pfn_to_page(unsigned long pfn); |
44 | #define pfn_to_page(pfn) ({ \ | 43 | extern unsigned long page_to_pfn(struct page *page); |
45 | int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); \ | 44 | extern int pfn_valid(unsigned long pfn); |
46 | ((pfn) - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map; \ | ||
47 | }) | ||
48 | |||
49 | #define page_to_pfn(page) \ | ||
50 | (long)(((page) - page_zone(page)->zone_mem_map) + page_zone(page)->zone_start_pfn) | ||
51 | |||
52 | #define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \ | ||
53 | ({ u8 nid__ = pfn_to_nid(pfn); \ | ||
54 | nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); })) | ||
55 | #endif | 45 | #endif |
56 | 46 | ||
57 | #define local_mapnr(kvaddr) \ | 47 | #define local_mapnr(kvaddr) \ |
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h index 818abfd262d1..11fbee2bd6c0 100644 --- a/include/asm-x86_64/mutex.h +++ b/include/asm-x86_64/mutex.h | |||
@@ -104,7 +104,7 @@ do { \ | |||
104 | static inline int | 104 | static inline int |
105 | __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) | 105 | __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) |
106 | { | 106 | { |
107 | if (likely(atomic_cmpxchg(count, 1, 0)) == 1) | 107 | if (likely(atomic_cmpxchg(count, 1, 0) == 1)) |
108 | return 1; | 108 | return 1; |
109 | else | 109 | else |
110 | return 0; | 110 | return 0; |
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h index d51e56fdc3da..34e434ce3268 100644 --- a/include/asm-x86_64/numa.h +++ b/include/asm-x86_64/numa.h | |||
@@ -20,6 +20,11 @@ extern int numa_off; | |||
20 | extern void numa_set_node(int cpu, int node); | 20 | extern void numa_set_node(int cpu, int node); |
21 | 21 | ||
22 | extern unsigned char apicid_to_node[256]; | 22 | extern unsigned char apicid_to_node[256]; |
23 | #ifdef CONFIG_NUMA | ||
24 | extern void __init init_cpu_to_node(void); | ||
25 | #else | ||
26 | #define init_cpu_to_node() do {} while (0) | ||
27 | #endif | ||
23 | 28 | ||
24 | #define NUMA_NO_NODE 0xff | 29 | #define NUMA_NO_NODE 0xff |
25 | 30 | ||
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h index 06e489f32472..dcbb4fcd9a18 100644 --- a/include/asm-x86_64/page.h +++ b/include/asm-x86_64/page.h | |||
@@ -14,13 +14,18 @@ | |||
14 | #define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK) | 14 | #define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK) |
15 | 15 | ||
16 | #define THREAD_ORDER 1 | 16 | #define THREAD_ORDER 1 |
17 | #ifdef __ASSEMBLY__ | 17 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
18 | #define THREAD_SIZE (1 << (PAGE_SHIFT + THREAD_ORDER)) | ||
19 | #else | ||
20 | #define THREAD_SIZE (1UL << (PAGE_SHIFT + THREAD_ORDER)) | ||
21 | #endif | ||
22 | #define CURRENT_MASK (~(THREAD_SIZE-1)) | 18 | #define CURRENT_MASK (~(THREAD_SIZE-1)) |
23 | 19 | ||
20 | #define EXCEPTION_STACK_ORDER 0 | ||
21 | #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) | ||
22 | |||
23 | #define DEBUG_STACK_ORDER EXCEPTION_STACK_ORDER | ||
24 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) | ||
25 | |||
26 | #define IRQSTACK_ORDER 2 | ||
27 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | ||
28 | |||
24 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) | 29 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) |
25 | #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) | 30 | #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) |
26 | 31 | ||
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h index eeb3088a1c9e..fd03e15d7ea6 100644 --- a/include/asm-x86_64/pci.h +++ b/include/asm-x86_64/pci.h | |||
@@ -42,18 +42,20 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | |||
42 | #include <asm/scatterlist.h> | 42 | #include <asm/scatterlist.h> |
43 | #include <linux/string.h> | 43 | #include <linux/string.h> |
44 | #include <asm/page.h> | 44 | #include <asm/page.h> |
45 | #include <linux/dma-mapping.h> /* for have_iommu */ | ||
45 | 46 | ||
46 | extern int iommu_setup(char *opt); | 47 | extern int iommu_setup(char *opt); |
47 | 48 | ||
48 | #ifdef CONFIG_GART_IOMMU | ||
49 | /* The PCI address space does equal the physical memory | 49 | /* The PCI address space does equal the physical memory |
50 | * address space. The networking and block device layers use | 50 | * address space. The networking and block device layers use |
51 | * this boolean for bounce buffer decisions | 51 | * this boolean for bounce buffer decisions |
52 | * | 52 | * |
53 | * On AMD64 it mostly equals, but we set it to zero to tell some subsystems | 53 | * On AMD64 it mostly equals, but we set it to zero if a hardware |
54 | * that an IOMMU is available. | 54 | * IOMMU (gart) of sotware IOMMU (swiotlb) is available. |
55 | */ | 55 | */ |
56 | #define PCI_DMA_BUS_IS_PHYS (no_iommu ? 1 : 0) | 56 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) |
57 | |||
58 | #ifdef CONFIG_GART_IOMMU | ||
57 | 59 | ||
58 | /* | 60 | /* |
59 | * x86-64 always supports DAC, but sometimes it is useful to force | 61 | * x86-64 always supports DAC, but sometimes it is useful to force |
@@ -79,7 +81,6 @@ extern int iommu_sac_force; | |||
79 | #else | 81 | #else |
80 | /* No IOMMU */ | 82 | /* No IOMMU */ |
81 | 83 | ||
82 | #define PCI_DMA_BUS_IS_PHYS 1 | ||
83 | #define pci_dac_dma_supported(pci_dev, mask) 1 | 84 | #define pci_dac_dma_supported(pci_dev, mask) 1 |
84 | 85 | ||
85 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) | 86 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) |
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h index 8733ccfa442e..c7ab38a601af 100644 --- a/include/asm-x86_64/pda.h +++ b/include/asm-x86_64/pda.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/cache.h> | 7 | #include <linux/cache.h> |
8 | #include <asm/page.h> | ||
8 | 9 | ||
9 | /* Per processor datastructure. %gs points to it while the kernel runs */ | 10 | /* Per processor datastructure. %gs points to it while the kernel runs */ |
10 | struct x8664_pda { | 11 | struct x8664_pda { |
@@ -12,6 +13,9 @@ struct x8664_pda { | |||
12 | unsigned long data_offset; /* Per cpu data offset from linker address */ | 13 | unsigned long data_offset; /* Per cpu data offset from linker address */ |
13 | unsigned long kernelstack; /* top of kernel stack for current */ | 14 | unsigned long kernelstack; /* top of kernel stack for current */ |
14 | unsigned long oldrsp; /* user rsp for system call */ | 15 | unsigned long oldrsp; /* user rsp for system call */ |
16 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | ||
17 | unsigned long debugstack; /* #DB/#BP stack. */ | ||
18 | #endif | ||
15 | int irqcount; /* Irq nesting counter. Starts with -1 */ | 19 | int irqcount; /* Irq nesting counter. Starts with -1 */ |
16 | int cpunumber; /* Logical CPU number */ | 20 | int cpunumber; /* Logical CPU number */ |
17 | char *irqstackptr; /* top of irqstack */ | 21 | char *irqstackptr; /* top of irqstack */ |
@@ -23,11 +27,10 @@ struct x8664_pda { | |||
23 | unsigned apic_timer_irqs; | 27 | unsigned apic_timer_irqs; |
24 | } ____cacheline_aligned_in_smp; | 28 | } ____cacheline_aligned_in_smp; |
25 | 29 | ||
30 | extern struct x8664_pda *_cpu_pda[]; | ||
31 | extern struct x8664_pda boot_cpu_pda[]; | ||
26 | 32 | ||
27 | #define IRQSTACK_ORDER 2 | 33 | #define cpu_pda(i) (_cpu_pda[i]) |
28 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | ||
29 | |||
30 | extern struct x8664_pda cpu_pda[]; | ||
31 | 34 | ||
32 | /* | 35 | /* |
33 | * There is no fast way to get the base address of the PDA, all the accesses | 36 | * There is no fast way to get the base address of the PDA, all the accesses |
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h index 9c71855736fb..29a6b0408f75 100644 --- a/include/asm-x86_64/percpu.h +++ b/include/asm-x86_64/percpu.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #include <asm/pda.h> | 12 | #include <asm/pda.h> |
13 | 13 | ||
14 | #define __per_cpu_offset(cpu) (cpu_pda[cpu].data_offset) | 14 | #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) |
15 | #define __my_cpu_offset() read_pda(data_offset) | 15 | #define __my_cpu_offset() read_pda(data_offset) |
16 | 16 | ||
17 | /* Separate out the type, so (int[3], foo) works. */ | 17 | /* Separate out the type, so (int[3], foo) works. */ |
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h index 02888d7a496f..8fbf4dd72115 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
@@ -267,25 +267,25 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) | |||
267 | */ | 267 | */ |
268 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) | 268 | #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) |
269 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 269 | static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
270 | extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 270 | static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
271 | extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } | 271 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } |
272 | extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | 272 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
273 | extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 273 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
274 | extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } | 274 | static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } |
275 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 275 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
276 | static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; } | 276 | static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; } |
277 | 277 | ||
278 | extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } | 278 | static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } |
279 | extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } | 279 | static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } |
280 | extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } | 280 | static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } |
281 | extern inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } | 281 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } |
282 | extern inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } | 282 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } |
283 | extern inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | 283 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } |
284 | extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } | 284 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } |
285 | extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 285 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
286 | extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 286 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
287 | extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } | 287 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } |
288 | extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; } | 288 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; } |
289 | 289 | ||
290 | struct vm_area_struct; | 290 | struct vm_area_struct; |
291 | 291 | ||
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 4861246548f7..394dd729752d 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h | |||
@@ -227,7 +227,13 @@ struct tss_struct { | |||
227 | extern struct cpuinfo_x86 boot_cpu_data; | 227 | extern struct cpuinfo_x86 boot_cpu_data; |
228 | DECLARE_PER_CPU(struct tss_struct,init_tss); | 228 | DECLARE_PER_CPU(struct tss_struct,init_tss); |
229 | 229 | ||
230 | #ifdef CONFIG_X86_VSMP | ||
231 | #define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT) | ||
232 | #define ARCH_MIN_MMSTRUCT_ALIGN (1 << INTERNODE_CACHE_SHIFT) | ||
233 | #else | ||
230 | #define ARCH_MIN_TASKALIGN 16 | 234 | #define ARCH_MIN_TASKALIGN 16 |
235 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 | ||
236 | #endif | ||
231 | 237 | ||
232 | struct thread_struct { | 238 | struct thread_struct { |
233 | unsigned long rsp0; | 239 | unsigned long rsp0; |
@@ -273,8 +279,6 @@ struct thread_struct { | |||
273 | #define DEBUG_STACK 4 | 279 | #define DEBUG_STACK 4 |
274 | #define MCE_STACK 5 | 280 | #define MCE_STACK 5 |
275 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | 281 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ |
276 | #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) | ||
277 | #define EXCEPTION_STACK_ORDER 0 | ||
278 | 282 | ||
279 | #define start_thread(regs,new_rip,new_rsp) do { \ | 283 | #define start_thread(regs,new_rip,new_rsp) do { \ |
280 | asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \ | 284 | asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \ |
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h index 34501086afef..115e496c6139 100644 --- a/include/asm-x86_64/proto.h +++ b/include/asm-x86_64/proto.h | |||
@@ -67,8 +67,6 @@ extern void load_gs_index(unsigned gs); | |||
67 | 67 | ||
68 | extern unsigned long end_pfn_map; | 68 | extern unsigned long end_pfn_map; |
69 | 69 | ||
70 | extern cpumask_t cpu_initialized; | ||
71 | |||
72 | extern void show_trace(unsigned long * rsp); | 70 | extern void show_trace(unsigned long * rsp); |
73 | extern void show_registers(struct pt_regs *regs); | 71 | extern void show_registers(struct pt_regs *regs); |
74 | 72 | ||
@@ -91,8 +89,12 @@ extern void check_efer(void); | |||
91 | 89 | ||
92 | extern int unhandled_signal(struct task_struct *tsk, int sig); | 90 | extern int unhandled_signal(struct task_struct *tsk, int sig); |
93 | 91 | ||
92 | extern int unsynchronized_tsc(void); | ||
93 | |||
94 | extern void select_idle_routine(const struct cpuinfo_x86 *c); | 94 | extern void select_idle_routine(const struct cpuinfo_x86 *c); |
95 | extern void swiotlb_init(void); | 95 | |
96 | extern void gart_parse_options(char *); | ||
97 | extern void __init no_iommu_init(void); | ||
96 | 98 | ||
97 | extern unsigned long table_start, table_end; | 99 | extern unsigned long table_start, table_end; |
98 | 100 | ||
@@ -106,12 +108,17 @@ extern int skip_ioapic_setup; | |||
106 | extern int acpi_ht; | 108 | extern int acpi_ht; |
107 | extern int acpi_disabled; | 109 | extern int acpi_disabled; |
108 | 110 | ||
111 | #ifdef CONFIG_GART_IOMMU | ||
109 | extern int fallback_aper_order; | 112 | extern int fallback_aper_order; |
110 | extern int fallback_aper_force; | 113 | extern int fallback_aper_force; |
111 | extern int iommu_aperture; | 114 | extern int iommu_aperture; |
112 | extern int iommu_aperture_disabled; | ||
113 | extern int iommu_aperture_allowed; | 115 | extern int iommu_aperture_allowed; |
116 | extern int iommu_aperture_disabled; | ||
114 | extern int fix_aperture; | 117 | extern int fix_aperture; |
118 | #else | ||
119 | #define iommu_aperture 0 | ||
120 | #define iommu_aperture_allowed 0 | ||
121 | #endif | ||
115 | extern int force_iommu; | 122 | extern int force_iommu; |
116 | 123 | ||
117 | extern int reboot_force; | 124 | extern int reboot_force; |
diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h index 44adaf18c11e..d4bed33fb32c 100644 --- a/include/asm-x86_64/segment.h +++ b/include/asm-x86_64/segment.h | |||
@@ -19,15 +19,13 @@ | |||
19 | #define __USER_DS 0x2b /* 5*8+3 */ | 19 | #define __USER_DS 0x2b /* 5*8+3 */ |
20 | #define __USER_CS 0x33 /* 6*8+3 */ | 20 | #define __USER_CS 0x33 /* 6*8+3 */ |
21 | #define __USER32_DS __USER_DS | 21 | #define __USER32_DS __USER_DS |
22 | #define __KERNEL16_CS (GDT_ENTRY_KERNELCS16 * 8) | ||
23 | #define __KERNEL_COMPAT32_CS 0x8 | ||
24 | 22 | ||
25 | #define GDT_ENTRY_TLS 1 | 23 | #define GDT_ENTRY_TLS 1 |
26 | #define GDT_ENTRY_TSS 8 /* needs two entries */ | 24 | #define GDT_ENTRY_TSS 8 /* needs two entries */ |
27 | #define GDT_ENTRY_LDT 10 /* needs two entries */ | 25 | #define GDT_ENTRY_LDT 10 /* needs two entries */ |
28 | #define GDT_ENTRY_TLS_MIN 12 | 26 | #define GDT_ENTRY_TLS_MIN 12 |
29 | #define GDT_ENTRY_TLS_MAX 14 | 27 | #define GDT_ENTRY_TLS_MAX 14 |
30 | #define GDT_ENTRY_KERNELCS16 15 | 28 | /* 15 free */ |
31 | 29 | ||
32 | #define GDT_ENTRY_TLS_ENTRIES 3 | 30 | #define GDT_ENTRY_TLS_ENTRIES 3 |
33 | 31 | ||
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index d030409a8fb5..9ccbb2cfd5c0 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -35,6 +35,7 @@ extern cpumask_t cpu_present_mask; | |||
35 | extern cpumask_t cpu_possible_map; | 35 | extern cpumask_t cpu_possible_map; |
36 | extern cpumask_t cpu_online_map; | 36 | extern cpumask_t cpu_online_map; |
37 | extern cpumask_t cpu_callout_map; | 37 | extern cpumask_t cpu_callout_map; |
38 | extern cpumask_t cpu_initialized; | ||
38 | 39 | ||
39 | /* | 40 | /* |
40 | * Private routines/data | 41 | * Private routines/data |
diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h index dddf1b218681..60757efd1353 100644 --- a/include/asm-x86_64/swiotlb.h +++ b/include/asm-x86_64/swiotlb.h | |||
@@ -3,10 +3,14 @@ | |||
3 | 3 | ||
4 | #include <linux/config.h> | 4 | #include <linux/config.h> |
5 | 5 | ||
6 | #include <asm/dma-mapping.h> | ||
7 | |||
6 | /* SWIOTLB interface */ | 8 | /* SWIOTLB interface */ |
7 | 9 | ||
8 | extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, | 10 | extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, |
9 | int dir); | 11 | size_t size, int dir); |
12 | extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
13 | dma_addr_t *dma_handle, gfp_t flags); | ||
10 | extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, | 14 | extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, |
11 | size_t size, int dir); | 15 | size_t size, int dir); |
12 | extern void swiotlb_sync_single_for_cpu(struct device *hwdev, | 16 | extern void swiotlb_sync_single_for_cpu(struct device *hwdev, |
@@ -34,10 +38,10 @@ extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, | |||
34 | extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, | 38 | extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, |
35 | int nents, int direction); | 39 | int nents, int direction); |
36 | extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr); | 40 | extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr); |
37 | extern void *swiotlb_alloc_coherent (struct device *hwdev, size_t size, | ||
38 | dma_addr_t *dma_handle, gfp_t flags); | ||
39 | extern void swiotlb_free_coherent (struct device *hwdev, size_t size, | 41 | extern void swiotlb_free_coherent (struct device *hwdev, size_t size, |
40 | void *vaddr, dma_addr_t dma_handle); | 42 | void *vaddr, dma_addr_t dma_handle); |
43 | extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); | ||
44 | extern void swiotlb_init(void); | ||
41 | 45 | ||
42 | #ifdef CONFIG_SWIOTLB | 46 | #ifdef CONFIG_SWIOTLB |
43 | extern int swiotlb; | 47 | extern int swiotlb; |
@@ -45,4 +49,6 @@ extern int swiotlb; | |||
45 | #define swiotlb 0 | 49 | #define swiotlb 0 |
46 | #endif | 50 | #endif |
47 | 51 | ||
48 | #endif | 52 | extern void pci_swiotlb_init(void); |
53 | |||
54 | #endif /* _ASM_SWTIOLB_H */ | ||
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index b34cc2ee222b..38c1e8a69c9c 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -20,8 +20,8 @@ | |||
20 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" | 20 | #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" |
21 | 21 | ||
22 | /* frame pointer must be last for get_wchan */ | 22 | /* frame pointer must be last for get_wchan */ |
23 | #define SAVE_CONTEXT "pushfq ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" | 23 | #define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" |
24 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popfq\n\t" | 24 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" |
25 | 25 | ||
26 | #define __EXTRA_CLOBBER \ | 26 | #define __EXTRA_CLOBBER \ |
27 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" | 27 | ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" |
@@ -137,6 +137,21 @@ struct alt_instr { | |||
137 | "663:\n\t" newinstr "\n664:\n" /* replacement */ \ | 137 | "663:\n\t" newinstr "\n664:\n" /* replacement */ \ |
138 | ".previous" :: "i" (feature), ##input) | 138 | ".previous" :: "i" (feature), ##input) |
139 | 139 | ||
140 | /* Like alternative_input, but with a single output argument */ | ||
141 | #define alternative_io(oldinstr, newinstr, feature, output, input...) \ | ||
142 | asm volatile ("661:\n\t" oldinstr "\n662:\n" \ | ||
143 | ".section .altinstructions,\"a\"\n" \ | ||
144 | " .align 8\n" \ | ||
145 | " .quad 661b\n" /* label */ \ | ||
146 | " .quad 663f\n" /* new instruction */ \ | ||
147 | " .byte %c[feat]\n" /* feature bit */ \ | ||
148 | " .byte 662b-661b\n" /* sourcelen */ \ | ||
149 | " .byte 664f-663f\n" /* replacementlen */ \ | ||
150 | ".previous\n" \ | ||
151 | ".section .altinstr_replacement,\"ax\"\n" \ | ||
152 | "663:\n\t" newinstr "\n664:\n" /* replacement */ \ | ||
153 | ".previous" : output : [feat] "i" (feature), ##input) | ||
154 | |||
140 | /* | 155 | /* |
141 | * Clear and set 'TS' bit respectively | 156 | * Clear and set 'TS' bit respectively |
142 | */ | 157 | */ |
@@ -311,8 +326,25 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |||
311 | /* interrupt control.. */ | 326 | /* interrupt control.. */ |
312 | #define local_save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0) | 327 | #define local_save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0) |
313 | #define local_irq_restore(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc") | 328 | #define local_irq_restore(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc") |
329 | |||
330 | #ifdef CONFIG_X86_VSMP | ||
331 | /* Interrupt control for VSMP architecture */ | ||
332 | #define local_irq_disable() do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags & ~(1 << 9)) | (1 << 18)); } while (0) | ||
333 | #define local_irq_enable() do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags | (1 << 9)) & ~(1 << 18)); } while (0) | ||
334 | |||
335 | #define irqs_disabled() \ | ||
336 | ({ \ | ||
337 | unsigned long flags; \ | ||
338 | local_save_flags(flags); \ | ||
339 | (flags & (1<<18)) || !(flags & (1<<9)); \ | ||
340 | }) | ||
341 | |||
342 | /* For spinlocks etc */ | ||
343 | #define local_irq_save(x) do { local_save_flags(x); local_irq_restore((x & ~(1 << 9)) | (1 << 18)); } while (0) | ||
344 | #else /* CONFIG_X86_VSMP */ | ||
314 | #define local_irq_disable() __asm__ __volatile__("cli": : :"memory") | 345 | #define local_irq_disable() __asm__ __volatile__("cli": : :"memory") |
315 | #define local_irq_enable() __asm__ __volatile__("sti": : :"memory") | 346 | #define local_irq_enable() __asm__ __volatile__("sti": : :"memory") |
347 | |||
316 | /* used in the idle loop; sti takes one instruction cycle to complete */ | 348 | /* used in the idle loop; sti takes one instruction cycle to complete */ |
317 | #define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") | 349 | #define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") |
318 | /* used when interrupts are already enabled or to shutdown the processor */ | 350 | /* used when interrupts are already enabled or to shutdown the processor */ |
@@ -327,16 +359,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |||
327 | 359 | ||
328 | /* For spinlocks etc */ | 360 | /* For spinlocks etc */ |
329 | #define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0) | 361 | #define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0) |
362 | #endif | ||
330 | 363 | ||
331 | void cpu_idle_wait(void); | 364 | void cpu_idle_wait(void); |
332 | 365 | ||
333 | /* | ||
334 | * disable hlt during certain critical i/o operations | ||
335 | */ | ||
336 | #define HAVE_DISABLE_HLT | ||
337 | void disable_hlt(void); | ||
338 | void enable_hlt(void); | ||
339 | |||
340 | extern unsigned long arch_align_stack(unsigned long sp); | 366 | extern unsigned long arch_align_stack(unsigned long sp); |
341 | 367 | ||
342 | #endif | 368 | #endif |
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index 08eb6e4f3737..eb7c5fda1870 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h | |||
@@ -138,6 +138,7 @@ static inline struct thread_info *stack_thread_info(void) | |||
138 | * have to worry about atomic accesses. | 138 | * have to worry about atomic accesses. |
139 | */ | 139 | */ |
140 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ | 140 | #define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ |
141 | #define TS_COMPAT 0x0002 /* 32bit syscall active */ | ||
141 | 142 | ||
142 | #endif /* __KERNEL__ */ | 143 | #endif /* __KERNEL__ */ |
143 | 144 | ||
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h index f971f45d6d78..f18443fcdf04 100644 --- a/include/asm-x86_64/timex.h +++ b/include/asm-x86_64/timex.h | |||
@@ -10,6 +10,9 @@ | |||
10 | #include <asm/msr.h> | 10 | #include <asm/msr.h> |
11 | #include <asm/vsyscall.h> | 11 | #include <asm/vsyscall.h> |
12 | #include <asm/hpet.h> | 12 | #include <asm/hpet.h> |
13 | #include <asm/system.h> | ||
14 | #include <asm/processor.h> | ||
15 | #include <linux/compiler.h> | ||
13 | 16 | ||
14 | #define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ | 17 | #define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ |
15 | 18 | ||
@@ -23,6 +26,19 @@ static inline cycles_t get_cycles (void) | |||
23 | return ret; | 26 | return ret; |
24 | } | 27 | } |
25 | 28 | ||
29 | /* Like get_cycles, but make sure the CPU is synchronized. */ | ||
30 | static __always_inline cycles_t get_cycles_sync(void) | ||
31 | { | ||
32 | unsigned long long ret; | ||
33 | unsigned eax; | ||
34 | /* Don't do an additional sync on CPUs where we know | ||
35 | RDTSC is already synchronous. */ | ||
36 | alternative_io(ASM_NOP2, "cpuid", X86_FEATURE_SYNC_RDTSC, | ||
37 | "=a" (eax), "0" (1) : "ebx","ecx","edx","memory"); | ||
38 | rdtscll(ret); | ||
39 | return ret; | ||
40 | } | ||
41 | |||
26 | extern unsigned int cpu_khz; | 42 | extern unsigned int cpu_khz; |
27 | 43 | ||
28 | extern int read_current_timer(unsigned long *timer_value); | 44 | extern int read_current_timer(unsigned long *timer_value); |
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h index 1bb8b8a24436..2892c4b7a28b 100644 --- a/include/asm-x86_64/uaccess.h +++ b/include/asm-x86_64/uaccess.h | |||
@@ -348,6 +348,7 @@ static inline int __copy_in_user(void __user *dst, const void __user *src, unsig | |||
348 | long strncpy_from_user(char *dst, const char __user *src, long count); | 348 | long strncpy_from_user(char *dst, const char __user *src, long count); |
349 | long __strncpy_from_user(char *dst, const char __user *src, long count); | 349 | long __strncpy_from_user(char *dst, const char __user *src, long count); |
350 | long strnlen_user(const char __user *str, long n); | 350 | long strnlen_user(const char __user *str, long n); |
351 | long __strnlen_user(const char __user *str, long n); | ||
351 | long strlen_user(const char __user *str); | 352 | long strlen_user(const char __user *str); |
352 | unsigned long clear_user(void __user *mem, unsigned long len); | 353 | unsigned long clear_user(void __user *mem, unsigned long len); |
353 | unsigned long __clear_user(void __user *mem, unsigned long len); | 354 | unsigned long __clear_user(void __user *mem, unsigned long len); |
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index 438a3f52f839..a85e16f56d73 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h | |||
@@ -36,8 +36,8 @@ struct vxtime_data { | |||
36 | int mode; | 36 | int mode; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | #define hpet_readl(a) readl((void *)fix_to_virt(FIX_HPET_BASE) + a) | 39 | #define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) |
40 | #define hpet_writel(d,a) writel(d, (void *)fix_to_virt(FIX_HPET_BASE) + a) | 40 | #define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) |
41 | 41 | ||
42 | /* vsyscall space (readonly) */ | 42 | /* vsyscall space (readonly) */ |
43 | extern struct vxtime_data __vxtime; | 43 | extern struct vxtime_data __vxtime; |
diff --git a/include/linux/capability.h b/include/linux/capability.h index 6b4618902d3d..5a23ce752629 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
@@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct { | |||
43 | #ifdef __KERNEL__ | 43 | #ifdef __KERNEL__ |
44 | 44 | ||
45 | #include <linux/spinlock.h> | 45 | #include <linux/spinlock.h> |
46 | #include <asm/current.h> | ||
46 | 47 | ||
47 | /* #define STRICT_CAP_T_TYPECHECKS */ | 48 | /* #define STRICT_CAP_T_TYPECHECKS */ |
48 | 49 | ||
@@ -356,6 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c) | |||
356 | 357 | ||
357 | #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) | 358 | #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) |
358 | 359 | ||
360 | extern int capable(int cap); | ||
361 | |||
359 | #endif /* __KERNEL__ */ | 362 | #endif /* __KERNEL__ */ |
360 | 363 | ||
361 | #endif /* !_LINUX_CAPABILITY_H */ | 364 | #endif /* !_LINUX_CAPABILITY_H */ |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 05f4132622fc..2e6bbe014157 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __DMI_H__ | 2 | #define __DMI_H__ |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/config.h> | ||
5 | 6 | ||
6 | enum dmi_field { | 7 | enum dmi_field { |
7 | DMI_NONE, | 8 | DMI_NONE, |
@@ -60,12 +61,14 @@ struct dmi_device { | |||
60 | void *device_data; /* Type specific data */ | 61 | void *device_data; /* Type specific data */ |
61 | }; | 62 | }; |
62 | 63 | ||
63 | #if defined(CONFIG_X86_32) | 64 | #ifdef CONFIG_DMI |
64 | 65 | ||
65 | extern int dmi_check_system(struct dmi_system_id *list); | 66 | extern int dmi_check_system(struct dmi_system_id *list); |
66 | extern char * dmi_get_system_info(int field); | 67 | extern char * dmi_get_system_info(int field); |
67 | extern struct dmi_device * dmi_find_device(int type, const char *name, | 68 | extern struct dmi_device * dmi_find_device(int type, const char *name, |
68 | struct dmi_device *from); | 69 | struct dmi_device *from); |
70 | extern void dmi_scan_machine(void); | ||
71 | |||
69 | #else | 72 | #else |
70 | 73 | ||
71 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } | 74 | static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 8b2eab90abb6..20f9148e38d9 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -57,6 +57,7 @@ struct vm_area_struct; | |||
57 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ | 57 | __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ |
58 | __GFP_NOMEMALLOC|__GFP_HARDWALL) | 58 | __GFP_NOMEMALLOC|__GFP_HARDWALL) |
59 | 59 | ||
60 | /* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */ | ||
60 | #define GFP_ATOMIC (__GFP_HIGH) | 61 | #define GFP_ATOMIC (__GFP_HIGH) |
61 | #define GFP_NOIO (__GFP_WAIT) | 62 | #define GFP_NOIO (__GFP_WAIT) |
62 | #define GFP_NOFS (__GFP_WAIT | __GFP_IO) | 63 | #define GFP_NOFS (__GFP_WAIT | __GFP_IO) |
@@ -109,6 +110,10 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | |||
109 | if (unlikely(order >= MAX_ORDER)) | 110 | if (unlikely(order >= MAX_ORDER)) |
110 | return NULL; | 111 | return NULL; |
111 | 112 | ||
113 | /* Unknown node is current node */ | ||
114 | if (nid < 0) | ||
115 | nid = numa_node_id(); | ||
116 | |||
112 | return __alloc_pages(gfp_mask, order, | 117 | return __alloc_pages(gfp_mask, order, |
113 | NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); | 118 | NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); |
114 | } | 119 | } |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 10005bc92a31..669756bc20a2 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -68,6 +68,9 @@ struct kprobe { | |||
68 | /* list of kprobes for multi-handler support */ | 68 | /* list of kprobes for multi-handler support */ |
69 | struct list_head list; | 69 | struct list_head list; |
70 | 70 | ||
71 | /* Indicates that the corresponding module has been ref counted */ | ||
72 | unsigned int mod_refcounted; | ||
73 | |||
71 | /*count the number of times this probe was temporarily disarmed */ | 74 | /*count the number of times this probe was temporarily disarmed */ |
72 | unsigned long nmissed; | 75 | unsigned long nmissed; |
73 | 76 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index e53d2c6fd5f4..c643016499a1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/errno.h> | 5 | #include <linux/errno.h> |
6 | #include <linux/capability.h> | ||
6 | 7 | ||
7 | #ifdef __KERNEL__ | 8 | #ifdef __KERNEL__ |
8 | 9 | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 7e4ae6ab1977..34cbefd2ebde 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -98,7 +98,7 @@ struct per_cpu_pageset { | |||
98 | 98 | ||
99 | /* | 99 | /* |
100 | * On machines where it is needed (eg PCs) we divide physical memory | 100 | * On machines where it is needed (eg PCs) we divide physical memory |
101 | * into multiple physical zones. On a PC we have 4 zones: | 101 | * into multiple physical zones. On a 32bit PC we have 4 zones: |
102 | * | 102 | * |
103 | * ZONE_DMA < 16 MB ISA DMA capable memory | 103 | * ZONE_DMA < 16 MB ISA DMA capable memory |
104 | * ZONE_DMA32 0 MB Empty | 104 | * ZONE_DMA32 0 MB Empty |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index f55c98a68aa9..7fb397e3f2d3 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2152,6 +2152,9 @@ | |||
2152 | #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 | 2152 | #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 |
2153 | #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 | 2153 | #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 |
2154 | 2154 | ||
2155 | #define PCI_VENDOR_ID_SCALEMP 0x8686 | ||
2156 | #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010 | ||
2157 | |||
2155 | #define PCI_VENDOR_ID_COMPUTONE 0x8e0e | 2158 | #define PCI_VENDOR_ID_COMPUTONE 0x8e0e |
2156 | #define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 | 2159 | #define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 |
2157 | #define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 | 2160 | #define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 |
diff --git a/include/linux/sched.h b/include/linux/sched.h index c4ee35dd18ae..3b74c4bf2934 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1112,21 +1112,6 @@ static inline int sas_ss_flags(unsigned long sp) | |||
1112 | : on_sig_stack(sp) ? SS_ONSTACK : 0); | 1112 | : on_sig_stack(sp) ? SS_ONSTACK : 0); |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | |||
1116 | #ifdef CONFIG_SECURITY | ||
1117 | /* code is in security.c */ | ||
1118 | extern int capable(int cap); | ||
1119 | #else | ||
1120 | static inline int capable(int cap) | ||
1121 | { | ||
1122 | if (cap_raised(current->cap_effective, cap)) { | ||
1123 | current->flags |= PF_SUPERPRIV; | ||
1124 | return 1; | ||
1125 | } | ||
1126 | return 0; | ||
1127 | } | ||
1128 | #endif | ||
1129 | |||
1130 | /* | 1115 | /* |
1131 | * Routines for handling mm_structs | 1116 | * Routines for handling mm_structs |
1132 | */ | 1117 | */ |
diff --git a/init/Kconfig b/init/Kconfig index 9bdd5492a95b..25f4d74adf7e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -326,15 +326,6 @@ config BUG | |||
326 | option for embedded systems with no facilities for reporting errors. | 326 | option for embedded systems with no facilities for reporting errors. |
327 | Just say Y. | 327 | Just say Y. |
328 | 328 | ||
329 | config DOUBLEFAULT | ||
330 | depends X86 | ||
331 | default y if X86 | ||
332 | bool "Enable doublefault exception handler" if EMBEDDED | ||
333 | help | ||
334 | This option allows trapping of rare doublefault exceptions that | ||
335 | would otherwise cause a system to silently reboot. Disabling this | ||
336 | option saves about 4k. | ||
337 | |||
338 | config ELF_CORE | 329 | config ELF_CORE |
339 | default y | 330 | default y |
340 | bool "Enable ELF core dumps" if EMBEDDED | 331 | bool "Enable ELF core dumps" if EMBEDDED |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index a8aa6152eea6..4e776f9c80e7 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * This file is released under the GPL. | 11 | * This file is released under the GPL. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | ||
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
16 | #include <linux/file.h> | 17 | #include <linux/file.h> |
@@ -15,6 +15,7 @@ | |||
15 | * (c) 1999 Manfred Spraul <manfreds@colorfullife.com> | 15 | * (c) 1999 Manfred Spraul <manfreds@colorfullife.com> |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/capability.h> | ||
18 | #include <linux/config.h> | 19 | #include <linux/config.h> |
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/msg.h> | 21 | #include <linux/msg.h> |
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/security.h> | 73 | #include <linux/security.h> |
74 | #include <linux/syscalls.h> | 74 | #include <linux/syscalls.h> |
75 | #include <linux/audit.h> | 75 | #include <linux/audit.h> |
76 | #include <linux/capability.h> | ||
76 | #include <linux/seq_file.h> | 77 | #include <linux/seq_file.h> |
77 | #include <asm/uaccess.h> | 78 | #include <asm/uaccess.h> |
78 | #include "util.h" | 79 | #include "util.h" |
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/security.h> | 27 | #include <linux/security.h> |
28 | #include <linux/syscalls.h> | 28 | #include <linux/syscalls.h> |
29 | #include <linux/audit.h> | 29 | #include <linux/audit.h> |
30 | #include <linux/capability.h> | ||
30 | #include <linux/ptrace.h> | 31 | #include <linux/ptrace.h> |
31 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
32 | 33 | ||
diff --git a/ipc/util.c b/ipc/util.c index 23f1cec150c1..38b9a0af3bd8 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/capability.h> | ||
23 | #include <linux/highuid.h> | 24 | #include <linux/highuid.h> |
24 | #include <linux/security.h> | 25 | #include <linux/security.h> |
25 | #include <linux/rcupdate.h> | 26 | #include <linux/rcupdate.h> |
diff --git a/kernel/acct.c b/kernel/acct.c index 38d57fa6b78f..065d8b4e51ef 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/mm.h> | 47 | #include <linux/mm.h> |
48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
49 | #include <linux/acct.h> | 49 | #include <linux/acct.h> |
50 | #include <linux/capability.h> | ||
50 | #include <linux/file.h> | 51 | #include <linux/file.h> |
51 | #include <linux/tty.h> | 52 | #include <linux/tty.h> |
52 | #include <linux/security.h> | 53 | #include <linux/security.h> |
diff --git a/kernel/capability.c b/kernel/capability.c index 8986a37a67ea..bfa3c92e16f2 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net> | 7 | * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/capability.h> | ||
10 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
12 | #include <linux/security.h> | 13 | #include <linux/security.h> |
diff --git a/kernel/exit.c b/kernel/exit.c index 802722814925..f8e609ff1893 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/smp_lock.h> | 11 | #include <linux/smp_lock.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/capability.h> | ||
13 | #include <linux/completion.h> | 14 | #include <linux/completion.h> |
14 | #include <linux/personality.h> | 15 | #include <linux/personality.h> |
15 | #include <linux/tty.h> | 16 | #include <linux/tty.h> |
diff --git a/kernel/fork.c b/kernel/fork.c index 3bdcab49998d..4ae8cfc1c89c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/binfmts.h> | 28 | #include <linux/binfmts.h> |
29 | #include <linux/mman.h> | 29 | #include <linux/mman.h> |
30 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
31 | #include <linux/capability.h> | ||
31 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
32 | #include <linux/cpuset.h> | 33 | #include <linux/cpuset.h> |
33 | #include <linux/security.h> | 34 | #include <linux/security.h> |
@@ -1297,6 +1298,10 @@ long do_fork(unsigned long clone_flags, | |||
1297 | return pid; | 1298 | return pid; |
1298 | } | 1299 | } |
1299 | 1300 | ||
1301 | #ifndef ARCH_MIN_MMSTRUCT_ALIGN | ||
1302 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 | ||
1303 | #endif | ||
1304 | |||
1300 | void __init proc_caches_init(void) | 1305 | void __init proc_caches_init(void) |
1301 | { | 1306 | { |
1302 | sighand_cachep = kmem_cache_create("sighand_cache", | 1307 | sighand_cachep = kmem_cache_create("sighand_cache", |
@@ -1315,6 +1320,6 @@ void __init proc_caches_init(void) | |||
1315 | sizeof(struct vm_area_struct), 0, | 1320 | sizeof(struct vm_area_struct), 0, |
1316 | SLAB_PANIC, NULL, NULL); | 1321 | SLAB_PANIC, NULL, NULL); |
1317 | mm_cachep = kmem_cache_create("mm_struct", | 1322 | mm_cachep = kmem_cache_create("mm_struct", |
1318 | sizeof(struct mm_struct), 0, | 1323 | sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, |
1319 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | 1324 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); |
1320 | } | 1325 | } |
diff --git a/kernel/kexec.c b/kernel/kexec.c index de1441656efd..bf39d28e4c0e 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * Version 2. See the file COPYING for more details. | 6 | * Version 2. See the file COPYING for more details. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/capability.h> | ||
9 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
10 | #include <linux/file.h> | 11 | #include <linux/file.h> |
11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 34a885bb82e0..3ea6325228da 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -449,19 +449,32 @@ static int __kprobes in_kprobes_functions(unsigned long addr) | |||
449 | return 0; | 449 | return 0; |
450 | } | 450 | } |
451 | 451 | ||
452 | int __kprobes register_kprobe(struct kprobe *p) | 452 | static int __kprobes __register_kprobe(struct kprobe *p, |
453 | unsigned long called_from) | ||
453 | { | 454 | { |
454 | int ret = 0; | 455 | int ret = 0; |
455 | struct kprobe *old_p; | 456 | struct kprobe *old_p; |
456 | struct module *mod; | 457 | struct module *probed_mod; |
457 | 458 | ||
458 | if ((!kernel_text_address((unsigned long) p->addr)) || | 459 | if ((!kernel_text_address((unsigned long) p->addr)) || |
459 | in_kprobes_functions((unsigned long) p->addr)) | 460 | in_kprobes_functions((unsigned long) p->addr)) |
460 | return -EINVAL; | 461 | return -EINVAL; |
461 | 462 | ||
462 | if ((mod = module_text_address((unsigned long) p->addr)) && | 463 | p->mod_refcounted = 0; |
463 | (unlikely(!try_module_get(mod)))) | 464 | /* Check are we probing a module */ |
464 | return -EINVAL; | 465 | if ((probed_mod = module_text_address((unsigned long) p->addr))) { |
466 | struct module *calling_mod = module_text_address(called_from); | ||
467 | /* We must allow modules to probe themself and | ||
468 | * in this case avoid incrementing the module refcount, | ||
469 | * so as to allow unloading of self probing modules. | ||
470 | */ | ||
471 | if (calling_mod && (calling_mod != probed_mod)) { | ||
472 | if (unlikely(!try_module_get(probed_mod))) | ||
473 | return -EINVAL; | ||
474 | p->mod_refcounted = 1; | ||
475 | } else | ||
476 | probed_mod = NULL; | ||
477 | } | ||
465 | 478 | ||
466 | p->nmissed = 0; | 479 | p->nmissed = 0; |
467 | down(&kprobe_mutex); | 480 | down(&kprobe_mutex); |
@@ -483,11 +496,17 @@ int __kprobes register_kprobe(struct kprobe *p) | |||
483 | out: | 496 | out: |
484 | up(&kprobe_mutex); | 497 | up(&kprobe_mutex); |
485 | 498 | ||
486 | if (ret && mod) | 499 | if (ret && probed_mod) |
487 | module_put(mod); | 500 | module_put(probed_mod); |
488 | return ret; | 501 | return ret; |
489 | } | 502 | } |
490 | 503 | ||
504 | int __kprobes register_kprobe(struct kprobe *p) | ||
505 | { | ||
506 | return __register_kprobe(p, | ||
507 | (unsigned long)__builtin_return_address(0)); | ||
508 | } | ||
509 | |||
491 | void __kprobes unregister_kprobe(struct kprobe *p) | 510 | void __kprobes unregister_kprobe(struct kprobe *p) |
492 | { | 511 | { |
493 | struct module *mod; | 512 | struct module *mod; |
@@ -524,7 +543,8 @@ valid_p: | |||
524 | up(&kprobe_mutex); | 543 | up(&kprobe_mutex); |
525 | 544 | ||
526 | synchronize_sched(); | 545 | synchronize_sched(); |
527 | if ((mod = module_text_address((unsigned long)p->addr))) | 546 | if (p->mod_refcounted && |
547 | (mod = module_text_address((unsigned long)p->addr))) | ||
528 | module_put(mod); | 548 | module_put(mod); |
529 | 549 | ||
530 | if (cleanup_p) { | 550 | if (cleanup_p) { |
@@ -547,7 +567,8 @@ int __kprobes register_jprobe(struct jprobe *jp) | |||
547 | jp->kp.pre_handler = setjmp_pre_handler; | 567 | jp->kp.pre_handler = setjmp_pre_handler; |
548 | jp->kp.break_handler = longjmp_break_handler; | 568 | jp->kp.break_handler = longjmp_break_handler; |
549 | 569 | ||
550 | return register_kprobe(&jp->kp); | 570 | return __register_kprobe(&jp->kp, |
571 | (unsigned long)__builtin_return_address(0)); | ||
551 | } | 572 | } |
552 | 573 | ||
553 | void __kprobes unregister_jprobe(struct jprobe *jp) | 574 | void __kprobes unregister_jprobe(struct jprobe *jp) |
@@ -587,7 +608,8 @@ int __kprobes register_kretprobe(struct kretprobe *rp) | |||
587 | 608 | ||
588 | rp->nmissed = 0; | 609 | rp->nmissed = 0; |
589 | /* Establish function entry probe point */ | 610 | /* Establish function entry probe point */ |
590 | if ((ret = register_kprobe(&rp->kp)) != 0) | 611 | if ((ret = __register_kprobe(&rp->kp, |
612 | (unsigned long)__builtin_return_address(0))) != 0) | ||
591 | free_rp_inst(rp); | 613 | free_rp_inst(rp); |
592 | return ret; | 614 | return ret; |
593 | } | 615 | } |
diff --git a/kernel/module.c b/kernel/module.c index e4276046a1b6..618ed6e23ecc 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/syscalls.h> | 28 | #include <linux/syscalls.h> |
29 | #include <linux/fcntl.h> | 29 | #include <linux/fcntl.h> |
30 | #include <linux/rcupdate.h> | 30 | #include <linux/rcupdate.h> |
31 | #include <linux/capability.h> | ||
31 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
32 | #include <linux/moduleparam.h> | 33 | #include <linux/moduleparam.h> |
33 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index cceaf09ac413..5f33cdb6fff5 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * to continually duplicate across every architecture. | 7 | * to continually duplicate across every architecture. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/capability.h> | ||
10 | #include <linux/module.h> | 11 | #include <linux/module.h> |
11 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
diff --git a/kernel/sched.c b/kernel/sched.c index 34a945bcc022..c0c60c926d5e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/smp_lock.h> | 27 | #include <linux/smp_lock.h> |
28 | #include <asm/mmu_context.h> | 28 | #include <asm/mmu_context.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/capability.h> | ||
30 | #include <linux/completion.h> | 31 | #include <linux/completion.h> |
31 | #include <linux/kernel_stat.h> | 32 | #include <linux/kernel_stat.h> |
32 | #include <linux/security.h> | 33 | #include <linux/security.h> |
@@ -3979,12 +3980,12 @@ asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, | |||
3979 | * method, such as ACPI for e.g. | 3980 | * method, such as ACPI for e.g. |
3980 | */ | 3981 | */ |
3981 | 3982 | ||
3982 | cpumask_t cpu_present_map; | 3983 | cpumask_t cpu_present_map __read_mostly; |
3983 | EXPORT_SYMBOL(cpu_present_map); | 3984 | EXPORT_SYMBOL(cpu_present_map); |
3984 | 3985 | ||
3985 | #ifndef CONFIG_SMP | 3986 | #ifndef CONFIG_SMP |
3986 | cpumask_t cpu_online_map = CPU_MASK_ALL; | 3987 | cpumask_t cpu_online_map __read_mostly = CPU_MASK_ALL; |
3987 | cpumask_t cpu_possible_map = CPU_MASK_ALL; | 3988 | cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; |
3988 | #endif | 3989 | #endif |
3989 | 3990 | ||
3990 | long sched_getaffinity(pid_t pid, cpumask_t *mask) | 3991 | long sched_getaffinity(pid_t pid, cpumask_t *mask) |
diff --git a/kernel/signal.c b/kernel/signal.c index 08aa5b263f36..1da2e74beb97 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/posix-timers.h> | 25 | #include <linux/posix-timers.h> |
26 | #include <linux/signal.h> | 26 | #include <linux/signal.h> |
27 | #include <linux/audit.h> | 27 | #include <linux/audit.h> |
28 | #include <linux/capability.h> | ||
28 | #include <asm/param.h> | 29 | #include <asm/param.h> |
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
30 | #include <asm/unistd.h> | 31 | #include <asm/unistd.h> |
diff --git a/kernel/sys.c b/kernel/sys.c index b6941e06d5d5..d09cac23fdfd 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/kexec.h> | 20 | #include <linux/kexec.h> |
21 | #include <linux/workqueue.h> | 21 | #include <linux/workqueue.h> |
22 | #include <linux/capability.h> | ||
22 | #include <linux/device.h> | 23 | #include <linux/device.h> |
23 | #include <linux/key.h> | 24 | #include <linux/key.h> |
24 | #include <linux/times.h> | 25 | #include <linux/times.h> |
@@ -223,6 +224,18 @@ int unregister_reboot_notifier(struct notifier_block * nb) | |||
223 | 224 | ||
224 | EXPORT_SYMBOL(unregister_reboot_notifier); | 225 | EXPORT_SYMBOL(unregister_reboot_notifier); |
225 | 226 | ||
227 | #ifndef CONFIG_SECURITY | ||
228 | int capable(int cap) | ||
229 | { | ||
230 | if (cap_raised(current->cap_effective, cap)) { | ||
231 | current->flags |= PF_SUPERPRIV; | ||
232 | return 1; | ||
233 | } | ||
234 | return 0; | ||
235 | } | ||
236 | EXPORT_SYMBOL(capable); | ||
237 | #endif | ||
238 | |||
226 | static int set_one_prio(struct task_struct *p, int niceval, int error) | 239 | static int set_one_prio(struct task_struct *p, int niceval, int error) |
227 | { | 240 | { |
228 | int no_nice; | 241 | int no_nice; |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 03b0598f2369..62d4d9566876 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
28 | #include <linux/capability.h> | ||
28 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
29 | #include <linux/utsname.h> | 30 | #include <linux/utsname.h> |
30 | #include <linux/capability.h> | 31 | #include <linux/capability.h> |
diff --git a/kernel/time.c b/kernel/time.c index 169e8329e0b6..7477b1d2079e 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/timex.h> | 31 | #include <linux/timex.h> |
32 | #include <linux/capability.h> | ||
32 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
33 | #include <linux/smp_lock.h> | 34 | #include <linux/smp_lock.h> |
34 | #include <linux/syscalls.h> | 35 | #include <linux/syscalls.h> |
diff --git a/kernel/uid16.c b/kernel/uid16.c index f669941e8b26..aa25605027c8 100644 --- a/kernel/uid16.c +++ b/kernel/uid16.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/notifier.h> | 10 | #include <linux/notifier.h> |
11 | #include <linux/reboot.h> | 11 | #include <linux/reboot.h> |
12 | #include <linux/prctl.h> | 12 | #include <linux/prctl.h> |
13 | #include <linux/capability.h> | ||
13 | #include <linux/init.h> | 14 | #include <linux/init.h> |
14 | #include <linux/highuid.h> | 15 | #include <linux/highuid.h> |
15 | #include <linux/security.h> | 16 | #include <linux/security.h> |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 3b482052f403..0af497b6b9a8 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -463,7 +463,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |||
463 | */ | 463 | */ |
464 | dma_addr_t handle; | 464 | dma_addr_t handle; |
465 | handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE); | 465 | handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE); |
466 | if (dma_mapping_error(handle)) | 466 | if (swiotlb_dma_mapping_error(handle)) |
467 | return NULL; | 467 | return NULL; |
468 | 468 | ||
469 | ret = phys_to_virt(handle); | 469 | ret = phys_to_virt(handle); |
diff --git a/mm/filemap.c b/mm/filemap.c index 96de772be487..a965b6b35f26 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/aio.h> | 17 | #include <linux/aio.h> |
18 | #include <linux/capability.h> | ||
18 | #include <linux/kernel_stat.h> | 19 | #include <linux/kernel_stat.h> |
19 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
20 | #include <linux/swap.h> | 21 | #include <linux/swap.h> |
diff --git a/mm/mlock.c b/mm/mlock.c index 4ae3a46ff768..b90c59573abf 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * (C) Copyright 2002 Christoph Hellwig | 5 | * (C) Copyright 2002 Christoph Hellwig |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/capability.h> | ||
8 | #include <linux/mman.h> | 9 | #include <linux/mman.h> |
9 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
10 | #include <linux/mempolicy.h> | 11 | #include <linux/mempolicy.h> |
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
14 | #include <linux/swap.h> | 14 | #include <linux/swap.h> |
15 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
16 | #include <linux/capability.h> | ||
16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
17 | #include <linux/file.h> | 18 | #include <linux/file.h> |
18 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
diff --git a/mm/mremap.c b/mm/mremap.c index ddaeee9a0b69..1903bdf65e42 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/shm.h> | 13 | #include <linux/shm.h> |
14 | #include <linux/mman.h> | 14 | #include <linux/mman.h> |
15 | #include <linux/swap.h> | 15 | #include <linux/swap.h> |
16 | #include <linux/capability.h> | ||
16 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
17 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
18 | #include <linux/security.h> | 19 | #include <linux/security.h> |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8e363536e2da..d41a0662d4da 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -137,9 +137,9 @@ static inline int bad_range(struct zone *zone, struct page *page) | |||
137 | static void bad_page(struct page *page) | 137 | static void bad_page(struct page *page) |
138 | { | 138 | { |
139 | printk(KERN_EMERG "Bad page state in process '%s'\n" | 139 | printk(KERN_EMERG "Bad page state in process '%s'\n" |
140 | "page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d\n" | 140 | KERN_EMERG "page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d\n" |
141 | "Trying to fix it up, but a reboot is needed\n" | 141 | KERN_EMERG "Trying to fix it up, but a reboot is needed\n" |
142 | "Backtrace:\n", | 142 | KERN_EMERG "Backtrace:\n", |
143 | current->comm, page, (int)(2*sizeof(unsigned long)), | 143 | current->comm, page, (int)(2*sizeof(unsigned long)), |
144 | (unsigned long)page->flags, page->mapping, | 144 | (unsigned long)page->flags, page->mapping, |
145 | page_mapcount(page), page_count(page)); | 145 | page_mapcount(page), page_count(page)); |
@@ -931,7 +931,8 @@ restart: | |||
931 | * | 931 | * |
932 | * The caller may dip into page reserves a bit more if the caller | 932 | * The caller may dip into page reserves a bit more if the caller |
933 | * cannot run direct reclaim, or if the caller has realtime scheduling | 933 | * cannot run direct reclaim, or if the caller has realtime scheduling |
934 | * policy. | 934 | * policy or is asking for __GFP_HIGH memory. GFP_ATOMIC requests will |
935 | * set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH). | ||
935 | */ | 936 | */ |
936 | alloc_flags = ALLOC_WMARK_MIN; | 937 | alloc_flags = ALLOC_WMARK_MIN; |
937 | if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait) | 938 | if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait) |
diff --git a/mm/swapfile.c b/mm/swapfile.c index d8a5afc8b2a3..957fef43fa60 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/rmap.h> | 25 | #include <linux/rmap.h> |
26 | #include <linux/security.h> | 26 | #include <linux/security.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/capability.h> | ||
28 | #include <linux/syscalls.h> | 29 | #include <linux/syscalls.h> |
29 | 30 | ||
30 | #include <asm/pgtable.h> | 31 | #include <asm/pgtable.h> |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 67465b65abe4..fa76220708ce 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <asm/uaccess.h> /* for copy_from_user */ | 21 | #include <asm/uaccess.h> /* for copy_from_user */ |
22 | #include <linux/capability.h> | ||
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
23 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
24 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index a5144e43aae1..697ac55e29dc 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -52,6 +52,7 @@ | |||
52 | */ | 52 | */ |
53 | 53 | ||
54 | #include <linux/config.h> | 54 | #include <linux/config.h> |
55 | #include <linux/capability.h> | ||
55 | #include <linux/module.h> | 56 | #include <linux/module.h> |
56 | #include <linux/if_arp.h> | 57 | #include <linux/if_arp.h> |
57 | #include <linux/termios.h> /* For TIOCOUTQ/INQ */ | 58 | #include <linux/termios.h> /* For TIOCOUTQ/INQ */ |
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 1dafa9c108a7..680ccb12aae8 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary | |||
18 | #include <net/arp.h> | 18 | #include <net/arp.h> |
19 | #include <linux/atm.h> | 19 | #include <linux/atm.h> |
20 | #include <linux/atmdev.h> | 20 | #include <linux/atmdev.h> |
21 | #include <linux/capability.h> | ||
21 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
22 | 23 | ||
23 | #include <linux/atmbr2684.h> | 24 | #include <linux/atmbr2684.h> |
diff --git a/net/atm/clip.c b/net/atm/clip.c index 4f54c9a5e84a..73370de97539 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/atmdev.h> | 19 | #include <linux/atmdev.h> |
20 | #include <linux/atmclip.h> | 20 | #include <linux/atmclip.h> |
21 | #include <linux/atmarp.h> | 21 | #include <linux/atmarp.h> |
22 | #include <linux/capability.h> | ||
22 | #include <linux/ip.h> /* for net/route.h */ | 23 | #include <linux/ip.h> /* for net/route.h */ |
23 | #include <linux/in.h> /* for struct sockaddr_in */ | 24 | #include <linux/in.h> /* for struct sockaddr_in */ |
24 | #include <linux/if.h> /* for IFF_UP */ | 25 | #include <linux/if.h> /* for IFF_UP */ |
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c index a150198b05a3..eb109af7eb4a 100644 --- a/net/atm/ioctl.c +++ b/net/atm/ioctl.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/atmdev.h> | 12 | #include <linux/atmdev.h> |
13 | #include <linux/atmclip.h> /* CLIP_*ENCAP */ | 13 | #include <linux/atmclip.h> /* CLIP_*ENCAP */ |
14 | #include <linux/atmarp.h> /* manifest constants */ | 14 | #include <linux/atmarp.h> /* manifest constants */ |
15 | #include <linux/capability.h> | ||
15 | #include <linux/sonet.h> /* for ioctls */ | 16 | #include <linux/sonet.h> /* for ioctls */ |
16 | #include <linux/atmsvc.h> | 17 | #include <linux/atmsvc.h> |
17 | #include <linux/atmmpc.h> | 18 | #include <linux/atmmpc.h> |
diff --git a/net/atm/lec.c b/net/atm/lec.c index eea051338498..c4fc722fef9a 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/bitops.h> | 9 | #include <linux/bitops.h> |
10 | #include <linux/capability.h> | ||
10 | 11 | ||
11 | /* We are ethernet device */ | 12 | /* We are ethernet device */ |
12 | #include <linux/if_ether.h> | 13 | #include <linux/if_ether.h> |
@@ -1811,8 +1812,7 @@ make_entry(struct lec_priv *priv, unsigned char *mac_addr) | |||
1811 | { | 1812 | { |
1812 | struct lec_arp_table *to_return; | 1813 | struct lec_arp_table *to_return; |
1813 | 1814 | ||
1814 | to_return = (struct lec_arp_table *) kmalloc(sizeof(struct lec_arp_table), | 1815 | to_return = kmalloc(sizeof(struct lec_arp_table), GFP_ATOMIC); |
1815 | GFP_ATOMIC); | ||
1816 | if (!to_return) { | 1816 | if (!to_return) { |
1817 | printk("LEC: Arp entry kmalloc failed\n"); | 1817 | printk("LEC: Arp entry kmalloc failed\n"); |
1818 | return NULL; | 1818 | return NULL; |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 36b7ae360232..c304ef1513b9 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/timer.h> | 3 | #include <linux/timer.h> |
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/bitops.h> | 5 | #include <linux/bitops.h> |
6 | #include <linux/capability.h> | ||
6 | #include <linux/seq_file.h> | 7 | #include <linux/seq_file.h> |
7 | 8 | ||
8 | /* We are an ethernet device */ | 9 | /* We are an ethernet device */ |
diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c index 58f4a2b5aebe..1489067c1e84 100644 --- a/net/atm/pppoatm.c +++ b/net/atm/pppoatm.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
40 | #include <linux/atm.h> | 40 | #include <linux/atm.h> |
41 | #include <linux/atmdev.h> | 41 | #include <linux/atmdev.h> |
42 | #include <linux/capability.h> | ||
42 | #include <linux/ppp_defs.h> | 43 | #include <linux/ppp_defs.h> |
43 | #include <linux/if_ppp.h> | 44 | #include <linux/if_ppp.h> |
44 | #include <linux/ppp_channel.h> | 45 | #include <linux/ppp_channel.h> |
diff --git a/net/atm/raw.c b/net/atm/raw.c index 4a0466e91aa6..3e57b17ca523 100644 --- a/net/atm/raw.c +++ b/net/atm/raw.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/atmdev.h> | 8 | #include <linux/atmdev.h> |
9 | #include <linux/capability.h> | ||
9 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
10 | #include <linux/skbuff.h> | 11 | #include <linux/skbuff.h> |
11 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
diff --git a/net/atm/resources.c b/net/atm/resources.c index c8c459fcb038..224190537c90 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> /* for barrier */ | 16 | #include <linux/kernel.h> /* for barrier */ |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
20 | #include <net/sock.h> /* for struct sock */ | 21 | #include <net/sock.h> /* for struct sock */ |
21 | 22 | ||
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index e8753c7fcad1..dbf9b47681f7 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr) | 14 | * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr) |
15 | */ | 15 | */ |
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | #include <linux/capability.h> | ||
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
19 | #include <linux/types.h> | 20 | #include <linux/types.h> |
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c index b1e945bd6ed3..f04f8630fd28 100644 --- a/net/ax25/ax25_route.c +++ b/net/ax25/ax25_route.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * Copyright (C) Hans-Joachim Hetscher DD8NE (dd8ne@bnv-bamberg.de) | 11 | * Copyright (C) Hans-Joachim Hetscher DD8NE (dd8ne@bnv-bamberg.de) |
12 | * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr) | 12 | * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr) |
13 | */ | 13 | */ |
14 | |||
15 | #include <linux/capability.h> | ||
14 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
15 | #include <linux/types.h> | 17 | #include <linux/types.h> |
16 | #include <linux/socket.h> | 18 | #include <linux/socket.h> |
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c index d53cc8615865..b8b5854bce9a 100644 --- a/net/ax25/ax25_uid.c +++ b/net/ax25/ax25_uid.c | |||
@@ -6,6 +6,8 @@ | |||
6 | * | 6 | * |
7 | * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) | 7 | * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) |
8 | */ | 8 | */ |
9 | |||
10 | #include <linux/capability.h> | ||
9 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
10 | #include <linux/types.h> | 12 | #include <linux/types.h> |
11 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index ccbaf69afc5b..2bfe796cf05d 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | 33 | ||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/capability.h> | ||
35 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
36 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
37 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index 5e22343b6090..8f8fad23f78a 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | 25 | ||
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/capability.h> | ||
27 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
28 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
29 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 84e6c93a044a..bdb6458c6bd5 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | 29 | ||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/capability.h> | ||
31 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
32 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
33 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index 8f8dd931b294..b8f67761b886 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | 25 | ||
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/capability.h> | ||
27 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
28 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
29 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 7f0781e4326f..f6b4a8085357 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | 29 | ||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/capability.h> | ||
31 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
32 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
33 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index f57cde78c3de..74368f79ee5d 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/tty_driver.h> | 34 | #include <linux/tty_driver.h> |
35 | #include <linux/tty_flip.h> | 35 | #include <linux/tty_flip.h> |
36 | 36 | ||
37 | #include <linux/capability.h> | ||
37 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
38 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
39 | 40 | ||
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c index b8ce14b22181..159fb8409824 100644 --- a/net/bridge/br_ioctl.c +++ b/net/bridge/br_ioctl.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * 2 of the License, or (at your option) any later version. | 13 | * 2 of the License, or (at your option) any later version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/capability.h> | ||
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/if_bridge.h> | 18 | #include <linux/if_bridge.h> |
18 | #include <linux/netdevice.h> | 19 | #include <linux/netdevice.h> |
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index 98cf53c81fad..6f577f16c4c0 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * 2 of the License, or (at your option) any later version. | 11 | * 2 of the License, or (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
16 | #include <linux/if_bridge.h> | 17 | #include <linux/if_bridge.h> |
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c index 2ebdc23bbe26..0ac0355d16dd 100644 --- a/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * 2 of the License, or (at your option) any later version. | 11 | * 2 of the License, or (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
16 | #include <linux/if_bridge.h> | 17 | #include <linux/if_bridge.h> |
diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c index 9d2ef4ffe276..0248c67277ee 100644 --- a/net/bridge/netfilter/ebt_stp.c +++ b/net/bridge/netfilter/ebt_stp.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/netfilter_bridge/ebtables.h> | 11 | #include <linux/netfilter_bridge/ebtables.h> |
12 | #include <linux/netfilter_bridge/ebt_stp.h> | 12 | #include <linux/netfilter_bridge/ebt_stp.h> |
13 | #include <linux/etherdevice.h> | ||
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | 15 | ||
15 | #define BPDU_TYPE_CONFIG 0 | 16 | #define BPDU_TYPE_CONFIG 0 |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index f8ffbf6e2333..00729b3604f8 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -944,7 +944,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
944 | if (countersize) | 944 | if (countersize) |
945 | memset(newinfo->counters, 0, countersize); | 945 | memset(newinfo->counters, 0, countersize); |
946 | 946 | ||
947 | newinfo->entries = (char *)vmalloc(tmp.entries_size); | 947 | newinfo->entries = vmalloc(tmp.entries_size); |
948 | if (!newinfo->entries) { | 948 | if (!newinfo->entries) { |
949 | ret = -ENOMEM; | 949 | ret = -ENOMEM; |
950 | goto free_newinfo; | 950 | goto free_newinfo; |
@@ -1146,7 +1146,7 @@ int ebt_register_table(struct ebt_table *table) | |||
1146 | if (!newinfo) | 1146 | if (!newinfo) |
1147 | return -ENOMEM; | 1147 | return -ENOMEM; |
1148 | 1148 | ||
1149 | newinfo->entries = (char *)vmalloc(table->table->entries_size); | 1149 | newinfo->entries = vmalloc(table->table->entries_size); |
1150 | if (!(newinfo->entries)) | 1150 | if (!(newinfo->entries)) |
1151 | goto free_newinfo; | 1151 | goto free_newinfo; |
1152 | 1152 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index bf66b114d3c2..fd070a098f20 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -75,6 +75,7 @@ | |||
75 | #include <asm/uaccess.h> | 75 | #include <asm/uaccess.h> |
76 | #include <asm/system.h> | 76 | #include <asm/system.h> |
77 | #include <linux/bitops.h> | 77 | #include <linux/bitops.h> |
78 | #include <linux/capability.h> | ||
78 | #include <linux/config.h> | 79 | #include <linux/config.h> |
79 | #include <linux/cpu.h> | 80 | #include <linux/cpu.h> |
80 | #include <linux/types.h> | 81 | #include <linux/types.h> |
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index cb530eef0e39..05d60850840e 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c | |||
@@ -158,7 +158,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) | |||
158 | int err = 0; | 158 | int err = 0; |
159 | struct dev_mc_list *dmi, *dmi1; | 159 | struct dev_mc_list *dmi, *dmi1; |
160 | 160 | ||
161 | dmi1 = (struct dev_mc_list *)kmalloc(sizeof(*dmi), GFP_ATOMIC); | 161 | dmi1 = kmalloc(sizeof(*dmi), GFP_ATOMIC); |
162 | 162 | ||
163 | spin_lock_bh(&dev->xmit_lock); | 163 | spin_lock_bh(&dev->xmit_lock); |
164 | for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) { | 164 | for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) { |
diff --git a/net/core/dv.c b/net/core/dv.c index c5deb3655257..cf581407538c 100644 --- a/net/core/dv.c +++ b/net/core/dv.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
25 | #include <linux/etherdevice.h> | 25 | #include <linux/etherdevice.h> |
26 | #include <linux/skbuff.h> | 26 | #include <linux/skbuff.h> |
27 | #include <linux/capability.h> | ||
27 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
28 | #include <linux/init.h> | 29 | #include <linux/init.h> |
29 | #include <net/dst.h> | 30 | #include <net/dst.h> |
@@ -457,7 +458,7 @@ void divert_frame(struct sk_buff *skb) | |||
457 | unsigned char *skb_data_end = skb->data + skb->len; | 458 | unsigned char *skb_data_end = skb->data + skb->len; |
458 | 459 | ||
459 | /* Packet is already aimed at us, return */ | 460 | /* Packet is already aimed at us, return */ |
460 | if (!compare_ether_addr(eth, skb->dev->dev_addr)) | 461 | if (!compare_ether_addr(eth->h_dest, skb->dev->dev_addr)) |
461 | return; | 462 | return; |
462 | 463 | ||
463 | /* proto is not IP, do nothing */ | 464 | /* proto is not IP, do nothing */ |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 0350586e9195..e6f76106a99b 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
15 | #include <linux/ethtool.h> | 16 | #include <linux/ethtool.h> |
16 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 58adaf208dd6..e8b2acbc8ea2 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/capability.h> | ||
12 | #include <linux/config.h> | 13 | #include <linux/config.h> |
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
14 | #include <linux/netdevice.h> | 15 | #include <linux/netdevice.h> |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 631056d44b7b..39063122fbb7 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -116,13 +116,13 @@ | |||
116 | #include <linux/sched.h> | 116 | #include <linux/sched.h> |
117 | #include <linux/slab.h> | 117 | #include <linux/slab.h> |
118 | #include <linux/vmalloc.h> | 118 | #include <linux/vmalloc.h> |
119 | #include <linux/sched.h> | ||
120 | #include <linux/unistd.h> | 119 | #include <linux/unistd.h> |
121 | #include <linux/string.h> | 120 | #include <linux/string.h> |
122 | #include <linux/ptrace.h> | 121 | #include <linux/ptrace.h> |
123 | #include <linux/errno.h> | 122 | #include <linux/errno.h> |
124 | #include <linux/ioport.h> | 123 | #include <linux/ioport.h> |
125 | #include <linux/interrupt.h> | 124 | #include <linux/interrupt.h> |
125 | #include <linux/capability.h> | ||
126 | #include <linux/delay.h> | 126 | #include <linux/delay.h> |
127 | #include <linux/timer.h> | 127 | #include <linux/timer.h> |
128 | #include <linux/init.h> | 128 | #include <linux/init.h> |
diff --git a/net/core/scm.c b/net/core/scm.c index e887d19be506..649d01ef35b6 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/signal.h> | 13 | #include <linux/signal.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
diff --git a/net/core/sock.c b/net/core/sock.c index 6465b0e4c8cb..6e00811d44bc 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -91,6 +91,7 @@ | |||
91 | * 2 of the License, or (at your option) any later version. | 91 | * 2 of the License, or (at your option) any later version. |
92 | */ | 92 | */ |
93 | 93 | ||
94 | #include <linux/capability.h> | ||
94 | #include <linux/config.h> | 95 | #include <linux/config.h> |
95 | #include <linux/errno.h> | 96 | #include <linux/errno.h> |
96 | #include <linux/types.h> | 97 | #include <linux/types.h> |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 78ec5344be86..ce4aaf94860d 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -122,6 +122,7 @@ Version 0.0.6 2.1.110 07-aug-98 Eduardo Marcelo Serrat | |||
122 | #include <net/flow.h> | 122 | #include <net/flow.h> |
123 | #include <asm/system.h> | 123 | #include <asm/system.h> |
124 | #include <asm/ioctls.h> | 124 | #include <asm/ioctls.h> |
125 | #include <linux/capability.h> | ||
125 | #include <linux/mm.h> | 126 | #include <linux/mm.h> |
126 | #include <linux/interrupt.h> | 127 | #include <linux/interrupt.h> |
127 | #include <linux/proc_fs.h> | 128 | #include <linux/proc_fs.h> |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 5610bb16dbf9..efbead83ba7f 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | 27 | #include <linux/config.h> |
28 | #include <linux/capability.h> | ||
28 | #include <linux/module.h> | 29 | #include <linux/module.h> |
29 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 966a071a408c..97c276f95b35 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #include <linux/string.h> | 79 | #include <linux/string.h> |
80 | #include <linux/sockios.h> | 80 | #include <linux/sockios.h> |
81 | #include <linux/net.h> | 81 | #include <linux/net.h> |
82 | #include <linux/capability.h> | ||
82 | #include <linux/fcntl.h> | 83 | #include <linux/fcntl.h> |
83 | #include <linux/mm.h> | 84 | #include <linux/mm.h> |
84 | #include <linux/interrupt.h> | 85 | #include <linux/interrupt.h> |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 37432088fe6d..accdefedfed7 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -79,6 +79,7 @@ | |||
79 | #include <linux/string.h> | 79 | #include <linux/string.h> |
80 | #include <linux/kernel.h> | 80 | #include <linux/kernel.h> |
81 | #include <linux/sched.h> | 81 | #include <linux/sched.h> |
82 | #include <linux/capability.h> | ||
82 | #include <linux/config.h> | 83 | #include <linux/config.h> |
83 | #include <linux/socket.h> | 84 | #include <linux/socket.h> |
84 | #include <linux/sockios.h> | 85 | #include <linux/sockios.h> |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 7b9bb28e2ee9..95b9d81ac488 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <asm/system.h> | 33 | #include <asm/system.h> |
34 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
35 | #include <linux/capability.h> | ||
35 | #include <linux/module.h> | 36 | #include <linux/module.h> |
36 | #include <linux/types.h> | 37 | #include <linux/types.h> |
37 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 18f5e509281a..5b25fc0d980c 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | #include <asm/system.h> | 21 | #include <asm/system.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/capability.h> | ||
23 | #include <linux/types.h> | 24 | #include <linux/types.h> |
24 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
25 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 34758118c10c..192092b89e53 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -975,7 +975,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) | |||
975 | * for deleted items allows change reports to use common code with | 975 | * for deleted items allows change reports to use common code with |
976 | * non-deleted or query-response MCA's. | 976 | * non-deleted or query-response MCA's. |
977 | */ | 977 | */ |
978 | pmc = (struct ip_mc_list *)kmalloc(sizeof(*pmc), GFP_KERNEL); | 978 | pmc = kmalloc(sizeof(*pmc), GFP_KERNEL); |
979 | if (!pmc) | 979 | if (!pmc) |
980 | return; | 980 | return; |
981 | memset(pmc, 0, sizeof(*pmc)); | 981 | memset(pmc, 0, sizeof(*pmc)); |
@@ -1155,7 +1155,7 @@ void ip_mc_inc_group(struct in_device *in_dev, u32 addr) | |||
1155 | } | 1155 | } |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | im = (struct ip_mc_list *)kmalloc(sizeof(*im), GFP_KERNEL); | 1158 | im = kmalloc(sizeof(*im), GFP_KERNEL); |
1159 | if (!im) | 1159 | if (!im) |
1160 | goto out; | 1160 | goto out; |
1161 | 1161 | ||
@@ -1476,7 +1476,7 @@ static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, | |||
1476 | psf_prev = psf; | 1476 | psf_prev = psf; |
1477 | } | 1477 | } |
1478 | if (!psf) { | 1478 | if (!psf) { |
1479 | psf = (struct ip_sf_list *)kmalloc(sizeof(*psf), GFP_ATOMIC); | 1479 | psf = kmalloc(sizeof(*psf), GFP_ATOMIC); |
1480 | if (!psf) | 1480 | if (!psf) |
1481 | return -ENOBUFS; | 1481 | return -ENOBUFS; |
1482 | memset(psf, 0, sizeof(*psf)); | 1482 | memset(psf, 0, sizeof(*psf)); |
@@ -1659,7 +1659,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) | |||
1659 | err = -ENOBUFS; | 1659 | err = -ENOBUFS; |
1660 | if (count >= sysctl_igmp_max_memberships) | 1660 | if (count >= sysctl_igmp_max_memberships) |
1661 | goto done; | 1661 | goto done; |
1662 | iml = (struct ip_mc_socklist *)sock_kmalloc(sk,sizeof(*iml),GFP_KERNEL); | 1662 | iml = sock_kmalloc(sk,sizeof(*iml),GFP_KERNEL); |
1663 | if (iml == NULL) | 1663 | if (iml == NULL) |
1664 | goto done; | 1664 | goto done; |
1665 | 1665 | ||
@@ -1823,8 +1823,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1823 | 1823 | ||
1824 | if (psl) | 1824 | if (psl) |
1825 | count += psl->sl_max; | 1825 | count += psl->sl_max; |
1826 | newpsl = (struct ip_sf_socklist *)sock_kmalloc(sk, | 1826 | newpsl = sock_kmalloc(sk, IP_SFLSIZE(count), GFP_KERNEL); |
1827 | IP_SFLSIZE(count), GFP_KERNEL); | ||
1828 | if (!newpsl) { | 1827 | if (!newpsl) { |
1829 | err = -ENOBUFS; | 1828 | err = -ENOBUFS; |
1830 | goto done; | 1829 | goto done; |
@@ -1907,8 +1906,8 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex) | |||
1907 | goto done; | 1906 | goto done; |
1908 | } | 1907 | } |
1909 | if (msf->imsf_numsrc) { | 1908 | if (msf->imsf_numsrc) { |
1910 | newpsl = (struct ip_sf_socklist *)sock_kmalloc(sk, | 1909 | newpsl = sock_kmalloc(sk, IP_SFLSIZE(msf->imsf_numsrc), |
1911 | IP_SFLSIZE(msf->imsf_numsrc), GFP_KERNEL); | 1910 | GFP_KERNEL); |
1912 | if (!newpsl) { | 1911 | if (!newpsl) { |
1913 | err = -ENOBUFS; | 1912 | err = -ENOBUFS; |
1914 | goto done; | 1913 | goto done; |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 1e93eafa7af1..abe23923e4e7 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/capability.h> | ||
13 | #include <linux/config.h> | 14 | #include <linux/config.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index d3f6c468faf4..9bebad07bf2e 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 6986e11d65cc..2bf8d782f678 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -621,7 +621,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
621 | err = -ENOBUFS; | 621 | err = -ENOBUFS; |
622 | break; | 622 | break; |
623 | } | 623 | } |
624 | msf = (struct ip_msfilter *)kmalloc(optlen, GFP_KERNEL); | 624 | msf = kmalloc(optlen, GFP_KERNEL); |
625 | if (msf == 0) { | 625 | if (msf == 0) { |
626 | err = -ENOBUFS; | 626 | err = -ENOBUFS; |
627 | break; | 627 | break; |
@@ -778,7 +778,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
778 | err = -ENOBUFS; | 778 | err = -ENOBUFS; |
779 | break; | 779 | break; |
780 | } | 780 | } |
781 | gsf = (struct group_filter *)kmalloc(optlen,GFP_KERNEL); | 781 | gsf = kmalloc(optlen,GFP_KERNEL); |
782 | if (gsf == 0) { | 782 | if (gsf == 0) { |
783 | err = -ENOBUFS; | 783 | err = -ENOBUFS; |
784 | break; | 784 | break; |
@@ -798,7 +798,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
798 | goto mc_msf_out; | 798 | goto mc_msf_out; |
799 | } | 799 | } |
800 | msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); | 800 | msize = IP_MSFILTER_SIZE(gsf->gf_numsrc); |
801 | msf = (struct ip_msfilter *)kmalloc(msize,GFP_KERNEL); | 801 | msf = kmalloc(msize,GFP_KERNEL); |
802 | if (msf == 0) { | 802 | if (msf == 0) { |
803 | err = -ENOBUFS; | 803 | err = -ENOBUFS; |
804 | goto mc_msf_out; | 804 | goto mc_msf_out; |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index bc5ca23b2646..e5cbe72c6b80 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -93,6 +93,7 @@ | |||
93 | */ | 93 | */ |
94 | 94 | ||
95 | 95 | ||
96 | #include <linux/capability.h> | ||
96 | #include <linux/config.h> | 97 | #include <linux/config.h> |
97 | #include <linux/module.h> | 98 | #include <linux/module.h> |
98 | #include <linux/types.h> | 99 | #include <linux/types.h> |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index f58ac9854c3f..5c94c222e3f3 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/capability.h> | ||
36 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
37 | #include <linux/timer.h> | 38 | #include <linux/timer.h> |
38 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index c935c5086d33..7f0288b25fa1 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/capability.h> | ||
26 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
27 | #include <linux/sysctl.h> | 28 | #include <linux/sysctl.h> |
28 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index bba156304695..b6d5284c8020 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/skbuff.h> | 14 | #include <linux/skbuff.h> |
15 | #include <linux/netdevice.h> | 15 | #include <linux/netdevice.h> |
16 | #include <linux/capability.h> | ||
16 | #include <linux/if_arp.h> | 17 | #include <linux/if_arp.h> |
17 | #include <linux/kmod.h> | 18 | #include <linux/kmod.h> |
18 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index 4108a5e12b3c..d716bba798f2 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c | |||
@@ -762,7 +762,7 @@ static struct ip_conntrack_helper pptp = { | |||
762 | .help = conntrack_pptp_help | 762 | .help = conntrack_pptp_help |
763 | }; | 763 | }; |
764 | 764 | ||
765 | extern void __exit ip_ct_proto_gre_fini(void); | 765 | extern void ip_ct_proto_gre_fini(void); |
766 | extern int __init ip_ct_proto_gre_init(void); | 766 | extern int __init ip_ct_proto_gre_init(void); |
767 | 767 | ||
768 | /* ip_conntrack_pptp initialization */ | 768 | /* ip_conntrack_pptp initialization */ |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_gre.c b/net/ipv4/netfilter/ip_conntrack_proto_gre.c index 57956dee60c8..c777abf16cb7 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_gre.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_gre.c | |||
@@ -309,7 +309,10 @@ int __init ip_ct_proto_gre_init(void) | |||
309 | return ip_conntrack_protocol_register(&gre); | 309 | return ip_conntrack_protocol_register(&gre); |
310 | } | 310 | } |
311 | 311 | ||
312 | void __exit ip_ct_proto_gre_fini(void) | 312 | /* This cannot be __exit, as it is invoked from ip_conntrack_helper_pptp.c's |
313 | * init() code on errors. | ||
314 | */ | ||
315 | void ip_ct_proto_gre_fini(void) | ||
313 | { | 316 | { |
314 | struct list_head *pos, *n; | 317 | struct list_head *pos, *n; |
315 | 318 | ||
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 2a26d167e149..877bc96d3336 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | #include <linux/config.h> | 15 | #include <linux/config.h> |
16 | #include <linux/cache.h> | 16 | #include <linux/cache.h> |
17 | #include <linux/capability.h> | ||
17 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
18 | #include <linux/kmod.h> | 19 | #include <linux/kmod.h> |
19 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e53e421eeee9..7129d4239755 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #ifdef CONFIG_SYSCTL | 58 | #ifdef CONFIG_SYSCTL |
59 | #include <linux/sysctl.h> | 59 | #include <linux/sysctl.h> |
60 | #endif | 60 | #endif |
61 | #include <linux/capability.h> | ||
61 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
62 | #include <linux/notifier.h> | 63 | #include <linux/notifier.h> |
63 | #include <linux/string.h> | 64 | #include <linux/string.h> |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 25c3fe5005d9..064ffab82a9f 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/capability.h> | ||
25 | #include <linux/config.h> | 26 | #include <linux/config.h> |
26 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
27 | #include <linux/types.h> | 28 | #include <linux/types.h> |
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 6b7294047238..65e73ac0d6d0 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * 2 of the License, or (at your option) any later version. | 13 | * 2 of the License, or (at your option) any later version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/capability.h> | ||
16 | #include <linux/config.h> | 17 | #include <linux/config.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index c4a3a993acb7..99a6eb23378b 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * 2 of the License, or (at your option) any later version. | 13 | * 2 of the License, or (at your option) any later version. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/capability.h> | ||
16 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
17 | #include <linux/types.h> | 18 | #include <linux/types.h> |
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 89d12b4817a9..964ad9d1276d 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> | 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/capability.h> | ||
12 | #include <linux/config.h> | 13 | #include <linux/config.h> |
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
14 | #include <linux/types.h> | 15 | #include <linux/types.h> |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index c3c2bf699a67..92ead3cf956b 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/config.h> | 22 | #include <linux/config.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/capability.h> | ||
24 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
26 | #include <linux/sockios.h> | 27 | #include <linux/sockios.h> |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index c63868dd2ca2..f7142ba519ab 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/capability.h> | ||
29 | #include <linux/config.h> | 30 | #include <linux/config.h> |
30 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
@@ -549,7 +550,7 @@ done: | |||
549 | retv = -ENOBUFS; | 550 | retv = -ENOBUFS; |
550 | break; | 551 | break; |
551 | } | 552 | } |
552 | gsf = (struct group_filter *)kmalloc(optlen,GFP_KERNEL); | 553 | gsf = kmalloc(optlen,GFP_KERNEL); |
553 | if (gsf == 0) { | 554 | if (gsf == 0) { |
554 | retv = -ENOBUFS; | 555 | retv = -ENOBUFS; |
555 | break; | 556 | break; |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 1cf305a9f8dd..cc3e9f560867 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -449,8 +449,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, | |||
449 | 449 | ||
450 | if (psl) | 450 | if (psl) |
451 | count += psl->sl_max; | 451 | count += psl->sl_max; |
452 | newpsl = (struct ip6_sf_socklist *)sock_kmalloc(sk, | 452 | newpsl = sock_kmalloc(sk, IP6_SFLSIZE(count), GFP_ATOMIC); |
453 | IP6_SFLSIZE(count), GFP_ATOMIC); | ||
454 | if (!newpsl) { | 453 | if (!newpsl) { |
455 | err = -ENOBUFS; | 454 | err = -ENOBUFS; |
456 | goto done; | 455 | goto done; |
@@ -535,8 +534,8 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) | |||
535 | goto done; | 534 | goto done; |
536 | } | 535 | } |
537 | if (gsf->gf_numsrc) { | 536 | if (gsf->gf_numsrc) { |
538 | newpsl = (struct ip6_sf_socklist *)sock_kmalloc(sk, | 537 | newpsl = sock_kmalloc(sk, IP6_SFLSIZE(gsf->gf_numsrc), |
539 | IP6_SFLSIZE(gsf->gf_numsrc), GFP_ATOMIC); | 538 | GFP_ATOMIC); |
540 | if (!newpsl) { | 539 | if (!newpsl) { |
541 | err = -ENOBUFS; | 540 | err = -ENOBUFS; |
542 | goto done; | 541 | goto done; |
@@ -768,7 +767,7 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im) | |||
768 | * for deleted items allows change reports to use common code with | 767 | * for deleted items allows change reports to use common code with |
769 | * non-deleted or query-response MCA's. | 768 | * non-deleted or query-response MCA's. |
770 | */ | 769 | */ |
771 | pmc = (struct ifmcaddr6 *)kmalloc(sizeof(*pmc), GFP_ATOMIC); | 770 | pmc = kmalloc(sizeof(*pmc), GFP_ATOMIC); |
772 | if (!pmc) | 771 | if (!pmc) |
773 | return; | 772 | return; |
774 | memset(pmc, 0, sizeof(*pmc)); | 773 | memset(pmc, 0, sizeof(*pmc)); |
@@ -1937,7 +1936,7 @@ static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode, | |||
1937 | psf_prev = psf; | 1936 | psf_prev = psf; |
1938 | } | 1937 | } |
1939 | if (!psf) { | 1938 | if (!psf) { |
1940 | psf = (struct ip6_sf_list *)kmalloc(sizeof(*psf), GFP_ATOMIC); | 1939 | psf = kmalloc(sizeof(*psf), GFP_ATOMIC); |
1941 | if (!psf) | 1940 | if (!psf) |
1942 | return -ENOBUFS; | 1941 | return -ENOBUFS; |
1943 | memset(psf, 0, sizeof(*psf)); | 1942 | memset(psf, 0, sizeof(*psf)); |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 925b42d48347..1390370186d9 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * 06 Jun 2002 Andras Kis-Szabo <kisza@sch.bme.hu> | 14 | * 06 Jun 2002 Andras Kis-Szabo <kisza@sch.bme.hu> |
15 | * - new extension header parser code | 15 | * - new extension header parser code |
16 | */ | 16 | */ |
17 | |||
18 | #include <linux/capability.h> | ||
17 | #include <linux/config.h> | 19 | #include <linux/config.h> |
18 | #include <linux/in.h> | 20 | #include <linux/in.h> |
19 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
diff --git a/net/ipv6/netfilter/ip6t_mac.c b/net/ipv6/netfilter/ip6t_mac.c index ae0b09291d17..c848152315bc 100644 --- a/net/ipv6/netfilter/ip6t_mac.c +++ b/net/ipv6/netfilter/ip6t_mac.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
13 | #include <linux/if_ether.h> | 13 | #include <linux/if_ether.h> |
14 | #include <linux/etherdevice.h> | ||
14 | 15 | ||
15 | #include <linux/netfilter_ipv6/ip6t_mac.h> | 16 | #include <linux/netfilter_ipv6/ip6t_mac.h> |
16 | #include <linux/netfilter_ipv6/ip6_tables.h> | 17 | #include <linux/netfilter_ipv6/ip6_tables.h> |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 66140f13d119..e0d3ad02ffb5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * reachable. otherwise, round-robin the list. | 24 | * reachable. otherwise, round-robin the list. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/capability.h> | ||
27 | #include <linux/config.h> | 28 | #include <linux/config.h> |
28 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
29 | #include <linux/types.h> | 30 | #include <linux/types.h> |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 0dae48aa1cec..c2d3e17beae6 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/config.h> | 21 | #include <linux/config.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/capability.h> | ||
23 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
24 | #include <linux/types.h> | 25 | #include <linux/types.h> |
25 | #include <linux/socket.h> | 26 | #include <linux/socket.h> |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index a25f4e8a8ada..66d04004afda 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -67,6 +67,9 @@ | |||
67 | #include <linux/proc_fs.h> | 67 | #include <linux/proc_fs.h> |
68 | #include <linux/seq_file.h> | 68 | #include <linux/seq_file.h> |
69 | 69 | ||
70 | /* Socket used for sending RSTs and ACKs */ | ||
71 | static struct socket *tcp6_socket; | ||
72 | |||
70 | static void tcp_v6_send_reset(struct sk_buff *skb); | 73 | static void tcp_v6_send_reset(struct sk_buff *skb); |
71 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); | 74 | static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req); |
72 | static void tcp_v6_send_check(struct sock *sk, int len, | 75 | static void tcp_v6_send_check(struct sock *sk, int len, |
@@ -611,7 +614,7 @@ static void tcp_v6_send_reset(struct sk_buff *skb) | |||
611 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { | 614 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { |
612 | 615 | ||
613 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { | 616 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { |
614 | ip6_xmit(NULL, buff, &fl, NULL, 0); | 617 | ip6_xmit(tcp6_socket->sk, buff, &fl, NULL, 0); |
615 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); | 618 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); |
616 | TCP_INC_STATS_BH(TCP_MIB_OUTRSTS); | 619 | TCP_INC_STATS_BH(TCP_MIB_OUTRSTS); |
617 | return; | 620 | return; |
@@ -675,7 +678,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 | |||
675 | 678 | ||
676 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { | 679 | if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) { |
677 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { | 680 | if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) { |
678 | ip6_xmit(NULL, buff, &fl, NULL, 0); | 681 | ip6_xmit(tcp6_socket->sk, buff, &fl, NULL, 0); |
679 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); | 682 | TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); |
680 | return; | 683 | return; |
681 | } | 684 | } |
@@ -1600,8 +1603,21 @@ static struct inet_protosw tcpv6_protosw = { | |||
1600 | 1603 | ||
1601 | void __init tcpv6_init(void) | 1604 | void __init tcpv6_init(void) |
1602 | { | 1605 | { |
1606 | int err; | ||
1607 | |||
1603 | /* register inet6 protocol */ | 1608 | /* register inet6 protocol */ |
1604 | if (inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP) < 0) | 1609 | if (inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP) < 0) |
1605 | printk(KERN_ERR "tcpv6_init: Could not register protocol\n"); | 1610 | printk(KERN_ERR "tcpv6_init: Could not register protocol\n"); |
1606 | inet6_register_protosw(&tcpv6_protosw); | 1611 | inet6_register_protosw(&tcpv6_protosw); |
1612 | |||
1613 | err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_TCP, &tcp6_socket); | ||
1614 | if (err < 0) | ||
1615 | panic("Failed to create the TCPv6 control socket.\n"); | ||
1616 | tcp6_socket->sk->sk_allocation = GFP_ATOMIC; | ||
1617 | |||
1618 | /* Unhash it so that IP input processing does not even | ||
1619 | * see it, we do not wish this socket to see incoming | ||
1620 | * packets. | ||
1621 | */ | ||
1622 | tcp6_socket->sk->sk_prot->unhash(tcp6_socket->sk); | ||
1607 | } | 1623 | } |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 0dc519b40404..0fb513a34d11 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/config.h> | 31 | #include <linux/config.h> |
32 | #include <linux/capability.h> | ||
32 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
33 | #include <linux/if_arp.h> | 34 | #include <linux/if_arp.h> |
34 | #include <linux/if_ether.h> | 35 | #include <linux/if_ether.h> |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index fbfa96754417..759445648667 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -43,6 +43,7 @@ | |||
43 | ********************************************************************/ | 43 | ********************************************************************/ |
44 | 44 | ||
45 | #include <linux/config.h> | 45 | #include <linux/config.h> |
46 | #include <linux/capability.h> | ||
46 | #include <linux/module.h> | 47 | #include <linux/module.h> |
47 | #include <linux/types.h> | 48 | #include <linux/types.h> |
48 | #include <linux/socket.h> | 49 | #include <linux/socket.h> |
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 70543d89438b..890bac0d4a56 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
34 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
35 | #include <linux/skbuff.h> | 35 | #include <linux/skbuff.h> |
36 | #include <linux/capability.h> | ||
36 | #include <linux/if.h> | 37 | #include <linux/if.h> |
37 | #include <linux/if_ether.h> | 38 | #include <linux/if_ether.h> |
38 | #include <linux/if_arp.h> | 39 | #include <linux/if_arp.h> |
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c index 75f2666e8630..c6d169fbdceb 100644 --- a/net/irda/irias_object.c +++ b/net/irda/irias_object.c | |||
@@ -82,8 +82,7 @@ struct ias_object *irias_new_object( char *name, int id) | |||
82 | 82 | ||
83 | IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); | 83 | IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); |
84 | 84 | ||
85 | obj = (struct ias_object *) kmalloc(sizeof(struct ias_object), | 85 | obj = kmalloc(sizeof(struct ias_object), GFP_ATOMIC); |
86 | GFP_ATOMIC); | ||
87 | if (obj == NULL) { | 86 | if (obj == NULL) { |
88 | IRDA_WARNING("%s(), Unable to allocate object!\n", | 87 | IRDA_WARNING("%s(), Unable to allocate object!\n", |
89 | __FUNCTION__); | 88 | __FUNCTION__); |
@@ -348,8 +347,7 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value, | |||
348 | IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); | 347 | IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); |
349 | IRDA_ASSERT(name != NULL, return;); | 348 | IRDA_ASSERT(name != NULL, return;); |
350 | 349 | ||
351 | attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), | 350 | attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC); |
352 | GFP_ATOMIC); | ||
353 | if (attrib == NULL) { | 351 | if (attrib == NULL) { |
354 | IRDA_WARNING("%s: Unable to allocate attribute!\n", | 352 | IRDA_WARNING("%s: Unable to allocate attribute!\n", |
355 | __FUNCTION__); | 353 | __FUNCTION__); |
@@ -385,8 +383,7 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets, | |||
385 | IRDA_ASSERT(name != NULL, return;); | 383 | IRDA_ASSERT(name != NULL, return;); |
386 | IRDA_ASSERT(octets != NULL, return;); | 384 | IRDA_ASSERT(octets != NULL, return;); |
387 | 385 | ||
388 | attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), | 386 | attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC); |
389 | GFP_ATOMIC); | ||
390 | if (attrib == NULL) { | 387 | if (attrib == NULL) { |
391 | IRDA_WARNING("%s: Unable to allocate attribute!\n", | 388 | IRDA_WARNING("%s: Unable to allocate attribute!\n", |
392 | __FUNCTION__); | 389 | __FUNCTION__); |
@@ -420,8 +417,7 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value, | |||
420 | IRDA_ASSERT(name != NULL, return;); | 417 | IRDA_ASSERT(name != NULL, return;); |
421 | IRDA_ASSERT(value != NULL, return;); | 418 | IRDA_ASSERT(value != NULL, return;); |
422 | 419 | ||
423 | attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib), | 420 | attrib = kmalloc(sizeof( struct ias_attrib), GFP_ATOMIC); |
424 | GFP_ATOMIC); | ||
425 | if (attrib == NULL) { | 421 | if (attrib == NULL) { |
426 | IRDA_WARNING("%s: Unable to allocate attribute!\n", | 422 | IRDA_WARNING("%s: Unable to allocate attribute!\n", |
427 | __FUNCTION__); | 423 | __FUNCTION__); |
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index b391cb3893d4..e4fe1e80029c 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h | |||
@@ -248,6 +248,7 @@ | |||
248 | #include <linux/netdevice.h> | 248 | #include <linux/netdevice.h> |
249 | #include <linux/miscdevice.h> | 249 | #include <linux/miscdevice.h> |
250 | #include <linux/poll.h> | 250 | #include <linux/poll.h> |
251 | #include <linux/capability.h> | ||
251 | #include <linux/config.h> | 252 | #include <linux/config.h> |
252 | #include <linux/ctype.h> /* isspace() */ | 253 | #include <linux/ctype.h> /* isspace() */ |
253 | #include <asm/uaccess.h> | 254 | #include <asm/uaccess.h> |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 4c2f6d694f88..43f1ce74187d 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | #include <linux/capability.h> | ||
18 | #include <linux/module.h> | 19 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
20 | #include <linux/socket.h> | 21 | #include <linux/socket.h> |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index bb50c8a9fcad..2101b45d2ec6 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/config.h> | 24 | #include <linux/config.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | 26 | ||
27 | #include <linux/capability.h> | ||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/init.h> | 29 | #include <linux/init.h> |
29 | #include <linux/signal.h> | 30 | #include <linux/signal.h> |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 63b0e4afeb33..d44981f5a619 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/moduleparam.h> | 13 | #include <linux/moduleparam.h> |
14 | #include <linux/capability.h> | ||
14 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
16 | #include <linux/socket.h> | 17 | #include <linux/socket.h> |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index f69e5ed9bd06..ee93abc71cb8 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/types.h> | 53 | #include <linux/types.h> |
54 | #include <linux/sched.h> | 54 | #include <linux/sched.h> |
55 | #include <linux/mm.h> | 55 | #include <linux/mm.h> |
56 | #include <linux/capability.h> | ||
56 | #include <linux/fcntl.h> | 57 | #include <linux/fcntl.h> |
57 | #include <linux/socket.h> | 58 | #include <linux/socket.h> |
58 | #include <linux/in.h> | 59 | #include <linux/in.h> |
@@ -1237,7 +1238,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) | |||
1237 | goto done; | 1238 | goto done; |
1238 | 1239 | ||
1239 | err = -ENOBUFS; | 1240 | err = -ENOBUFS; |
1240 | i = (struct packet_mclist *)kmalloc(sizeof(*i), GFP_KERNEL); | 1241 | i = kmalloc(sizeof(*i), GFP_KERNEL); |
1241 | if (i == NULL) | 1242 | if (i == NULL) |
1242 | goto done; | 1243 | goto done; |
1243 | 1244 | ||
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 63090be2315a..ea65396d1619 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -9,7 +9,9 @@ | |||
9 | * Copyright (C) Terry Dawson VK2KTJ (terry@animats.net) | 9 | * Copyright (C) Terry Dawson VK2KTJ (terry@animats.net) |
10 | * Copyright (C) Tomi Manninen OH2BNS (oh2bns@sral.fi) | 10 | * Copyright (C) Tomi Manninen OH2BNS (oh2bns@sral.fi) |
11 | */ | 11 | */ |
12 | |||
12 | #include <linux/config.h> | 13 | #include <linux/config.h> |
14 | #include <linux/capability.h> | ||
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> | 16 | #include <linux/moduleparam.h> |
15 | #include <linux/init.h> | 17 | #include <linux/init.h> |
diff --git a/net/sched/Kconfig b/net/sched/Kconfig index 55cd5327fbd7..8a260d43ceef 100644 --- a/net/sched/Kconfig +++ b/net/sched/Kconfig | |||
@@ -411,7 +411,7 @@ config NET_EMATCH_META | |||
411 | tristate "Metadata" | 411 | tristate "Metadata" |
412 | depends on NET_EMATCH | 412 | depends on NET_EMATCH |
413 | ---help--- | 413 | ---help--- |
414 | Say Y here if you want to be ablt to classify packets based on | 414 | Say Y here if you want to be able to classify packets based on |
415 | metadata such as load average, netfilter attributes, socket | 415 | metadata such as load average, netfilter attributes, socket |
416 | attributes and routing decisions. | 416 | attributes and routing decisions. |
417 | 417 | ||
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 64b047c65568..5cb956b721e8 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -92,7 +92,6 @@ | |||
92 | #include <linux/rtnetlink.h> | 92 | #include <linux/rtnetlink.h> |
93 | #include <linux/skbuff.h> | 93 | #include <linux/skbuff.h> |
94 | #include <net/pkt_cls.h> | 94 | #include <net/pkt_cls.h> |
95 | #include <config/net/ematch/stack.h> | ||
96 | 95 | ||
97 | static LIST_HEAD(ematch_ops); | 96 | static LIST_HEAD(ematch_ops); |
98 | static DEFINE_RWLOCK(ematch_mod_lock); | 97 | static DEFINE_RWLOCK(ematch_mod_lock); |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index f9573eba5c7a..556c495c6922 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1287,7 +1287,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, | |||
1287 | - (bodysize % SCTP_COOKIE_MULTIPLE); | 1287 | - (bodysize % SCTP_COOKIE_MULTIPLE); |
1288 | *cookie_len = headersize + bodysize; | 1288 | *cookie_len = headersize + bodysize; |
1289 | 1289 | ||
1290 | retval = (sctp_cookie_param_t *)kmalloc(*cookie_len, GFP_ATOMIC); | 1290 | retval = kmalloc(*cookie_len, GFP_ATOMIC); |
1291 | 1291 | ||
1292 | if (!retval) { | 1292 | if (!retval) { |
1293 | *cookie_len = 0; | 1293 | *cookie_len = 0; |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index fc04d185fa33..c98ee375ba5e 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <linux/wait.h> | 63 | #include <linux/wait.h> |
64 | #include <linux/time.h> | 64 | #include <linux/time.h> |
65 | #include <linux/ip.h> | 65 | #include <linux/ip.h> |
66 | #include <linux/capability.h> | ||
66 | #include <linux/fcntl.h> | 67 | #include <linux/fcntl.h> |
67 | #include <linux/poll.h> | 68 | #include <linux/poll.h> |
68 | #include <linux/init.h> | 69 | #include <linux/init.h> |
@@ -860,7 +861,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, | |||
860 | return -EFAULT; | 861 | return -EFAULT; |
861 | 862 | ||
862 | /* Alloc space for the address array in kernel memory. */ | 863 | /* Alloc space for the address array in kernel memory. */ |
863 | kaddrs = (struct sockaddr *)kmalloc(addrs_size, GFP_KERNEL); | 864 | kaddrs = kmalloc(addrs_size, GFP_KERNEL); |
864 | if (unlikely(!kaddrs)) | 865 | if (unlikely(!kaddrs)) |
865 | return -ENOMEM; | 866 | return -ENOMEM; |
866 | 867 | ||
@@ -1150,7 +1151,7 @@ SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk, | |||
1150 | return -EFAULT; | 1151 | return -EFAULT; |
1151 | 1152 | ||
1152 | /* Alloc space for the address array in kernel memory. */ | 1153 | /* Alloc space for the address array in kernel memory. */ |
1153 | kaddrs = (struct sockaddr *)kmalloc(addrs_size, GFP_KERNEL); | 1154 | kaddrs = kmalloc(addrs_size, GFP_KERNEL); |
1154 | if (unlikely(!kaddrs)) | 1155 | if (unlikely(!kaddrs)) |
1155 | return -ENOMEM; | 1156 | return -ENOMEM; |
1156 | 1157 | ||
diff --git a/net/socket.c b/net/socket.c index 06fa217f58a9..b38a263853c3 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -993,7 +993,7 @@ static int sock_fasync(int fd, struct file *filp, int on) | |||
993 | 993 | ||
994 | if (on) | 994 | if (on) |
995 | { | 995 | { |
996 | fna=(struct fasync_struct *)kmalloc(sizeof(struct fasync_struct), GFP_KERNEL); | 996 | fna = kmalloc(sizeof(struct fasync_struct), GFP_KERNEL); |
997 | if(fna==NULL) | 997 | if(fna==NULL) |
998 | return -ENOMEM; | 998 | return -ENOMEM; |
999 | } | 999 | } |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 8c7756036e95..9ac1b8c26c01 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -94,7 +94,7 @@ rpcauth_init_credcache(struct rpc_auth *auth, unsigned long expire) | |||
94 | struct rpc_cred_cache *new; | 94 | struct rpc_cred_cache *new; |
95 | int i; | 95 | int i; |
96 | 96 | ||
97 | new = (struct rpc_cred_cache *)kmalloc(sizeof(*new), GFP_KERNEL); | 97 | new = kmalloc(sizeof(*new), GFP_KERNEL); |
98 | if (!new) | 98 | if (!new) |
99 | return -ENOMEM; | 99 | return -ENOMEM; |
100 | for (i = 0; i < RPC_CREDCACHE_NR; i++) | 100 | for (i = 0; i < RPC_CREDCACHE_NR; i++) |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 890fb5ea0dcb..1b3ed4fd1987 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -70,7 +70,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
70 | dprintk("RPC: allocating UNIX cred for uid %d gid %d\n", | 70 | dprintk("RPC: allocating UNIX cred for uid %d gid %d\n", |
71 | acred->uid, acred->gid); | 71 | acred->uid, acred->gid); |
72 | 72 | ||
73 | if (!(cred = (struct unx_cred *) kmalloc(sizeof(*cred), GFP_KERNEL))) | 73 | if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL))) |
74 | return ERR_PTR(-ENOMEM); | 74 | return ERR_PTR(-ENOMEM); |
75 | 75 | ||
76 | atomic_set(&cred->uc_count, 1); | 76 | atomic_set(&cred->uc_count, 1); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4cef7fa2b740..d2f0550c4ba0 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -118,7 +118,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, | |||
118 | goto out_err; | 118 | goto out_err; |
119 | 119 | ||
120 | err = -ENOMEM; | 120 | err = -ENOMEM; |
121 | clnt = (struct rpc_clnt *) kmalloc(sizeof(*clnt), GFP_KERNEL); | 121 | clnt = kmalloc(sizeof(*clnt), GFP_KERNEL); |
122 | if (!clnt) | 122 | if (!clnt) |
123 | goto out_err; | 123 | goto out_err; |
124 | memset(clnt, 0, sizeof(*clnt)); | 124 | memset(clnt, 0, sizeof(*clnt)); |
@@ -225,7 +225,7 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
225 | { | 225 | { |
226 | struct rpc_clnt *new; | 226 | struct rpc_clnt *new; |
227 | 227 | ||
228 | new = (struct rpc_clnt *)kmalloc(sizeof(*new), GFP_KERNEL); | 228 | new = kmalloc(sizeof(*new), GFP_KERNEL); |
229 | if (!new) | 229 | if (!new) |
230 | goto out_no_clnt; | 230 | goto out_no_clnt; |
231 | memcpy(new, clnt, sizeof(*new)); | 231 | memcpy(new, clnt, sizeof(*new)); |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index a8bd34d47425..b08419e1fc68 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -32,7 +32,7 @@ svc_create(struct svc_program *prog, unsigned int bufsize) | |||
32 | int vers; | 32 | int vers; |
33 | unsigned int xdrsize; | 33 | unsigned int xdrsize; |
34 | 34 | ||
35 | if (!(serv = (struct svc_serv *) kmalloc(sizeof(*serv), GFP_KERNEL))) | 35 | if (!(serv = kmalloc(sizeof(*serv), GFP_KERNEL))) |
36 | return NULL; | 36 | return NULL; |
37 | memset(serv, 0, sizeof(*serv)); | 37 | memset(serv, 0, sizeof(*serv)); |
38 | serv->sv_name = prog->pg_name; | 38 | serv->sv_name = prog->pg_name; |
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c index 7a43ae4721ed..8b9bf4a763b5 100644 --- a/net/wanrouter/af_wanpipe.c +++ b/net/wanrouter/af_wanpipe.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/capability.h> | ||
39 | #include <linux/fcntl.h> | 40 | #include <linux/fcntl.h> |
40 | #include <linux/socket.h> | 41 | #include <linux/socket.h> |
41 | #include <linux/in.h> | 42 | #include <linux/in.h> |
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index bcf7b3faa76a..c34833dc7cc1 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include <linux/config.h> | 45 | #include <linux/config.h> |
46 | #include <linux/stddef.h> /* offsetof(), etc. */ | 46 | #include <linux/stddef.h> /* offsetof(), etc. */ |
47 | #include <linux/capability.h> | ||
47 | #include <linux/errno.h> /* return codes */ | 48 | #include <linux/errno.h> /* return codes */ |
48 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
49 | #include <linux/init.h> | 50 | #include <linux/init.h> |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index bfabaf9cba87..72b6ff3299ba 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/config.h> | 38 | #include <linux/config.h> |
39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
40 | #include <linux/capability.h> | ||
40 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
41 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
42 | #include <linux/sched.h> | 43 | #include <linux/sched.h> |
diff --git a/security/commoncap.c b/security/commoncap.c index 04c12f58d656..8a6e097f99ea 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/capability.h> | ||
10 | #include <linux/config.h> | 11 | #include <linux/config.h> |
11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
diff --git a/security/dummy.c b/security/dummy.c index a15c54709fde..f1a5bd98bf10 100644 --- a/security/dummy.c +++ b/security/dummy.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #undef DEBUG | 15 | #undef DEBUG |
16 | 16 | ||
17 | #include <linux/capability.h> | ||
17 | #include <linux/config.h> | 18 | #include <linux/config.h> |
18 | #include <linux/module.h> | 19 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 3d2ebae029c1..90db5c76cf6e 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <linux/keyctl.h> | 17 | #include <linux/keyctl.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/err.h> | 20 | #include <linux/err.h> |
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include "internal.h" | 22 | #include "internal.h" |
diff --git a/security/security.c b/security/security.c index ed5fb80769c3..f693e1f66b98 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * (at your option) any later version. | 11 | * (at your option) any later version. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/capability.h> | ||
14 | #include <linux/config.h> | 15 | #include <linux/config.h> |
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index 4600cd6742ce..abc242abd5b1 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c | |||
@@ -312,7 +312,8 @@ static struct pci_device_id i810_pci_tbl [] = { | |||
312 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, | 312 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, |
313 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18, | 313 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18, |
314 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, | 314 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4}, |
315 | 315 | {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_AUDIO, | |
316 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE}, | ||
316 | {0,} | 317 | {0,} |
317 | }; | 318 | }; |
318 | 319 | ||
@@ -3427,7 +3428,6 @@ out_iospace: | |||
3427 | release_mem_region(card->ac97base_mmio_phys, 512); | 3428 | release_mem_region(card->ac97base_mmio_phys, 512); |
3428 | release_mem_region(card->iobase_mmio_phys, 256); | 3429 | release_mem_region(card->iobase_mmio_phys, 256); |
3429 | } | 3430 | } |
3430 | out_pio: | ||
3431 | release_region(card->ac97base, 256); | 3431 | release_region(card->ac97base, 256); |
3432 | out_region2: | 3432 | out_region2: |
3433 | release_region(card->iobase, 64); | 3433 | release_region(card->iobase, 64); |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 1a903390ad6d..509837252735 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <sound/driver.h> | 28 | #include <sound/driver.h> |
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/capability.h> | ||
30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
31 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
32 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |