aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/err_common.c1
-rw-r--r--arch/alpha/kernel/err_ev6.c1
-rw-r--r--arch/alpha/kernel/err_ev7.c1
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-omap1/pm.c6
-rw-r--r--arch/i386/Kconfig1
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c21
-rw-r--r--arch/i386/kernel/cpu/cpufreq/p4-clockmod.c31
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c6
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c10
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-lib.c1
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-smi.c2
-rw-r--r--arch/i386/kernel/io_apic.c4
-rw-r--r--arch/i386/pci/fixup.c2
-rw-r--r--arch/i386/pci/i386.c4
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/sn/kernel/huberror.c1
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c4
-rw-r--r--arch/ia64/sn/kernel/xpnet.c1
-rw-r--r--arch/m68k/Kconfig3
-rw-r--r--arch/m68k/Makefile2
-rw-r--r--arch/m68k/amiga/config.c1091
-rw-r--r--arch/m68k/atari/Makefile1
-rw-r--r--arch/m68k/atari/atakeyb.c730
-rw-r--r--arch/m68k/atari/config.c998
-rw-r--r--arch/m68k/atari/debug.c482
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68k/kernel/head.S2
-rw-r--r--arch/m68k/kernel/setup.c368
-rw-r--r--arch/m68k/lib/checksum.c3
-rw-r--r--arch/m68k/mac/baboon.c32
-rw-r--r--arch/m68k/mac/config.c167
-rw-r--r--arch/m68k/mac/debug.c331
-rw-r--r--arch/m68k/mac/oss.c18
-rw-r--r--arch/m68k/mac/psc.c21
-rw-r--r--arch/m68k/mac/via.c284
-rw-r--r--arch/m68k/q40/config.c272
-rw-r--r--arch/m68k/sun3/sun3ints.c2
-rw-r--r--arch/m68k/sun3x/prom.c132
-rw-r--r--arch/m68knommu/kernel/dma.c1
-rw-r--r--arch/mips/cobalt/Makefile2
-rw-r--r--arch/mips/cobalt/buttons.c54
-rw-r--r--arch/mips/lib/iomap.c1
-rw-r--r--arch/powerpc/kernel/pci_64.c2
-rw-r--r--arch/powerpc/kernel/vio.c4
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c1
-rw-r--r--arch/powerpc/platforms/pseries/power.c8
-rw-r--r--arch/powerpc/platforms/pseries/ras.c1
-rw-r--r--arch/ppc/8260_io/enet.c1
-rw-r--r--arch/ppc/8260_io/fcc_enet.c1
-rw-r--r--arch/ppc/8xx_io/enet.c1
-rw-r--r--arch/ppc/syslib/ppc4xx_sgdma.c1
-rw-r--r--arch/s390/crypto/aes_s390.c15
-rw-r--r--arch/s390/kernel/ipl.c32
-rw-r--r--arch/s390/kernel/kprobes.c3
-rw-r--r--arch/s390/kernel/setup.c111
-rw-r--r--arch/s390/mm/fault.c40
-rw-r--r--arch/sh64/mach-cayman/iomap.c1
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/sparc64/kernel/pci.c4
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c4
-rw-r--r--arch/x86_64/Kconfig1
-rw-r--r--arch/x86_64/kernel/cpufreq/Kconfig19
-rw-r--r--arch/x86_64/kernel/io_apic.c4
-rw-r--r--arch/xtensa/kernel/xtensa_ksyms.c1
-rw-r--r--arch/xtensa/platform-iss/setup.c1
67 files changed, 3106 insertions, 2251 deletions
diff --git a/arch/alpha/kernel/err_common.c b/arch/alpha/kernel/err_common.c
index 687580b16b41..13d53b1c9657 100644
--- a/arch/alpha/kernel/err_common.c
+++ b/arch/alpha/kernel/err_common.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/pci.h>
11#include <linux/sched.h> 10#include <linux/sched.h>
12 11
13#include <asm/io.h> 12#include <asm/io.h>
diff --git a/arch/alpha/kernel/err_ev6.c b/arch/alpha/kernel/err_ev6.c
index 69b5f4ea7355..11aee012a8ae 100644
--- a/arch/alpha/kernel/err_ev6.c
+++ b/arch/alpha/kernel/err_ev6.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/pci.h>
11#include <linux/sched.h> 10#include <linux/sched.h>
12 11
13#include <asm/io.h> 12#include <asm/io.h>
diff --git a/arch/alpha/kernel/err_ev7.c b/arch/alpha/kernel/err_ev7.c
index 95463ab1cf35..bc799f72d8c1 100644
--- a/arch/alpha/kernel/err_ev7.c
+++ b/arch/alpha/kernel/err_ev7.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/pci.h>
11#include <linux/sched.h> 10#include <linux/sched.h>
12 11
13#include <asm/io.h> 12#include <asm/io.h>
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e7baca29f3fb..db00376aca15 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -255,6 +255,7 @@ config ARCH_IOP13XX
255 depends on MMU 255 depends on MMU
256 select PLAT_IOP 256 select PLAT_IOP
257 select PCI 257 select PCI
258 select ARCH_SUPPORTS_MSI
258 help 259 help
259 Support for Intel's IOP13XX (XScale) family of processors. 260 Support for Intel's IOP13XX (XScale) family of processors.
260 261
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 0383ab334270..6f4ea4bda5e0 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -72,12 +72,12 @@ static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
72 72
73static unsigned short enable_dyn_sleep = 1; 73static unsigned short enable_dyn_sleep = 1;
74 74
75static ssize_t omap_pm_sleep_while_idle_show(struct subsystem * subsys, char *buf) 75static ssize_t omap_pm_sleep_while_idle_show(struct kset *kset, char *buf)
76{ 76{
77 return sprintf(buf, "%hu\n", enable_dyn_sleep); 77 return sprintf(buf, "%hu\n", enable_dyn_sleep);
78} 78}
79 79
80static ssize_t omap_pm_sleep_while_idle_store(struct subsystem * subsys, 80static ssize_t omap_pm_sleep_while_idle_store(struct kset *kset,
81 const char * buf, 81 const char * buf,
82 size_t n) 82 size_t n)
83{ 83{
@@ -100,7 +100,7 @@ static struct subsys_attribute sleep_while_idle_attr = {
100 .store = omap_pm_sleep_while_idle_store, 100 .store = omap_pm_sleep_while_idle_store,
101}; 101};
102 102
103extern struct subsystem power_subsys; 103extern struct kset power_subsys;
104static void (*omap_sram_idle)(void) = NULL; 104static void (*omap_sram_idle)(void) = NULL;
105static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL; 105static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL;
106 106
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 53d62373a524..bcf2fc408a1a 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1073,6 +1073,7 @@ config PCI
1073 bool "PCI support" if !X86_VISWS 1073 bool "PCI support" if !X86_VISWS
1074 depends on !X86_VOYAGER 1074 depends on !X86_VOYAGER
1075 default y if X86_VISWS 1075 default y if X86_VISWS
1076 select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
1076 help 1077 help
1077 Find out whether you have a PCI motherboard. PCI is the name of a 1078 Find out whether you have a PCI motherboard. PCI is the name of a
1078 bus system, i.e. the way the CPU talks to the other stuff inside 1079 bus system, i.e. the way the CPU talks to the other stuff inside
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 2b030d6ccbf7..a3df9c039bd4 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -590,20 +590,23 @@ static acpi_status longhaul_walk_callback(acpi_handle obj_handle,
590static int enable_arbiter_disable(void) 590static int enable_arbiter_disable(void)
591{ 591{
592 struct pci_dev *dev; 592 struct pci_dev *dev;
593 int status;
593 int reg; 594 int reg;
594 u8 pci_cmd; 595 u8 pci_cmd;
595 596
597 status = 1;
596 /* Find PLE133 host bridge */ 598 /* Find PLE133 host bridge */
597 reg = 0x78; 599 reg = 0x78;
598 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, NULL); 600 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0,
601 NULL);
599 /* Find CLE266 host bridge */ 602 /* Find CLE266 host bridge */
600 if (dev == NULL) { 603 if (dev == NULL) {
601 reg = 0x76; 604 reg = 0x76;
602 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL); 605 dev = pci_get_device(PCI_VENDOR_ID_VIA,
606 PCI_DEVICE_ID_VIA_862X_0, NULL);
603 /* Find CN400 V-Link host bridge */ 607 /* Find CN400 V-Link host bridge */
604 if (dev == NULL) 608 if (dev == NULL)
605 dev = pci_find_device(PCI_VENDOR_ID_VIA, 0x7259, NULL); 609 dev = pci_get_device(PCI_VENDOR_ID_VIA, 0x7259, NULL);
606
607 } 610 }
608 if (dev != NULL) { 611 if (dev != NULL) {
609 /* Enable access to port 0x22 */ 612 /* Enable access to port 0x22 */
@@ -615,10 +618,11 @@ static int enable_arbiter_disable(void)
615 if (!(pci_cmd & 1<<7)) { 618 if (!(pci_cmd & 1<<7)) {
616 printk(KERN_ERR PFX 619 printk(KERN_ERR PFX
617 "Can't enable access to port 0x22.\n"); 620 "Can't enable access to port 0x22.\n");
618 return 0; 621 status = 0;
619 } 622 }
620 } 623 }
621 return 1; 624 pci_dev_put(dev);
625 return status;
622 } 626 }
623 return 0; 627 return 0;
624} 628}
@@ -629,7 +633,7 @@ static int longhaul_setup_vt8235(void)
629 u8 pci_cmd; 633 u8 pci_cmd;
630 634
631 /* Find VT8235 southbridge */ 635 /* Find VT8235 southbridge */
632 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL); 636 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL);
633 if (dev != NULL) { 637 if (dev != NULL) {
634 /* Set transition time to max */ 638 /* Set transition time to max */
635 pci_read_config_byte(dev, 0xec, &pci_cmd); 639 pci_read_config_byte(dev, 0xec, &pci_cmd);
@@ -641,6 +645,7 @@ static int longhaul_setup_vt8235(void)
641 pci_read_config_byte(dev, 0xe5, &pci_cmd); 645 pci_read_config_byte(dev, 0xe5, &pci_cmd);
642 pci_cmd |= 1 << 7; 646 pci_cmd |= 1 << 7;
643 pci_write_config_byte(dev, 0xe5, pci_cmd); 647 pci_write_config_byte(dev, 0xe5, pci_cmd);
648 pci_dev_put(dev);
644 return 1; 649 return 1;
645 } 650 }
646 return 0; 651 return 0;
@@ -678,7 +683,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
678 sizeof(samuel2_eblcr)); 683 sizeof(samuel2_eblcr));
679 break; 684 break;
680 case 1 ... 15: 685 case 1 ... 15:
681 longhaul_version = TYPE_LONGHAUL_V2; 686 longhaul_version = TYPE_LONGHAUL_V1;
682 if (c->x86_mask < 8) { 687 if (c->x86_mask < 8) {
683 cpu_model = CPU_SAMUEL2; 688 cpu_model = CPU_SAMUEL2;
684 cpuname = "C3 'Samuel 2' [C5B]"; 689 cpuname = "C3 'Samuel 2' [C5B]";
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
index 4786fedca6eb..4c76b511e194 100644
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -27,7 +27,6 @@
27#include <linux/cpufreq.h> 27#include <linux/cpufreq.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/cpumask.h> 29#include <linux/cpumask.h>
30#include <linux/sched.h> /* current / set_cpus_allowed() */
31 30
32#include <asm/processor.h> 31#include <asm/processor.h>
33#include <asm/msr.h> 32#include <asm/msr.h>
@@ -62,7 +61,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
62 if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV)) 61 if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV))
63 return -EINVAL; 62 return -EINVAL;
64 63
65 rdmsr(MSR_IA32_THERM_STATUS, l, h); 64 rdmsr_on_cpu(cpu, MSR_IA32_THERM_STATUS, &l, &h);
66 65
67 if (l & 0x01) 66 if (l & 0x01)
68 dprintk("CPU#%d currently thermal throttled\n", cpu); 67 dprintk("CPU#%d currently thermal throttled\n", cpu);
@@ -70,10 +69,10 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
70 if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT)) 69 if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT))
71 newstate = DC_38PT; 70 newstate = DC_38PT;
72 71
73 rdmsr(MSR_IA32_THERM_CONTROL, l, h); 72 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
74 if (newstate == DC_DISABLE) { 73 if (newstate == DC_DISABLE) {
75 dprintk("CPU#%d disabling modulation\n", cpu); 74 dprintk("CPU#%d disabling modulation\n", cpu);
76 wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h); 75 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l & ~(1<<4), h);
77 } else { 76 } else {
78 dprintk("CPU#%d setting duty cycle to %d%%\n", 77 dprintk("CPU#%d setting duty cycle to %d%%\n",
79 cpu, ((125 * newstate) / 10)); 78 cpu, ((125 * newstate) / 10));
@@ -84,7 +83,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
84 */ 83 */
85 l = (l & ~14); 84 l = (l & ~14);
86 l = l | (1<<4) | ((newstate & 0x7)<<1); 85 l = l | (1<<4) | ((newstate & 0x7)<<1);
87 wrmsr(MSR_IA32_THERM_CONTROL, l, h); 86 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l, h);
88 } 87 }
89 88
90 return 0; 89 return 0;
@@ -111,7 +110,6 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
111{ 110{
112 unsigned int newstate = DC_RESV; 111 unsigned int newstate = DC_RESV;
113 struct cpufreq_freqs freqs; 112 struct cpufreq_freqs freqs;
114 cpumask_t cpus_allowed;
115 int i; 113 int i;
116 114
117 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate)) 115 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
@@ -132,17 +130,8 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
132 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software 130 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
133 * Developer's Manual, Volume 3 131 * Developer's Manual, Volume 3
134 */ 132 */
135 cpus_allowed = current->cpus_allowed; 133 for_each_cpu_mask(i, policy->cpus)
136
137 for_each_cpu_mask(i, policy->cpus) {
138 cpumask_t this_cpu = cpumask_of_cpu(i);
139
140 set_cpus_allowed(current, this_cpu);
141 BUG_ON(smp_processor_id() != i);
142
143 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); 134 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
144 }
145 set_cpus_allowed(current, cpus_allowed);
146 135
147 /* notifiers */ 136 /* notifiers */
148 for_each_cpu_mask(i, policy->cpus) { 137 for_each_cpu_mask(i, policy->cpus) {
@@ -256,17 +245,9 @@ static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
256 245
257static unsigned int cpufreq_p4_get(unsigned int cpu) 246static unsigned int cpufreq_p4_get(unsigned int cpu)
258{ 247{
259 cpumask_t cpus_allowed;
260 u32 l, h; 248 u32 l, h;
261 249
262 cpus_allowed = current->cpus_allowed; 250 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
263
264 set_cpus_allowed(current, cpumask_of_cpu(cpu));
265 BUG_ON(smp_processor_id() != cpu);
266
267 rdmsr(MSR_IA32_THERM_CONTROL, l, h);
268
269 set_cpus_allowed(current, cpus_allowed);
270 251
271 if (l & 0x10) { 252 if (l & 0x10) {
272 l = l >> 1; 253 l = l >> 1;
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index fe3b67005ebb..7cf3d207b6b3 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -661,7 +661,8 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
661 661
662 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 662 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
663 data->powernow_table = powernow_table; 663 data->powernow_table = powernow_table;
664 print_basics(data); 664 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu)
665 print_basics(data);
665 666
666 for (j = 0; j < data->numps; j++) 667 for (j = 0; j < data->numps; j++)
667 if ((pst[j].fid==data->currfid) && (pst[j].vid==data->currvid)) 668 if ((pst[j].fid==data->currfid) && (pst[j].vid==data->currvid))
@@ -814,7 +815,8 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
814 815
815 /* fill in data */ 816 /* fill in data */
816 data->numps = data->acpi_data.state_count; 817 data->numps = data->acpi_data.state_count;
817 print_basics(data); 818 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu)
819 print_basics(data);
818 powernow_k8_acpi_pst_values(data, 0); 820 powernow_k8_acpi_pst_values(data, 0);
819 821
820 /* notify BIOS that we exist */ 822 /* notify BIOS that we exist */
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 0fb2a3001ba5..95be5013c984 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -215,8 +215,10 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
215 215
216static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); 216static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
217 217
218#ifdef CONFIG_X86_POWERNOW_K8_ACPI
218static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); 219static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
219static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); 220static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
221#endif
220 222
221#ifdef CONFIG_SMP 223#ifdef CONFIG_SMP
222static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) 224static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index f43b987f952b..35489fd68852 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -720,6 +720,7 @@ static int centrino_target (struct cpufreq_policy *policy,
720 cpu_set(j, set_mask); 720 cpu_set(j, set_mask);
721 721
722 set_cpus_allowed(current, set_mask); 722 set_cpus_allowed(current, set_mask);
723 preempt_disable();
723 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { 724 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
724 dprintk("couldn't limit to CPUs in this domain\n"); 725 dprintk("couldn't limit to CPUs in this domain\n");
725 retval = -EAGAIN; 726 retval = -EAGAIN;
@@ -727,6 +728,7 @@ static int centrino_target (struct cpufreq_policy *policy,
727 /* We haven't started the transition yet. */ 728 /* We haven't started the transition yet. */
728 goto migrate_end; 729 goto migrate_end;
729 } 730 }
731 preempt_enable();
730 break; 732 break;
731 } 733 }
732 734
@@ -761,10 +763,13 @@ static int centrino_target (struct cpufreq_policy *policy,
761 } 763 }
762 764
763 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); 765 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
764 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 766 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
767 preempt_enable();
765 break; 768 break;
769 }
766 770
767 cpu_set(j, covered_cpus); 771 cpu_set(j, covered_cpus);
772 preempt_enable();
768 } 773 }
769 774
770 for_each_cpu_mask(k, online_policy_cpus) { 775 for_each_cpu_mask(k, online_policy_cpus) {
@@ -796,8 +801,11 @@ static int centrino_target (struct cpufreq_policy *policy,
796 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 801 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
797 } 802 }
798 } 803 }
804 set_cpus_allowed(current, saved_mask);
805 return 0;
799 806
800migrate_end: 807migrate_end:
808 preempt_enable();
801 set_cpus_allowed(current, saved_mask); 809 set_cpus_allowed(current, saved_mask);
802 return 0; 810 return 0;
803} 811}
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
index d59277c00911..b1acc8ce3167 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
@@ -13,7 +13,6 @@
13#include <linux/moduleparam.h> 13#include <linux/moduleparam.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/cpufreq.h> 15#include <linux/cpufreq.h>
16#include <linux/pci.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
18 17
19#include <asm/msr.h> 18#include <asm/msr.h>
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
index ff0d89806114..e1c509aa3054 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
@@ -17,10 +17,10 @@
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/cpufreq.h> 19#include <linux/cpufreq.h>
20#include <linux/pci.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <asm/ist.h> 22#include <asm/ist.h>
23#include <asm/io.h>
24 24
25#include "speedstep-lib.h" 25#include "speedstep-lib.h"
26 26
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index b3ab8ffebd27..89d85d244926 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -2611,19 +2611,19 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
2611 if (irq < 0) 2611 if (irq < 0)
2612 return irq; 2612 return irq;
2613 2613
2614 set_irq_msi(irq, desc);
2615 ret = msi_compose_msg(dev, irq, &msg); 2614 ret = msi_compose_msg(dev, irq, &msg);
2616 if (ret < 0) { 2615 if (ret < 0) {
2617 destroy_irq(irq); 2616 destroy_irq(irq);
2618 return ret; 2617 return ret;
2619 } 2618 }
2620 2619
2620 set_irq_msi(irq, desc);
2621 write_msi_msg(irq, &msg); 2621 write_msi_msg(irq, &msg);
2622 2622
2623 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, 2623 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq,
2624 "edge"); 2624 "edge");
2625 2625
2626 return irq; 2626 return 0;
2627} 2627}
2628 2628
2629void arch_teardown_msi_irq(unsigned int irq) 2629void arch_teardown_msi_irq(unsigned int irq)
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index 8053b17ab647..b62eafb997bc 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -354,7 +354,7 @@ static void __devinit pci_fixup_video(struct pci_dev *pdev)
354 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev)); 354 printk(KERN_DEBUG "Boot video device is %s\n", pci_name(pdev));
355 } 355 }
356} 356}
357DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 357DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video);
358 358
359/* 359/*
360 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A. 360 * Some Toshiba laptops need extra code to enable their TI TSB43AB22/A.
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
index 43005f044424..bcd2f94b732c 100644
--- a/arch/i386/pci/i386.c
+++ b/arch/i386/pci/i386.c
@@ -246,8 +246,8 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask)
246 continue; 246 continue;
247 if (!r->start && r->end) { 247 if (!r->start && r->end) {
248 printk(KERN_ERR "PCI: Device %s not available " 248 printk(KERN_ERR "PCI: Device %s not available "
249 "because of resource collisions\n", 249 "because of resource %d collisions\n",
250 pci_name(dev)); 250 pci_name(dev), idx);
251 return -EINVAL; 251 return -EINVAL;
252 } 252 }
253 if (r->flags & IORESOURCE_IO) 253 if (r->flags & IORESOURCE_IO)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index e19185d26554..3b71f97d0b60 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -14,6 +14,7 @@ config IA64
14 select PCI if (!IA64_HP_SIM) 14 select PCI if (!IA64_HP_SIM)
15 select ACPI if (!IA64_HP_SIM) 15 select ACPI if (!IA64_HP_SIM)
16 select PM if (!IA64_HP_SIM) 16 select PM if (!IA64_HP_SIM)
17 select ARCH_SUPPORTS_MSI
17 default y 18 default y
18 help 19 help
19 The Itanium Processor Family is Intel's 64-bit successor to 20 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c
index fcf7f93c4b61..2c3f9dfca78b 100644
--- a/arch/ia64/sn/kernel/huberror.c
+++ b/arch/ia64/sn/kernel/huberror.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <linux/pci.h>
12#include <asm/delay.h> 11#include <asm/delay.h>
13#include <asm/sn/sn_sal.h> 12#include <asm/sn/sn_sal.h>
14#include "ioerror.h" 13#include "ioerror.h"
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 49873aa4a37d..83f190ffe350 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -87,7 +87,6 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
87 if (irq < 0) 87 if (irq < 0)
88 return irq; 88 return irq;
89 89
90 set_irq_msi(irq, entry);
91 /* 90 /*
92 * Set up the vector plumbing. Let the prom (via sn_intr_alloc) 91 * Set up the vector plumbing. Let the prom (via sn_intr_alloc)
93 * decide which cpu to direct this msi at by default. 92 * decide which cpu to direct this msi at by default.
@@ -144,10 +143,11 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
144 */ 143 */
145 msg.data = 0x100 + irq; 144 msg.data = 0x100 + irq;
146 145
146 set_irq_msi(irq, entry);
147 write_msi_msg(irq, &msg); 147 write_msi_msg(irq, &msg);
148 set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq); 148 set_irq_chip_and_handler(irq, &sn_msi_chip, handle_edge_irq);
149 149
150 return irq; 150 return 0;
151} 151}
152 152
153#ifdef CONFIG_SMP 153#ifdef CONFIG_SMP
diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c
index 5419acb89a8c..88fad85ceeff 100644
--- a/arch/ia64/sn/kernel/xpnet.c
+++ b/arch/ia64/sn/kernel/xpnet.c
@@ -24,7 +24,6 @@
24 24
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/pci.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/ioport.h> 28#include <linux/ioport.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index a8e1e604dfa8..b8536c7c0877 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -409,6 +409,9 @@ config STRAM_PROC
409 help 409 help
410 Say Y here to report ST-RAM usage statistics in /proc/stram. 410 Say Y here to report ST-RAM usage statistics in /proc/stram.
411 411
412config ATARI_KBD_CORE
413 bool
414
412config HEARTBEAT 415config HEARTBEAT
413 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 416 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
414 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 417 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 34d826d10f1b..c20831a7e1a9 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -21,7 +21,7 @@ AS += -m68020
21LDFLAGS := -m m68kelf 21LDFLAGS := -m m68kelf
22ifneq ($(COMPILE_ARCH),$(ARCH)) 22ifneq ($(COMPILE_ARCH),$(ARCH))
23 # prefix for cross-compiling binaries 23 # prefix for cross-compiling binaries
24 CROSS_COMPILE = m68k-linux- 24 CROSS_COMPILE = m68k-linux-gnu-
25endif 25endif
26 26
27ifdef CONFIG_SUN3 27ifdef CONFIG_SUN3
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 3204f412cad8..35748531327d 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -22,9 +22,7 @@
22#include <linux/vt_kern.h> 22#include <linux/vt_kern.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#ifdef CONFIG_ZORRO
26#include <linux/zorro.h> 25#include <linux/zorro.h>
27#endif
28 26
29#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
30#include <asm/setup.h> 28#include <asm/setup.h>
@@ -62,55 +60,51 @@ static char s_cdtv[] __initdata = "CDTV";
62static char s_cd32[] __initdata = "CD32"; 60static char s_cd32[] __initdata = "CD32";
63static char s_draco[] __initdata = "Draco"; 61static char s_draco[] __initdata = "Draco";
64static char *amiga_models[] __initdata = { 62static char *amiga_models[] __initdata = {
65 [AMI_500-AMI_500] = s_a500, 63 [AMI_500-AMI_500] = s_a500,
66 [AMI_500PLUS-AMI_500] = s_a500p, 64 [AMI_500PLUS-AMI_500] = s_a500p,
67 [AMI_600-AMI_500] = s_a600, 65 [AMI_600-AMI_500] = s_a600,
68 [AMI_1000-AMI_500] = s_a1000, 66 [AMI_1000-AMI_500] = s_a1000,
69 [AMI_1200-AMI_500] = s_a1200, 67 [AMI_1200-AMI_500] = s_a1200,
70 [AMI_2000-AMI_500] = s_a2000, 68 [AMI_2000-AMI_500] = s_a2000,
71 [AMI_2500-AMI_500] = s_a2500, 69 [AMI_2500-AMI_500] = s_a2500,
72 [AMI_3000-AMI_500] = s_a3000, 70 [AMI_3000-AMI_500] = s_a3000,
73 [AMI_3000T-AMI_500] = s_a3000t, 71 [AMI_3000T-AMI_500] = s_a3000t,
74 [AMI_3000PLUS-AMI_500] = s_a3000p, 72 [AMI_3000PLUS-AMI_500] = s_a3000p,
75 [AMI_4000-AMI_500] = s_a4000, 73 [AMI_4000-AMI_500] = s_a4000,
76 [AMI_4000T-AMI_500] = s_a4000t, 74 [AMI_4000T-AMI_500] = s_a4000t,
77 [AMI_CDTV-AMI_500] = s_cdtv, 75 [AMI_CDTV-AMI_500] = s_cdtv,
78 [AMI_CD32-AMI_500] = s_cd32, 76 [AMI_CD32-AMI_500] = s_cd32,
79 [AMI_DRACO-AMI_500] = s_draco, 77 [AMI_DRACO-AMI_500] = s_draco,
80}; 78};
81 79
82static char amiga_model_name[13] = "Amiga "; 80static char amiga_model_name[13] = "Amiga ";
83 81
84extern char m68k_debug_device[];
85
86static void amiga_sched_init(irq_handler_t handler); 82static void amiga_sched_init(irq_handler_t handler);
87/* amiga specific irq functions */ 83/* amiga specific irq functions */
88extern void amiga_init_IRQ (void); 84extern void amiga_init_IRQ(void);
89static void amiga_get_model(char *model); 85static void amiga_get_model(char *model);
90static int amiga_get_hardware_list(char *buffer); 86static int amiga_get_hardware_list(char *buffer);
91/* amiga specific timer functions */ 87/* amiga specific timer functions */
92static unsigned long amiga_gettimeoffset (void); 88static unsigned long amiga_gettimeoffset(void);
93static int a3000_hwclk (int, struct rtc_time *); 89static int a3000_hwclk(int, struct rtc_time *);
94static int a2000_hwclk (int, struct rtc_time *); 90static int a2000_hwclk(int, struct rtc_time *);
95static int amiga_set_clock_mmss (unsigned long); 91static int amiga_set_clock_mmss(unsigned long);
96static unsigned int amiga_get_ss (void); 92static unsigned int amiga_get_ss(void);
97extern void amiga_mksound( unsigned int count, unsigned int ticks ); 93extern void amiga_mksound(unsigned int count, unsigned int ticks);
98static void amiga_reset (void); 94static void amiga_reset(void);
99extern void amiga_init_sound(void); 95extern void amiga_init_sound(void);
100static void amiga_savekmsg_init(void);
101static void amiga_mem_console_write(struct console *co, const char *b, 96static void amiga_mem_console_write(struct console *co, const char *b,
102 unsigned int count); 97 unsigned int count);
103void amiga_serial_console_write(struct console *co, const char *s, 98void amiga_serial_console_write(struct console *co, const char *s,
104 unsigned int count); 99 unsigned int count);
105static void amiga_debug_init(void);
106#ifdef CONFIG_HEARTBEAT 100#ifdef CONFIG_HEARTBEAT
107static void amiga_heartbeat(int on); 101static void amiga_heartbeat(int on);
108#endif 102#endif
109 103
110static struct console amiga_console_driver = { 104static struct console amiga_console_driver = {
111 .name = "debug", 105 .name = "debug",
112 .flags = CON_PRINTBUFFER, 106 .flags = CON_PRINTBUFFER,
113 .index = -1, 107 .index = -1,
114}; 108};
115 109
116 110
@@ -119,24 +113,24 @@ static struct console amiga_console_driver = {
119 */ 113 */
120 114
121static struct { 115static struct {
122 struct resource _ciab, _ciaa, _custom, _kickstart; 116 struct resource _ciab, _ciaa, _custom, _kickstart;
123} mb_resources = { 117} mb_resources = {
124 ._ciab = { 118 ._ciab = {
125 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff 119 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
126 }, 120 },
127 ._ciaa = { 121 ._ciaa = {
128 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff 122 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
129 }, 123 },
130 ._custom = { 124 ._custom = {
131 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff 125 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
132 }, 126 },
133 ._kickstart = { 127 ._kickstart = {
134 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff 128 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
135 } 129 }
136}; 130};
137 131
138static struct resource rtc_resource = { 132static struct resource rtc_resource = {
139 .start = 0x00dc0000, .end = 0x00dcffff 133 .start = 0x00dc0000, .end = 0x00dcffff
140}; 134};
141 135
142static struct resource ram_resource[NUM_MEMINFO]; 136static struct resource ram_resource[NUM_MEMINFO];
@@ -148,57 +142,57 @@ static struct resource ram_resource[NUM_MEMINFO];
148 142
149int amiga_parse_bootinfo(const struct bi_record *record) 143int amiga_parse_bootinfo(const struct bi_record *record)
150{ 144{
151 int unknown = 0; 145 int unknown = 0;
152 const unsigned long *data = record->data; 146 const unsigned long *data = record->data;
153 147
154 switch (record->tag) { 148 switch (record->tag) {
155 case BI_AMIGA_MODEL: 149 case BI_AMIGA_MODEL:
156 amiga_model = *data; 150 amiga_model = *data;
157 break; 151 break;
158 152
159 case BI_AMIGA_ECLOCK: 153 case BI_AMIGA_ECLOCK:
160 amiga_eclock = *data; 154 amiga_eclock = *data;
161 break; 155 break;
162 156
163 case BI_AMIGA_CHIPSET: 157 case BI_AMIGA_CHIPSET:
164 amiga_chipset = *data; 158 amiga_chipset = *data;
165 break; 159 break;
166 160
167 case BI_AMIGA_CHIP_SIZE: 161 case BI_AMIGA_CHIP_SIZE:
168 amiga_chip_size = *(const int *)data; 162 amiga_chip_size = *(const int *)data;
169 break; 163 break;
170 164
171 case BI_AMIGA_VBLANK: 165 case BI_AMIGA_VBLANK:
172 amiga_vblank = *(const unsigned char *)data; 166 amiga_vblank = *(const unsigned char *)data;
173 break; 167 break;
174 168
175 case BI_AMIGA_PSFREQ: 169 case BI_AMIGA_PSFREQ:
176 amiga_psfreq = *(const unsigned char *)data; 170 amiga_psfreq = *(const unsigned char *)data;
177 break; 171 break;
178 172
179 case BI_AMIGA_AUTOCON: 173 case BI_AMIGA_AUTOCON:
180#ifdef CONFIG_ZORRO 174#ifdef CONFIG_ZORRO
181 if (zorro_num_autocon < ZORRO_NUM_AUTO) { 175 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
182 const struct ConfigDev *cd = (struct ConfigDev *)data; 176 const struct ConfigDev *cd = (struct ConfigDev *)data;
183 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; 177 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
184 dev->rom = cd->cd_Rom; 178 dev->rom = cd->cd_Rom;
185 dev->slotaddr = cd->cd_SlotAddr; 179 dev->slotaddr = cd->cd_SlotAddr;
186 dev->slotsize = cd->cd_SlotSize; 180 dev->slotsize = cd->cd_SlotSize;
187 dev->resource.start = (unsigned long)cd->cd_BoardAddr; 181 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
188 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1; 182 dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
189 } else 183 } else
190 printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); 184 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
191#endif /* CONFIG_ZORRO */ 185#endif /* CONFIG_ZORRO */
192 break; 186 break;
193 187
194 case BI_AMIGA_SERPER: 188 case BI_AMIGA_SERPER:
195 /* serial port period: ignored here */ 189 /* serial port period: ignored here */
196 break; 190 break;
197 191
198 default: 192 default:
199 unknown = 1; 193 unknown = 1;
200 } 194 }
201 return(unknown); 195 return unknown;
202} 196}
203 197
204 /* 198 /*
@@ -207,159 +201,159 @@ int amiga_parse_bootinfo(const struct bi_record *record)
207 201
208static void __init amiga_identify(void) 202static void __init amiga_identify(void)
209{ 203{
210 /* Fill in some default values, if necessary */ 204 /* Fill in some default values, if necessary */
211 if (amiga_eclock == 0) 205 if (amiga_eclock == 0)
212 amiga_eclock = 709379; 206 amiga_eclock = 709379;
213
214 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
215
216 printk("Amiga hardware found: ");
217 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
218 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
219 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
220 }
221
222 switch(amiga_model) {
223 case AMI_UNKNOWN:
224 goto Generic;
225
226 case AMI_600:
227 case AMI_1200:
228 AMIGAHW_SET(A1200_IDE);
229 AMIGAHW_SET(PCMCIA);
230 case AMI_500:
231 case AMI_500PLUS:
232 case AMI_1000:
233 case AMI_2000:
234 case AMI_2500:
235 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
236 goto Generic;
237
238 case AMI_3000:
239 case AMI_3000T:
240 AMIGAHW_SET(AMBER_FF);
241 AMIGAHW_SET(MAGIC_REKICK);
242 /* fall through */
243 case AMI_3000PLUS:
244 AMIGAHW_SET(A3000_SCSI);
245 AMIGAHW_SET(A3000_CLK);
246 AMIGAHW_SET(ZORRO3);
247 goto Generic;
248
249 case AMI_4000T:
250 AMIGAHW_SET(A4000_SCSI);
251 /* fall through */
252 case AMI_4000:
253 AMIGAHW_SET(A4000_IDE);
254 AMIGAHW_SET(A3000_CLK);
255 AMIGAHW_SET(ZORRO3);
256 goto Generic;
257
258 case AMI_CDTV:
259 case AMI_CD32:
260 AMIGAHW_SET(CD_ROM);
261 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
262 goto Generic;
263
264 Generic:
265 AMIGAHW_SET(AMI_VIDEO);
266 AMIGAHW_SET(AMI_BLITTER);
267 AMIGAHW_SET(AMI_AUDIO);
268 AMIGAHW_SET(AMI_FLOPPY);
269 AMIGAHW_SET(AMI_KEYBOARD);
270 AMIGAHW_SET(AMI_MOUSE);
271 AMIGAHW_SET(AMI_SERIAL);
272 AMIGAHW_SET(AMI_PARALLEL);
273 AMIGAHW_SET(CHIP_RAM);
274 AMIGAHW_SET(PAULA);
275
276 switch(amiga_chipset) {
277 case CS_OCS:
278 case CS_ECS:
279 case CS_AGA:
280 switch (amiga_custom.deniseid & 0xf) {
281 case 0x0c:
282 AMIGAHW_SET(DENISE_HR);
283 break;
284 case 0x08:
285 AMIGAHW_SET(LISA);
286 break;
287 }
288 break;
289 default:
290 AMIGAHW_SET(DENISE);
291 break;
292 }
293 switch ((amiga_custom.vposr>>8) & 0x7f) {
294 case 0x00:
295 AMIGAHW_SET(AGNUS_PAL);
296 break;
297 case 0x10:
298 AMIGAHW_SET(AGNUS_NTSC);
299 break;
300 case 0x20:
301 case 0x21:
302 AMIGAHW_SET(AGNUS_HR_PAL);
303 break;
304 case 0x30:
305 case 0x31:
306 AMIGAHW_SET(AGNUS_HR_NTSC);
307 break;
308 case 0x22:
309 case 0x23:
310 AMIGAHW_SET(ALICE_PAL);
311 break;
312 case 0x32:
313 case 0x33:
314 AMIGAHW_SET(ALICE_NTSC);
315 break;
316 }
317 AMIGAHW_SET(ZORRO);
318 break;
319
320 case AMI_DRACO:
321 panic("No support for Draco yet");
322
323 default:
324 panic("Unknown Amiga Model");
325 }
326 207
327#define AMIGAHW_ANNOUNCE(name, str) \ 208 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
328 if (AMIGAHW_PRESENT(name)) \ 209
329 printk(str) 210 printk("Amiga hardware found: ");
330 211 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
331 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO "); 212 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
332 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER "); 213 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
333 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF "); 214 }
334 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO "); 215
335 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY "); 216 switch (amiga_model) {
336 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI "); 217 case AMI_UNKNOWN:
337 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI "); 218 goto Generic;
338 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE "); 219
339 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE "); 220 case AMI_600:
340 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM "); 221 case AMI_1200:
341 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD "); 222 AMIGAHW_SET(A1200_IDE);
342 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE "); 223 AMIGAHW_SET(PCMCIA);
343 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL "); 224 case AMI_500:
344 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL "); 225 case AMI_500PLUS:
345 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK "); 226 case AMI_1000:
346 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK "); 227 case AMI_2000:
347 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM "); 228 case AMI_2500:
348 AMIGAHW_ANNOUNCE(PAULA, "PAULA "); 229 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
349 AMIGAHW_ANNOUNCE(DENISE, "DENISE "); 230 goto Generic;
350 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR "); 231
351 AMIGAHW_ANNOUNCE(LISA, "LISA "); 232 case AMI_3000:
352 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL "); 233 case AMI_3000T:
353 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC "); 234 AMIGAHW_SET(AMBER_FF);
354 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL "); 235 AMIGAHW_SET(MAGIC_REKICK);
355 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC "); 236 /* fall through */
356 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL "); 237 case AMI_3000PLUS:
357 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC "); 238 AMIGAHW_SET(A3000_SCSI);
358 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK "); 239 AMIGAHW_SET(A3000_CLK);
359 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA "); 240 AMIGAHW_SET(ZORRO3);
360 if (AMIGAHW_PRESENT(ZORRO)) 241 goto Generic;
361 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : ""); 242
362 printk("\n"); 243 case AMI_4000T:
244 AMIGAHW_SET(A4000_SCSI);
245 /* fall through */
246 case AMI_4000:
247 AMIGAHW_SET(A4000_IDE);
248 AMIGAHW_SET(A3000_CLK);
249 AMIGAHW_SET(ZORRO3);
250 goto Generic;
251
252 case AMI_CDTV:
253 case AMI_CD32:
254 AMIGAHW_SET(CD_ROM);
255 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
256 goto Generic;
257
258 Generic:
259 AMIGAHW_SET(AMI_VIDEO);
260 AMIGAHW_SET(AMI_BLITTER);
261 AMIGAHW_SET(AMI_AUDIO);
262 AMIGAHW_SET(AMI_FLOPPY);
263 AMIGAHW_SET(AMI_KEYBOARD);
264 AMIGAHW_SET(AMI_MOUSE);
265 AMIGAHW_SET(AMI_SERIAL);
266 AMIGAHW_SET(AMI_PARALLEL);
267 AMIGAHW_SET(CHIP_RAM);
268 AMIGAHW_SET(PAULA);
269
270 switch (amiga_chipset) {
271 case CS_OCS:
272 case CS_ECS:
273 case CS_AGA:
274 switch (amiga_custom.deniseid & 0xf) {
275 case 0x0c:
276 AMIGAHW_SET(DENISE_HR);
277 break;
278 case 0x08:
279 AMIGAHW_SET(LISA);
280 break;
281 }
282 break;
283 default:
284 AMIGAHW_SET(DENISE);
285 break;
286 }
287 switch ((amiga_custom.vposr>>8) & 0x7f) {
288 case 0x00:
289 AMIGAHW_SET(AGNUS_PAL);
290 break;
291 case 0x10:
292 AMIGAHW_SET(AGNUS_NTSC);
293 break;
294 case 0x20:
295 case 0x21:
296 AMIGAHW_SET(AGNUS_HR_PAL);
297 break;
298 case 0x30:
299 case 0x31:
300 AMIGAHW_SET(AGNUS_HR_NTSC);
301 break;
302 case 0x22:
303 case 0x23:
304 AMIGAHW_SET(ALICE_PAL);
305 break;
306 case 0x32:
307 case 0x33:
308 AMIGAHW_SET(ALICE_NTSC);
309 break;
310 }
311 AMIGAHW_SET(ZORRO);
312 break;
313
314 case AMI_DRACO:
315 panic("No support for Draco yet");
316
317 default:
318 panic("Unknown Amiga Model");
319 }
320
321#define AMIGAHW_ANNOUNCE(name, str) \
322 if (AMIGAHW_PRESENT(name)) \
323 printk(str)
324
325 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
326 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
327 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
328 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
329 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
330 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
331 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
332 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
333 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
334 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
335 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
336 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
337 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
338 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
339 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
340 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
341 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
342 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
343 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
344 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
345 AMIGAHW_ANNOUNCE(LISA, "LISA ");
346 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
347 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
348 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
349 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
350 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
351 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
352 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
353 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
354 if (AMIGAHW_PRESENT(ZORRO))
355 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
356 printk("\n");
363 357
364#undef AMIGAHW_ANNOUNCE 358#undef AMIGAHW_ANNOUNCE
365} 359}
@@ -370,119 +364,105 @@ static void __init amiga_identify(void)
370 364
371void __init config_amiga(void) 365void __init config_amiga(void)
372{ 366{
373 int i; 367 int i;
374 368
375 amiga_debug_init(); 369 amiga_identify();
376 amiga_identify(); 370
377 371 /* Yuk, we don't have PCI memory */
378 /* Yuk, we don't have PCI memory */ 372 iomem_resource.name = "Memory";
379 iomem_resource.name = "Memory"; 373 for (i = 0; i < 4; i++)
380 for (i = 0; i < 4; i++) 374 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
381 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]); 375
382 376 mach_sched_init = amiga_sched_init;
383 mach_sched_init = amiga_sched_init; 377 mach_init_IRQ = amiga_init_IRQ;
384 mach_init_IRQ = amiga_init_IRQ; 378 mach_get_model = amiga_get_model;
385 mach_get_model = amiga_get_model; 379 mach_get_hardware_list = amiga_get_hardware_list;
386 mach_get_hardware_list = amiga_get_hardware_list; 380 mach_gettimeoffset = amiga_gettimeoffset;
387 mach_gettimeoffset = amiga_gettimeoffset; 381 if (AMIGAHW_PRESENT(A3000_CLK)) {
388 if (AMIGAHW_PRESENT(A3000_CLK)){ 382 mach_hwclk = a3000_hwclk;
389 mach_hwclk = a3000_hwclk; 383 rtc_resource.name = "A3000 RTC";
390 rtc_resource.name = "A3000 RTC"; 384 request_resource(&iomem_resource, &rtc_resource);
391 request_resource(&iomem_resource, &rtc_resource); 385 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
392 } 386 mach_hwclk = a2000_hwclk;
393 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */ 387 rtc_resource.name = "A2000 RTC";
394 mach_hwclk = a2000_hwclk; 388 request_resource(&iomem_resource, &rtc_resource);
395 rtc_resource.name = "A2000 RTC"; 389 }
396 request_resource(&iomem_resource, &rtc_resource); 390
397 } 391 /*
398 392 * default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
399 mach_max_dma_address = 0xffffffff; /* 393 * code will not be able to allocate any mem for transfers, unless we are
400 * default MAX_DMA=0xffffffff 394 * dealing with a Z2 mem only system. /Jes
401 * on all machines. If we don't 395 */
402 * do so, the SCSI code will not 396 mach_max_dma_address = 0xffffffff;
403 * be able to allocate any mem 397
404 * for transfers, unless we are 398 mach_set_clock_mmss = amiga_set_clock_mmss;
405 * dealing with a Z2 mem only 399 mach_get_ss = amiga_get_ss;
406 * system. /Jes 400 mach_reset = amiga_reset;
407 */
408
409 mach_set_clock_mmss = amiga_set_clock_mmss;
410 mach_get_ss = amiga_get_ss;
411 mach_reset = amiga_reset;
412#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 401#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
413 mach_beep = amiga_mksound; 402 mach_beep = amiga_mksound;
414#endif 403#endif
415 404
416#ifdef CONFIG_HEARTBEAT 405#ifdef CONFIG_HEARTBEAT
417 mach_heartbeat = amiga_heartbeat; 406 mach_heartbeat = amiga_heartbeat;
418#endif 407#endif
419 408
420 /* Fill in the clock values (based on the 700 kHz E-Clock) */ 409 /* Fill in the clock values (based on the 700 kHz E-Clock) */
421 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */ 410 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
422 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */ 411 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
423 412
424 /* clear all DMA bits */ 413 /* clear all DMA bits */
425 amiga_custom.dmacon = DMAF_ALL; 414 amiga_custom.dmacon = DMAF_ALL;
426 /* ensure that the DMA master bit is set */ 415 /* ensure that the DMA master bit is set */
427 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER; 416 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
428 417
429 /* don't use Z2 RAM as system memory on Z3 capable machines */ 418 /* don't use Z2 RAM as system memory on Z3 capable machines */
430 if (AMIGAHW_PRESENT(ZORRO3)) { 419 if (AMIGAHW_PRESENT(ZORRO3)) {
431 int i, j; 420 int i, j;
432 u32 disabled_z2mem = 0; 421 u32 disabled_z2mem = 0;
433 for (i = 0; i < m68k_num_memory; i++) 422
434 if (m68k_memory[i].addr < 16*1024*1024) { 423 for (i = 0; i < m68k_num_memory; i++) {
435 if (i == 0) { 424 if (m68k_memory[i].addr < 16*1024*1024) {
436 /* don't cut off the branch we're sitting on */ 425 if (i == 0) {
437 printk("Warning: kernel runs in Zorro II memory\n"); 426 /* don't cut off the branch we're sitting on */
438 continue; 427 printk("Warning: kernel runs in Zorro II memory\n");
428 continue;
429 }
430 disabled_z2mem += m68k_memory[i].size;
431 m68k_num_memory--;
432 for (j = i; j < m68k_num_memory; j++)
433 m68k_memory[j] = m68k_memory[j+1];
434 i--;
435 }
436 }
437 if (disabled_z2mem)
438 printk("%dK of Zorro II memory will not be used as system memory\n",
439 disabled_z2mem>>10);
439 } 440 }
440 disabled_z2mem += m68k_memory[i].size; 441
441 m68k_num_memory--; 442 /* request all RAM */
442 for (j = i; j < m68k_num_memory; j++) 443 for (i = 0; i < m68k_num_memory; i++) {
443 m68k_memory[j] = m68k_memory[j+1]; 444 ram_resource[i].name =
444 i--; 445 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
445 } 446 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
446 if (disabled_z2mem) 447 "16-bit Slow RAM";
447 printk("%dK of Zorro II memory will not be used as system memory\n", 448 ram_resource[i].start = m68k_memory[i].addr;
448 disabled_z2mem>>10); 449 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
449 } 450 request_resource(&iomem_resource, &ram_resource[i]);
450 451 }
451 /* request all RAM */ 452
452 for (i = 0; i < m68k_num_memory; i++) { 453 /* initialize chipram allocator */
453 ram_resource[i].name = 454 amiga_chip_init();
454 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" : 455
455 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" : 456 /* our beloved beeper */
456 "16-bit Slow RAM"; 457 if (AMIGAHW_PRESENT(AMI_AUDIO))
457 ram_resource[i].start = m68k_memory[i].addr; 458 amiga_init_sound();
458 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1; 459
459 request_resource(&iomem_resource, &ram_resource[i]); 460 /*
460 } 461 * if it is an A3000, set the magic bit that forces
461 462 * a hard rekick
462 /* initialize chipram allocator */ 463 */
463 amiga_chip_init (); 464 if (AMIGAHW_PRESENT(MAGIC_REKICK))
464 465 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
465 /* debugging using chipram */
466 if (!strcmp( m68k_debug_device, "mem" )){
467 if (!AMIGAHW_PRESENT(CHIP_RAM))
468 printk("Warning: no chipram present for debugging\n");
469 else {
470 amiga_savekmsg_init();
471 amiga_console_driver.write = amiga_mem_console_write;
472 register_console(&amiga_console_driver);
473 }
474 }
475
476 /* our beloved beeper */
477 if (AMIGAHW_PRESENT(AMI_AUDIO))
478 amiga_init_sound();
479
480 /*
481 * if it is an A3000, set the magic bit that forces
482 * a hard rekick
483 */
484 if (AMIGAHW_PRESENT(MAGIC_REKICK))
485 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
486} 466}
487 467
488static unsigned short jiffy_ticks; 468static unsigned short jiffy_ticks;
@@ -490,12 +470,12 @@ static unsigned short jiffy_ticks;
490static void __init amiga_sched_init(irq_handler_t timer_routine) 470static void __init amiga_sched_init(irq_handler_t timer_routine)
491{ 471{
492 static struct resource sched_res = { 472 static struct resource sched_res = {
493 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff, 473 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
494 }; 474 };
495 jiffy_ticks = (amiga_eclock+HZ/2)/HZ; 475 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
496 476
497 if (request_resource(&mb_resources._ciab, &sched_res)) 477 if (request_resource(&mb_resources._ciab, &sched_res))
498 printk("Cannot allocate ciab.ta{lo,hi}\n"); 478 printk("Cannot allocate ciab.ta{lo,hi}\n");
499 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */ 479 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
500 ciab.talo = jiffy_ticks % 256; 480 ciab.talo = jiffy_ticks % 256;
501 ciab.tahi = jiffy_ticks / 256; 481 ciab.tahi = jiffy_ticks / 256;
@@ -513,7 +493,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
513#define TICK_SIZE 10000 493#define TICK_SIZE 10000
514 494
515/* This is always executed with interrupts disabled. */ 495/* This is always executed with interrupts disabled. */
516static unsigned long amiga_gettimeoffset (void) 496static unsigned long amiga_gettimeoffset(void)
517{ 497{
518 unsigned short hi, lo, hi2; 498 unsigned short hi, lo, hi2;
519 unsigned long ticks, offset = 0; 499 unsigned long ticks, offset = 0;
@@ -585,15 +565,15 @@ static int a2000_hwclk(int op, struct rtc_time *t)
585 565
586 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD; 566 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
587 567
588 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) 568 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
589 { 569 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
590 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; 570 udelay(70);
591 udelay(70); 571 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
592 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
593 } 572 }
594 573
595 if (!cnt) 574 if (!cnt)
596 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1); 575 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n",
576 tod_2000.cntrl1);
597 577
598 if (!op) { /* read */ 578 if (!op) { /* read */
599 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2; 579 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
@@ -606,7 +586,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
606 if (t->tm_year <= 69) 586 if (t->tm_year <= 69)
607 t->tm_year += 100; 587 t->tm_year += 100;
608 588
609 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){ 589 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)) {
610 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12) 590 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
611 t->tm_hour = 0; 591 t->tm_hour = 0;
612 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12) 592 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
@@ -642,7 +622,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
642 return 0; 622 return 0;
643} 623}
644 624
645static int amiga_set_clock_mmss (unsigned long nowtime) 625static int amiga_set_clock_mmss(unsigned long nowtime)
646{ 626{
647 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; 627 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
648 628
@@ -660,8 +640,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
660 640
661 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; 641 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
662 642
663 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) 643 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
664 {
665 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; 644 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
666 udelay(70); 645 udelay(70);
667 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; 646 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
@@ -681,7 +660,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
681 return 0; 660 return 0;
682} 661}
683 662
684static unsigned int amiga_get_ss( void ) 663static unsigned int amiga_get_ss(void)
685{ 664{
686 unsigned int s; 665 unsigned int s;
687 666
@@ -695,71 +674,72 @@ static unsigned int amiga_get_ss( void )
695 return s; 674 return s;
696} 675}
697 676
698static NORET_TYPE void amiga_reset( void ) 677static NORET_TYPE void amiga_reset(void)
699 ATTRIB_NORET; 678 ATTRIB_NORET;
700 679
701static void amiga_reset (void) 680static void amiga_reset(void)
702{ 681{
703 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 682 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
704 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label); 683 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
705 684
706 local_irq_disable(); 685 local_irq_disable();
707 if (CPU_IS_040_OR_060) 686 if (CPU_IS_040_OR_060)
708 /* Setup transparent translation registers for mapping 687 /* Setup transparent translation registers for mapping
709 * of 16 MB kernel segment before disabling translation 688 * of 16 MB kernel segment before disabling translation
710 */ 689 */
711 __asm__ __volatile__ 690 asm volatile ("\n"
712 ("movel %0,%/d0\n\t" 691 " move.l %0,%%d0\n"
713 "andl #0xff000000,%/d0\n\t" 692 " and.l #0xff000000,%%d0\n"
714 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ 693 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
715 ".chip 68040\n\t" 694 " .chip 68040\n"
716 "movec %%d0,%%itt0\n\t" 695 " movec %%d0,%%itt0\n"
717 "movec %%d0,%%dtt0\n\t" 696 " movec %%d0,%%dtt0\n"
718 ".chip 68k\n\t" 697 " .chip 68k\n"
719 "jmp %0@\n\t" 698 " jmp %0@\n"
720 : /* no outputs */ 699 : /* no outputs */
721 : "a" (jmp_addr040)); 700 : "a" (jmp_addr040)
722 else 701 : "d0");
723 /* for 680[23]0, just disable translation and jump to the physical 702 else
724 * address of the label 703 /* for 680[23]0, just disable translation and jump to the physical
725 */ 704 * address of the label
726 __asm__ __volatile__ 705 */
727 ("pmove %/tc,%@\n\t" 706 asm volatile ("\n"
728 "bclr #7,%@\n\t" 707 " pmove %%tc,%@\n"
729 "pmove %@,%/tc\n\t" 708 " bclr #7,%@\n"
730 "jmp %0@\n\t" 709 " pmove %@,%%tc\n"
731 : /* no outputs */ 710 " jmp %0@\n"
732 : "a" (jmp_addr)); 711 : /* no outputs */
733 jmp_addr_label040: 712 : "a" (jmp_addr));
734 /* disable translation on '040 now */ 713jmp_addr_label040:
735 __asm__ __volatile__ 714 /* disable translation on '040 now */
736 ("moveq #0,%/d0\n\t" 715 asm volatile ("\n"
737 ".chip 68040\n\t" 716 " moveq #0,%%d0\n"
738 "movec %%d0,%%tc\n\t" /* disable MMU */ 717 " .chip 68040\n"
739 ".chip 68k\n\t" 718 " movec %%d0,%%tc\n" /* disable MMU */
740 : /* no outputs */ 719 " .chip 68k\n"
741 : /* no inputs */ 720 : /* no outputs */
742 : "d0"); 721 : /* no inputs */
743 722 : "d0");
744 jmp_addr_label: 723
745 /* pickup reset address from AmigaOS ROM, reset devices and jump 724 jmp_addr_label:
746 * to reset address 725 /* pickup reset address from AmigaOS ROM, reset devices and jump
747 */ 726 * to reset address
748 __asm__ __volatile__ 727 */
749 ("movew #0x2700,%/sr\n\t" 728 asm volatile ("\n"
750 "leal 0x01000000,%/a0\n\t" 729 " move.w #0x2700,%sr\n"
751 "subl %/a0@(-0x14),%/a0\n\t" 730 " lea 0x01000000,%a0\n"
752 "movel %/a0@(4),%/a0\n\t" 731 " sub.l %a0@(-0x14),%a0\n"
753 "subql #2,%/a0\n\t" 732 " move.l %a0@(4),%a0\n"
754 "bra 1f\n\t" 733 " subq.l #2,%a0\n"
755 /* align on a longword boundary */ 734 " jra 1f\n"
756 __ALIGN_STR "\n" 735 /* align on a longword boundary */
757 "1:\n\t" 736 " " __ALIGN_STR "\n"
758 "reset\n\t" 737 "1:\n"
759 "jmp %/a0@" : /* Just that gcc scans it for % escapes */ ); 738 " reset\n"
760 739 " jmp %a0@");
761 for (;;); 740
762 741 for (;;)
742 ;
763} 743}
764 744
765 745
@@ -773,11 +753,11 @@ static void amiga_reset (void)
773#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */ 753#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
774 754
775struct savekmsg { 755struct savekmsg {
776 unsigned long magic1; /* SAVEKMSG_MAGIC1 */ 756 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
777 unsigned long magic2; /* SAVEKMSG_MAGIC2 */ 757 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
778 unsigned long magicptr; /* address of magic1 */ 758 unsigned long magicptr; /* address of magic1 */
779 unsigned long size; 759 unsigned long size;
780 char data[0]; 760 char data[0];
781}; 761};
782 762
783static struct savekmsg *savekmsg; 763static struct savekmsg *savekmsg;
@@ -785,113 +765,132 @@ static struct savekmsg *savekmsg;
785static void amiga_mem_console_write(struct console *co, const char *s, 765static void amiga_mem_console_write(struct console *co, const char *s,
786 unsigned int count) 766 unsigned int count)
787{ 767{
788 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) { 768 if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
789 memcpy(savekmsg->data+savekmsg->size, s, count); 769 memcpy(savekmsg->data + savekmsg->size, s, count);
790 savekmsg->size += count; 770 savekmsg->size += count;
791 } 771 }
792} 772}
793 773
794static void amiga_savekmsg_init(void) 774static int __init amiga_savekmsg_setup(char *arg)
795{ 775{
796 static struct resource debug_res = { .name = "Debug" }; 776 static struct resource debug_res = { .name = "Debug" };
777
778 if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
779 goto done;
780
781 if (!AMIGAHW_PRESENT(CHIP_RAM)) {
782 printk("Warning: no chipram present for debugging\n");
783 goto done;
784 }
797 785
798 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res); 786 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
799 savekmsg->magic1 = SAVEKMSG_MAGIC1; 787 savekmsg->magic1 = SAVEKMSG_MAGIC1;
800 savekmsg->magic2 = SAVEKMSG_MAGIC2; 788 savekmsg->magic2 = SAVEKMSG_MAGIC2;
801 savekmsg->magicptr = ZTWO_PADDR(savekmsg); 789 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
802 savekmsg->size = 0; 790 savekmsg->size = 0;
791
792 amiga_console_driver.write = amiga_mem_console_write;
793 register_console(&amiga_console_driver);
794
795done:
796 return 0;
803} 797}
804 798
799early_param("debug", amiga_savekmsg_setup);
800
805static void amiga_serial_putc(char c) 801static void amiga_serial_putc(char c)
806{ 802{
807 amiga_custom.serdat = (unsigned char)c | 0x100; 803 amiga_custom.serdat = (unsigned char)c | 0x100;
808 while (!(amiga_custom.serdatr & 0x2000)) 804 while (!(amiga_custom.serdatr & 0x2000))
809 ; 805 ;
810} 806}
811 807
812void amiga_serial_console_write(struct console *co, const char *s, 808void amiga_serial_console_write(struct console *co, const char *s,
813 unsigned int count) 809 unsigned int count)
814{ 810{
815 while (count--) { 811 while (count--) {
816 if (*s == '\n') 812 if (*s == '\n')
817 amiga_serial_putc('\r'); 813 amiga_serial_putc('\r');
818 amiga_serial_putc(*s++); 814 amiga_serial_putc(*s++);
819 } 815 }
820} 816}
821 817
822#ifdef CONFIG_SERIAL_CONSOLE 818#ifdef CONFIG_SERIAL_CONSOLE
823void amiga_serial_puts(const char *s) 819void amiga_serial_puts(const char *s)
824{ 820{
825 amiga_serial_console_write(NULL, s, strlen(s)); 821 amiga_serial_console_write(NULL, s, strlen(s));
826} 822}
827 823
828int amiga_serial_console_wait_key(struct console *co) 824int amiga_serial_console_wait_key(struct console *co)
829{ 825{
830 int ch; 826 int ch;
831 827
832 while (!(amiga_custom.intreqr & IF_RBF)) 828 while (!(amiga_custom.intreqr & IF_RBF))
833 barrier(); 829 barrier();
834 ch = amiga_custom.serdatr & 0xff; 830 ch = amiga_custom.serdatr & 0xff;
835 /* clear the interrupt, so that another character can be read */ 831 /* clear the interrupt, so that another character can be read */
836 amiga_custom.intreq = IF_RBF; 832 amiga_custom.intreq = IF_RBF;
837 return ch; 833 return ch;
838} 834}
839 835
840void amiga_serial_gets(struct console *co, char *s, int len) 836void amiga_serial_gets(struct console *co, char *s, int len)
841{ 837{
842 int ch, cnt = 0; 838 int ch, cnt = 0;
843 839
844 while (1) { 840 while (1) {
845 ch = amiga_serial_console_wait_key(co); 841 ch = amiga_serial_console_wait_key(co);
846 842
847 /* Check for backspace. */ 843 /* Check for backspace. */
848 if (ch == 8 || ch == 127) { 844 if (ch == 8 || ch == 127) {
849 if (cnt == 0) { 845 if (cnt == 0) {
850 amiga_serial_putc('\007'); 846 amiga_serial_putc('\007');
851 continue; 847 continue;
852 } 848 }
853 cnt--; 849 cnt--;
854 amiga_serial_puts("\010 \010"); 850 amiga_serial_puts("\010 \010");
855 continue; 851 continue;
856 } 852 }
857 853
858 /* Check for enter. */ 854 /* Check for enter. */
859 if (ch == 10 || ch == 13) 855 if (ch == 10 || ch == 13)
860 break; 856 break;
861 857
862 /* See if line is too long. */ 858 /* See if line is too long. */
863 if (cnt >= len + 1) { 859 if (cnt >= len + 1) {
864 amiga_serial_putc(7); 860 amiga_serial_putc(7);
865 cnt--; 861 cnt--;
866 continue; 862 continue;
867 } 863 }
868 864
869 /* Store and echo character. */ 865 /* Store and echo character. */
870 s[cnt++] = ch; 866 s[cnt++] = ch;
871 amiga_serial_putc(ch); 867 amiga_serial_putc(ch);
872 } 868 }
873 /* Print enter. */ 869 /* Print enter. */
874 amiga_serial_puts("\r\n"); 870 amiga_serial_puts("\r\n");
875 s[cnt] = 0; 871 s[cnt] = 0;
876} 872}
877#endif 873#endif
878 874
879static void __init amiga_debug_init(void) 875static int __init amiga_debug_setup(char *arg)
880{ 876{
881 if (!strcmp( m68k_debug_device, "ser" )) { 877 if (MACH_IS_AMIGA && !strcmp(arg, "ser")) {
882 /* no initialization required (?) */ 878 /* no initialization required (?) */
883 amiga_console_driver.write = amiga_serial_console_write; 879 amiga_console_driver.write = amiga_serial_console_write;
884 register_console(&amiga_console_driver); 880 register_console(&amiga_console_driver);
885 } 881 }
882 return 0;
886} 883}
887 884
885early_param("debug", amiga_debug_setup);
886
888#ifdef CONFIG_HEARTBEAT 887#ifdef CONFIG_HEARTBEAT
889static void amiga_heartbeat(int on) 888static void amiga_heartbeat(int on)
890{ 889{
891 if (on) 890 if (on)
892 ciaa.pra &= ~2; 891 ciaa.pra &= ~2;
893 else 892 else
894 ciaa.pra |= 2; 893 ciaa.pra |= 2;
895} 894}
896#endif 895#endif
897 896
@@ -901,81 +900,81 @@ static void amiga_heartbeat(int on)
901 900
902static void amiga_get_model(char *model) 901static void amiga_get_model(char *model)
903{ 902{
904 strcpy(model, amiga_model_name); 903 strcpy(model, amiga_model_name);
905} 904}
906 905
907 906
908static int amiga_get_hardware_list(char *buffer) 907static int amiga_get_hardware_list(char *buffer)
909{ 908{
910 int len = 0; 909 int len = 0;
911 910
912 if (AMIGAHW_PRESENT(CHIP_RAM)) 911 if (AMIGAHW_PRESENT(CHIP_RAM))
913 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10); 912 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
914 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n", 913 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
915 amiga_psfreq, amiga_eclock); 914 amiga_psfreq, amiga_eclock);
916 if (AMIGAHW_PRESENT(AMI_VIDEO)) { 915 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
917 char *type; 916 char *type;
918 switch(amiga_chipset) { 917 switch (amiga_chipset) {
919 case CS_OCS: 918 case CS_OCS:
920 type = "OCS"; 919 type = "OCS";
921 break; 920 break;
922 case CS_ECS: 921 case CS_ECS:
923 type = "ECS"; 922 type = "ECS";
924 break; 923 break;
925 case CS_AGA: 924 case CS_AGA:
926 type = "AGA"; 925 type = "AGA";
927 break; 926 break;
928 default: 927 default:
929 type = "Old or Unknown"; 928 type = "Old or Unknown";
930 break; 929 break;
930 }
931 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
931 } 932 }
932 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
933 }
934 933
935#define AMIGAHW_ANNOUNCE(name, str) \ 934#define AMIGAHW_ANNOUNCE(name, str) \
936 if (AMIGAHW_PRESENT(name)) \ 935 if (AMIGAHW_PRESENT(name)) \
937 len += sprintf (buffer+len, "\t%s\n", str) 936 len += sprintf (buffer+len, "\t%s\n", str)
938 937
939 len += sprintf (buffer + len, "Detected hardware:\n"); 938 len += sprintf (buffer + len, "Detected hardware:\n");
940 939
941 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video"); 940 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
942 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter"); 941 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
943 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer"); 942 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
944 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio"); 943 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
945 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller"); 944 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
946 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)"); 945 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
947 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)"); 946 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
948 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)"); 947 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
949 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)"); 948 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
950 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive"); 949 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
951 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard"); 950 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
952 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port"); 951 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
953 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port"); 952 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
954 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port"); 953 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
955 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)"); 954 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
956 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)"); 955 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
957 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM"); 956 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
958 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364"); 957 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
959 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362"); 958 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
960 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373"); 959 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
961 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375"); 960 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
962 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371"); 961 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
963 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370"); 962 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
964 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372"); 963 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
965 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372"); 964 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
966 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374"); 965 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
967 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374"); 966 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
968 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick"); 967 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
969 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot"); 968 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
970#ifdef CONFIG_ZORRO 969#ifdef CONFIG_ZORRO
971 if (AMIGAHW_PRESENT(ZORRO)) 970 if (AMIGAHW_PRESENT(ZORRO))
972 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion " 971 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
973 "Device%s\n", 972 "Device%s\n",
974 AMIGAHW_PRESENT(ZORRO3) ? "I" : "", 973 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
975 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s"); 974 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
976#endif /* CONFIG_ZORRO */ 975#endif /* CONFIG_ZORRO */
977 976
978#undef AMIGAHW_ANNOUNCE 977#undef AMIGAHW_ANNOUNCE
979 978
980 return(len); 979 return len;
981} 980}
diff --git a/arch/m68k/atari/Makefile b/arch/m68k/atari/Makefile
index 8cb6236b39db..2cb86191f0aa 100644
--- a/arch/m68k/atari/Makefile
+++ b/arch/m68k/atari/Makefile
@@ -8,3 +8,4 @@ obj-y := config.o time.o debug.o ataints.o stdma.o \
8ifeq ($(CONFIG_PCI),y) 8ifeq ($(CONFIG_PCI),y)
9obj-$(CONFIG_HADES) += hades-pci.o 9obj-$(CONFIG_HADES) += hades-pci.o
10endif 10endif
11obj-$(CONFIG_ATARI_KBD_CORE) += atakeyb.o
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
new file mode 100644
index 000000000000..1c29603b16b3
--- /dev/null
+++ b/arch/m68k/atari/atakeyb.c
@@ -0,0 +1,730 @@
1/*
2 * linux/atari/atakeyb.c
3 *
4 * Atari Keyboard driver for 680x0 Linux
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11/*
12 * Atari support by Robert de Vries
13 * enhanced by Bjoern Brauel and Roman Hodek
14 */
15
16#include <linux/sched.h>
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/errno.h>
20#include <linux/keyboard.h>
21#include <linux/delay.h>
22#include <linux/timer.h>
23#include <linux/kd.h>
24#include <linux/random.h>
25#include <linux/init.h>
26#include <linux/kbd_kern.h>
27
28#include <asm/atariints.h>
29#include <asm/atarihw.h>
30#include <asm/atarikb.h>
31#include <asm/atari_joystick.h>
32#include <asm/irq.h>
33
34static void atakeyb_rep(unsigned long ignore);
35extern unsigned int keymap_count;
36
37/* Hook for MIDI serial driver */
38void (*atari_MIDI_interrupt_hook) (void);
39/* Hook for mouse driver */
40void (*atari_mouse_interrupt_hook) (char *);
41/* Hook for keyboard inputdev driver */
42void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
43/* Hook for mouse inputdev driver */
44void (*atari_input_mouse_interrupt_hook) (char *);
45
46/* variables for IKBD self test: */
47
48/* state: 0: off; >0: in progress; >1: 0xf1 received */
49static volatile int ikbd_self_test;
50/* timestamp when last received a char */
51static volatile unsigned long self_test_last_rcv;
52/* bitmap of keys reported as broken */
53static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, };
54
55#define BREAK_MASK (0x80)
56
57/*
58 * ++roman: The following changes were applied manually:
59 *
60 * - The Alt (= Meta) key works in combination with Shift and
61 * Control, e.g. Alt+Shift+a sends Meta-A (0xc1), Alt+Control+A sends
62 * Meta-Ctrl-A (0x81) ...
63 *
64 * - The parentheses on the keypad send '(' and ')' with all
65 * modifiers (as would do e.g. keypad '+'), but they cannot be used as
66 * application keys (i.e. sending Esc O c).
67 *
68 * - HELP and UNDO are mapped to be F21 and F24, resp, that send the
69 * codes "\E[M" and "\E[P". (This is better than the old mapping to
70 * F11 and F12, because these codes are on Shift+F1/2 anyway.) This
71 * way, applications that allow their own keyboard mappings
72 * (e.g. tcsh, X Windows) can be configured to use them in the way
73 * the label suggests (providing help or undoing).
74 *
75 * - Console switching is done with Alt+Fx (consoles 1..10) and
76 * Shift+Alt+Fx (consoles 11..20).
77 *
78 * - The misc. special function implemented in the kernel are mapped
79 * to the following key combinations:
80 *
81 * ClrHome -> Home/Find
82 * Shift + ClrHome -> End/Select
83 * Shift + Up -> Page Up
84 * Shift + Down -> Page Down
85 * Alt + Help -> show system status
86 * Shift + Help -> show memory info
87 * Ctrl + Help -> show registers
88 * Ctrl + Alt + Del -> Reboot
89 * Alt + Undo -> switch to last console
90 * Shift + Undo -> send interrupt
91 * Alt + Insert -> stop/start output (same as ^S/^Q)
92 * Alt + Up -> Scroll back console (if implemented)
93 * Alt + Down -> Scroll forward console (if implemented)
94 * Alt + CapsLock -> NumLock
95 *
96 * ++Andreas:
97 *
98 * - Help mapped to K_HELP
99 * - Undo mapped to K_UNDO (= K_F246)
100 * - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
101 */
102
103static u_short ataplain_map[NR_KEYS] __initdata = {
104 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
105 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
106 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
107 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
108 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
109 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
110 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200,
111 0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
112 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
113 0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
114 0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
115 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
116 0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
117 0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
118 0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
119 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
120};
121
122typedef enum kb_state_t {
123 KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC
124} KB_STATE_T;
125
126#define IS_SYNC_CODE(sc) ((sc) >= 0x04 && (sc) <= 0xfb)
127
128typedef struct keyboard_state {
129 unsigned char buf[6];
130 int len;
131 KB_STATE_T state;
132} KEYBOARD_STATE;
133
134KEYBOARD_STATE kb_state;
135
136#define DEFAULT_KEYB_REP_DELAY (HZ/4)
137#define DEFAULT_KEYB_REP_RATE (HZ/25)
138
139/* These could be settable by some ioctl() in future... */
140static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY;
141static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
142
143static unsigned char rep_scancode;
144static struct timer_list atakeyb_rep_timer = {
145 .function = atakeyb_rep,
146};
147
148static void atakeyb_rep(unsigned long ignore)
149{
150 /* Disable keyboard for the time we call handle_scancode(), else a race
151 * in the keyboard tty queue may happen */
152 atari_disable_irq(IRQ_MFP_ACIA);
153 del_timer(&atakeyb_rep_timer);
154
155 /* A keyboard int may have come in before we disabled the irq, so
156 * double-check whether rep_scancode is still != 0 */
157 if (rep_scancode) {
158 init_timer(&atakeyb_rep_timer);
159 atakeyb_rep_timer.expires = jiffies + key_repeat_rate;
160 add_timer(&atakeyb_rep_timer);
161
162 //handle_scancode(rep_scancode, 1);
163 if (atari_input_keyboard_interrupt_hook)
164 atari_input_keyboard_interrupt_hook(rep_scancode, 1);
165 }
166
167 atari_enable_irq(IRQ_MFP_ACIA);
168}
169
170
171/* ++roman: If a keyboard overrun happened, we can't tell in general how much
172 * bytes have been lost and in which state of the packet structure we are now.
173 * This usually causes keyboards bytes to be interpreted as mouse movements
174 * and vice versa, which is very annoying. It seems better to throw away some
175 * bytes (that are usually mouse bytes) than to misinterpret them. Therefor I
176 * introduced the RESYNC state for IKBD data. In this state, the bytes up to
177 * one that really looks like a key event (0x04..0xf2) or the start of a mouse
178 * packet (0xf8..0xfb) are thrown away, but at most 2 bytes. This at least
179 * speeds up the resynchronization of the event structure, even if maybe a
180 * mouse movement is lost. However, nothing is perfect. For bytes 0x01..0x03,
181 * it's really hard to decide whether they're mouse or keyboard bytes. Since
182 * overruns usually occur when moving the Atari mouse rapidly, they're seen as
183 * mouse bytes here. If this is wrong, only a make code of the keyboard gets
184 * lost, which isn't too bad. Loosing a break code would be disastrous,
185 * because then the keyboard repeat strikes...
186 */
187
188static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
189{
190 u_char acia_stat;
191 int scancode;
192 int break_flag;
193
194repeat:
195 if (acia.mid_ctrl & ACIA_IRQ)
196 if (atari_MIDI_interrupt_hook)
197 atari_MIDI_interrupt_hook();
198 acia_stat = acia.key_ctrl;
199 /* check out if the interrupt came from this ACIA */
200 if (!((acia_stat | acia.mid_ctrl) & ACIA_IRQ))
201 return IRQ_HANDLED;
202
203 if (acia_stat & ACIA_OVRN) {
204 /* a very fast typist or a slow system, give a warning */
205 /* ...happens often if interrupts were disabled for too long */
206 printk(KERN_DEBUG "Keyboard overrun\n");
207 scancode = acia.key_data;
208 /* Turn off autorepeating in case a break code has been lost */
209 del_timer(&atakeyb_rep_timer);
210 rep_scancode = 0;
211 if (ikbd_self_test)
212 /* During self test, don't do resyncing, just process the code */
213 goto interpret_scancode;
214 else if (IS_SYNC_CODE(scancode)) {
215 /* This code seem already to be the start of a new packet or a
216 * single scancode */
217 kb_state.state = KEYBOARD;
218 goto interpret_scancode;
219 } else {
220 /* Go to RESYNC state and skip this byte */
221 kb_state.state = RESYNC;
222 kb_state.len = 1; /* skip max. 1 another byte */
223 goto repeat;
224 }
225 }
226
227 if (acia_stat & ACIA_RDRF) {
228 /* received a character */
229 scancode = acia.key_data; /* get it or reset the ACIA, I'll get it! */
230 tasklet_schedule(&keyboard_tasklet);
231 interpret_scancode:
232 switch (kb_state.state) {
233 case KEYBOARD:
234 switch (scancode) {
235 case 0xF7:
236 kb_state.state = AMOUSE;
237 kb_state.len = 0;
238 break;
239
240 case 0xF8:
241 case 0xF9:
242 case 0xFA:
243 case 0xFB:
244 kb_state.state = RMOUSE;
245 kb_state.len = 1;
246 kb_state.buf[0] = scancode;
247 break;
248
249 case 0xFC:
250 kb_state.state = CLOCK;
251 kb_state.len = 0;
252 break;
253
254 case 0xFE:
255 case 0xFF:
256 kb_state.state = JOYSTICK;
257 kb_state.len = 1;
258 kb_state.buf[0] = scancode;
259 break;
260
261 case 0xF1:
262 /* during self-test, note that 0xf1 received */
263 if (ikbd_self_test) {
264 ++ikbd_self_test;
265 self_test_last_rcv = jiffies;
266 break;
267 }
268 /* FALL THROUGH */
269
270 default:
271 break_flag = scancode & BREAK_MASK;
272 scancode &= ~BREAK_MASK;
273 if (ikbd_self_test) {
274 /* Scancodes sent during the self-test stand for broken
275 * keys (keys being down). The code *should* be a break
276 * code, but nevertheless some AT keyboard interfaces send
277 * make codes instead. Therefore, simply ignore
278 * break_flag...
279 */
280 int keyval = plain_map[scancode], keytyp;
281
282 set_bit(scancode, broken_keys);
283 self_test_last_rcv = jiffies;
284 keyval = plain_map[scancode];
285 keytyp = KTYP(keyval) - 0xf0;
286 keyval = KVAL(keyval);
287
288 printk(KERN_WARNING "Key with scancode %d ", scancode);
289 if (keytyp == KT_LATIN || keytyp == KT_LETTER) {
290 if (keyval < ' ')
291 printk("('^%c') ", keyval + '@');
292 else
293 printk("('%c') ", keyval);
294 }
295 printk("is broken -- will be ignored.\n");
296 break;
297 } else if (test_bit(scancode, broken_keys))
298 break;
299
300#if 0 // FIXME; hangs at boot
301 if (break_flag) {
302 del_timer(&atakeyb_rep_timer);
303 rep_scancode = 0;
304 } else {
305 del_timer(&atakeyb_rep_timer);
306 rep_scancode = scancode;
307 atakeyb_rep_timer.expires = jiffies + key_repeat_delay;
308 add_timer(&atakeyb_rep_timer);
309 }
310#endif
311
312 // handle_scancode(scancode, !break_flag);
313 if (atari_input_keyboard_interrupt_hook)
314 atari_input_keyboard_interrupt_hook((unsigned char)scancode, !break_flag);
315 break;
316 }
317 break;
318
319 case AMOUSE:
320 kb_state.buf[kb_state.len++] = scancode;
321 if (kb_state.len == 5) {
322 kb_state.state = KEYBOARD;
323 /* not yet used */
324 /* wake up someone waiting for this */
325 }
326 break;
327
328 case RMOUSE:
329 kb_state.buf[kb_state.len++] = scancode;
330 if (kb_state.len == 3) {
331 kb_state.state = KEYBOARD;
332 if (atari_mouse_interrupt_hook)
333 atari_mouse_interrupt_hook(kb_state.buf);
334 }
335 break;
336
337 case JOYSTICK:
338 kb_state.buf[1] = scancode;
339 kb_state.state = KEYBOARD;
340#ifdef FIXED_ATARI_JOYSTICK
341 atari_joystick_interrupt(kb_state.buf);
342#endif
343 break;
344
345 case CLOCK:
346 kb_state.buf[kb_state.len++] = scancode;
347 if (kb_state.len == 6) {
348 kb_state.state = KEYBOARD;
349 /* wake up someone waiting for this.
350 But will this ever be used, as Linux keeps its own time.
351 Perhaps for synchronization purposes? */
352 /* wake_up_interruptible(&clock_wait); */
353 }
354 break;
355
356 case RESYNC:
357 if (kb_state.len <= 0 || IS_SYNC_CODE(scancode)) {
358 kb_state.state = KEYBOARD;
359 goto interpret_scancode;
360 }
361 kb_state.len--;
362 break;
363 }
364 }
365
366#if 0
367 if (acia_stat & ACIA_CTS)
368 /* cannot happen */;
369#endif
370
371 if (acia_stat & (ACIA_FE | ACIA_PE)) {
372 printk("Error in keyboard communication\n");
373 }
374
375 /* handle_scancode() can take a lot of time, so check again if
376 * some character arrived
377 */
378 goto repeat;
379}
380
381/*
382 * I write to the keyboard without using interrupts, I poll instead.
383 * This takes for the maximum length string allowed (7) at 7812.5 baud
384 * 8 data 1 start 1 stop bit: 9.0 ms
385 * If this takes too long for normal operation, interrupt driven writing
386 * is the solution. (I made a feeble attempt in that direction but I
387 * kept it simple for now.)
388 */
389void ikbd_write(const char *str, int len)
390{
391 u_char acia_stat;
392
393 if ((len < 1) || (len > 7))
394 panic("ikbd: maximum string length exceeded");
395 while (len) {
396 acia_stat = acia.key_ctrl;
397 if (acia_stat & ACIA_TDRE) {
398 acia.key_data = *str++;
399 len--;
400 }
401 }
402}
403
404/* Reset (without touching the clock) */
405void ikbd_reset(void)
406{
407 static const char cmd[2] = { 0x80, 0x01 };
408
409 ikbd_write(cmd, 2);
410
411 /*
412 * if all's well code 0xF1 is returned, else the break codes of
413 * all keys making contact
414 */
415}
416
417/* Set mouse button action */
418void ikbd_mouse_button_action(int mode)
419{
420 char cmd[2] = { 0x07, mode };
421
422 ikbd_write(cmd, 2);
423}
424
425/* Set relative mouse position reporting */
426void ikbd_mouse_rel_pos(void)
427{
428 static const char cmd[1] = { 0x08 };
429
430 ikbd_write(cmd, 1);
431}
432
433/* Set absolute mouse position reporting */
434void ikbd_mouse_abs_pos(int xmax, int ymax)
435{
436 char cmd[5] = { 0x09, xmax>>8, xmax&0xFF, ymax>>8, ymax&0xFF };
437
438 ikbd_write(cmd, 5);
439}
440
441/* Set mouse keycode mode */
442void ikbd_mouse_kbd_mode(int dx, int dy)
443{
444 char cmd[3] = { 0x0A, dx, dy };
445
446 ikbd_write(cmd, 3);
447}
448
449/* Set mouse threshold */
450void ikbd_mouse_thresh(int x, int y)
451{
452 char cmd[3] = { 0x0B, x, y };
453
454 ikbd_write(cmd, 3);
455}
456
457/* Set mouse scale */
458void ikbd_mouse_scale(int x, int y)
459{
460 char cmd[3] = { 0x0C, x, y };
461
462 ikbd_write(cmd, 3);
463}
464
465/* Interrogate mouse position */
466void ikbd_mouse_pos_get(int *x, int *y)
467{
468 static const char cmd[1] = { 0x0D };
469
470 ikbd_write(cmd, 1);
471
472 /* wait for returning bytes */
473}
474
475/* Load mouse position */
476void ikbd_mouse_pos_set(int x, int y)
477{
478 char cmd[6] = { 0x0E, 0x00, x>>8, x&0xFF, y>>8, y&0xFF };
479
480 ikbd_write(cmd, 6);
481}
482
483/* Set Y=0 at bottom */
484void ikbd_mouse_y0_bot(void)
485{
486 static const char cmd[1] = { 0x0F };
487
488 ikbd_write(cmd, 1);
489}
490
491/* Set Y=0 at top */
492void ikbd_mouse_y0_top(void)
493{
494 static const char cmd[1] = { 0x10 };
495
496 ikbd_write(cmd, 1);
497}
498
499/* Resume */
500void ikbd_resume(void)
501{
502 static const char cmd[1] = { 0x11 };
503
504 ikbd_write(cmd, 1);
505}
506
507/* Disable mouse */
508void ikbd_mouse_disable(void)
509{
510 static const char cmd[1] = { 0x12 };
511
512 ikbd_write(cmd, 1);
513}
514
515/* Pause output */
516void ikbd_pause(void)
517{
518 static const char cmd[1] = { 0x13 };
519
520 ikbd_write(cmd, 1);
521}
522
523/* Set joystick event reporting */
524void ikbd_joystick_event_on(void)
525{
526 static const char cmd[1] = { 0x14 };
527
528 ikbd_write(cmd, 1);
529}
530
531/* Set joystick interrogation mode */
532void ikbd_joystick_event_off(void)
533{
534 static const char cmd[1] = { 0x15 };
535
536 ikbd_write(cmd, 1);
537}
538
539/* Joystick interrogation */
540void ikbd_joystick_get_state(void)
541{
542 static const char cmd[1] = { 0x16 };
543
544 ikbd_write(cmd, 1);
545}
546
547#if 0
548/* This disables all other ikbd activities !!!! */
549/* Set joystick monitoring */
550void ikbd_joystick_monitor(int rate)
551{
552 static const char cmd[2] = { 0x17, rate };
553
554 ikbd_write(cmd, 2);
555
556 kb_state.state = JOYSTICK_MONITOR;
557}
558#endif
559
560/* some joystick routines not in yet (0x18-0x19) */
561
562/* Disable joysticks */
563void ikbd_joystick_disable(void)
564{
565 static const char cmd[1] = { 0x1A };
566
567 ikbd_write(cmd, 1);
568}
569
570/* Time-of-day clock set */
571void ikbd_clock_set(int year, int month, int day, int hour, int minute, int second)
572{
573 char cmd[7] = { 0x1B, year, month, day, hour, minute, second };
574
575 ikbd_write(cmd, 7);
576}
577
578/* Interrogate time-of-day clock */
579void ikbd_clock_get(int *year, int *month, int *day, int *hour, int *minute, int second)
580{
581 static const char cmd[1] = { 0x1C };
582
583 ikbd_write(cmd, 1);
584}
585
586/* Memory load */
587void ikbd_mem_write(int address, int size, char *data)
588{
589 panic("Attempt to write data into keyboard memory");
590}
591
592/* Memory read */
593void ikbd_mem_read(int address, char data[6])
594{
595 char cmd[3] = { 0x21, address>>8, address&0xFF };
596
597 ikbd_write(cmd, 3);
598
599 /* receive data and put it in data */
600}
601
602/* Controller execute */
603void ikbd_exec(int address)
604{
605 char cmd[3] = { 0x22, address>>8, address&0xFF };
606
607 ikbd_write(cmd, 3);
608}
609
610/* Status inquiries (0x87-0x9A) not yet implemented */
611
612/* Set the state of the caps lock led. */
613void atari_kbd_leds(unsigned int leds)
614{
615 char cmd[6] = {32, 0, 4, 1, 254 + ((leds & 4) != 0), 0};
616
617 ikbd_write(cmd, 6);
618}
619
620/*
621 * The original code sometimes left the interrupt line of
622 * the ACIAs low forever. I hope, it is fixed now.
623 *
624 * Martin Rogge, 20 Aug 1995
625 */
626
627static int atari_keyb_done = 0;
628
629int __init atari_keyb_init(void)
630{
631 if (atari_keyb_done)
632 return 0;
633
634 /* setup key map */
635 memcpy(key_maps[0], ataplain_map, sizeof(plain_map));
636
637 kb_state.state = KEYBOARD;
638 kb_state.len = 0;
639
640 request_irq(IRQ_MFP_ACIA, atari_keyboard_interrupt, IRQ_TYPE_SLOW,
641 "keyboard/mouse/MIDI", atari_keyboard_interrupt);
642
643 atari_turnoff_irq(IRQ_MFP_ACIA);
644 do {
645 /* reset IKBD ACIA */
646 acia.key_ctrl = ACIA_RESET |
647 (atari_switches & ATARI_SWITCH_IKBD) ? ACIA_RHTID : 0;
648 (void)acia.key_ctrl;
649 (void)acia.key_data;
650
651 /* reset MIDI ACIA */
652 acia.mid_ctrl = ACIA_RESET |
653 (atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
654 (void)acia.mid_ctrl;
655 (void)acia.mid_data;
656
657 /* divide 500kHz by 64 gives 7812.5 baud */
658 /* 8 data no parity 1 start 1 stop bit */
659 /* receive interrupt enabled */
660 /* RTS low (except if switch selected), transmit interrupt disabled */
661 acia.key_ctrl = (ACIA_DIV64|ACIA_D8N1S|ACIA_RIE) |
662 ((atari_switches & ATARI_SWITCH_IKBD) ?
663 ACIA_RHTID : ACIA_RLTID);
664
665 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S |
666 (atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
667
668 /* make sure the interrupt line is up */
669 } while ((mfp.par_dt_reg & 0x10) == 0);
670
671 /* enable ACIA Interrupts */
672 mfp.active_edge &= ~0x10;
673 atari_turnon_irq(IRQ_MFP_ACIA);
674
675 ikbd_self_test = 1;
676 ikbd_reset();
677 /* wait for a period of inactivity (here: 0.25s), then assume the IKBD's
678 * self-test is finished */
679 self_test_last_rcv = jiffies;
680 while (time_before(jiffies, self_test_last_rcv + HZ/4))
681 barrier();
682 /* if not incremented: no 0xf1 received */
683 if (ikbd_self_test == 1)
684 printk(KERN_ERR "WARNING: keyboard self test failed!\n");
685 ikbd_self_test = 0;
686
687 ikbd_mouse_disable();
688 ikbd_joystick_disable();
689
690#ifdef FIXED_ATARI_JOYSTICK
691 atari_joystick_init();
692#endif
693
694 // flag init done
695 atari_keyb_done = 1;
696 return 0;
697}
698
699
700int atari_kbdrate(struct kbd_repeat *k)
701{
702 if (k->delay > 0) {
703 /* convert from msec to jiffies */
704 key_repeat_delay = (k->delay * HZ + 500) / 1000;
705 if (key_repeat_delay < 1)
706 key_repeat_delay = 1;
707 }
708 if (k->period > 0) {
709 key_repeat_rate = (k->period * HZ + 500) / 1000;
710 if (key_repeat_rate < 1)
711 key_repeat_rate = 1;
712 }
713
714 k->delay = key_repeat_delay * 1000 / HZ;
715 k->period = key_repeat_rate * 1000 / HZ;
716
717 return 0;
718}
719
720int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
721{
722#ifdef CONFIG_MAGIC_SYSRQ
723 /* ALT+HELP pressed? */
724 if ((keycode == 98) && ((shift_state & 0xff) == 8))
725 *keycodep = 0xff;
726 else
727#endif
728 *keycodep = keycode;
729 return 1;
730}
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index ca5cd4344e3d..e40e5dcaa347 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -50,70 +50,25 @@ int atari_dont_touch_floppy_select;
50int atari_rtc_year_offset; 50int atari_rtc_year_offset;
51 51
52/* local function prototypes */ 52/* local function prototypes */
53static void atari_reset( void ); 53static void atari_reset(void);
54static void atari_get_model(char *model); 54static void atari_get_model(char *model);
55static int atari_get_hardware_list(char *buffer); 55static int atari_get_hardware_list(char *buffer);
56 56
57/* atari specific irq functions */ 57/* atari specific irq functions */
58extern void atari_init_IRQ (void); 58extern void atari_init_IRQ (void);
59extern void atari_mksound( unsigned int count, unsigned int ticks ); 59extern void atari_mksound(unsigned int count, unsigned int ticks);
60#ifdef CONFIG_HEARTBEAT 60#ifdef CONFIG_HEARTBEAT
61static void atari_heartbeat( int on ); 61static void atari_heartbeat(int on);
62#endif 62#endif
63 63
64/* atari specific timer functions (in time.c) */ 64/* atari specific timer functions (in time.c) */
65extern void atari_sched_init(irq_handler_t ); 65extern void atari_sched_init(irq_handler_t);
66extern unsigned long atari_gettimeoffset (void); 66extern unsigned long atari_gettimeoffset (void);
67extern int atari_mste_hwclk (int, struct rtc_time *); 67extern int atari_mste_hwclk (int, struct rtc_time *);
68extern int atari_tt_hwclk (int, struct rtc_time *); 68extern int atari_tt_hwclk (int, struct rtc_time *);
69extern int atari_mste_set_clock_mmss (unsigned long); 69extern int atari_mste_set_clock_mmss (unsigned long);
70extern int atari_tt_set_clock_mmss (unsigned long); 70extern int atari_tt_set_clock_mmss (unsigned long);
71 71
72/* atari specific debug functions (in debug.c) */
73extern void atari_debug_init(void);
74
75
76/* I've moved hwreg_present() and hwreg_present_bywrite() out into
77 * mm/hwtest.c, to avoid having multiple copies of the same routine
78 * in the kernel [I wanted them in hp300 and they were already used
79 * in the nubus code. NB: I don't have an Atari so this might (just
80 * conceivably) break something.
81 * I've preserved the #if 0 version of hwreg_present_bywrite() here
82 * for posterity.
83 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998
84 */
85
86#if 0
87static int __init
88hwreg_present_bywrite(volatile void *regp, unsigned char val)
89{
90 int ret;
91 long save_sp, save_vbr;
92 static long tmp_vectors[3] = { [2] = (long)&&after_test };
93
94 __asm__ __volatile__
95 ( "movec %/vbr,%2\n\t" /* save vbr value */
96 "movec %4,%/vbr\n\t" /* set up temporary vectors */
97 "movel %/sp,%1\n\t" /* save sp */
98 "moveq #0,%0\n\t" /* assume not present */
99 "moveb %5,%3@\n\t" /* write the hardware reg */
100 "cmpb %3@,%5\n\t" /* compare it */
101 "seq %0" /* comes here only if reg */
102 /* is present */
103 : "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr)
104 : "a" (regp), "r" (tmp_vectors), "d" (val)
105 );
106 after_test:
107 __asm__ __volatile__
108 ( "movel %0,%/sp\n\t" /* restore sp */
109 "movec %1,%/vbr" /* restore vbr */
110 : : "r" (save_sp), "r" (save_vbr) : "sp"
111 );
112
113 return( ret );
114}
115#endif
116
117 72
118/* ++roman: This is a more elaborate test for an SCC chip, since the plain 73/* ++roman: This is a more elaborate test for an SCC chip, since the plain
119 * Medusa board generates DTACK at the SCC's standard addresses, but a SCC 74 * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
@@ -123,26 +78,34 @@ hwreg_present_bywrite(volatile void *regp, unsigned char val)
123 * should be readable without trouble (from channel A!). 78 * should be readable without trouble (from channel A!).
124 */ 79 */
125 80
126static int __init scc_test( volatile char *ctla ) 81static int __init scc_test(volatile char *ctla)
127{ 82{
128 if (!hwreg_present( ctla )) 83 if (!hwreg_present(ctla))
129 return( 0 ); 84 return 0;
130 MFPDELAY(); 85 MFPDELAY();
131 86
132 *ctla = 2; MFPDELAY(); 87 *ctla = 2;
133 *ctla = 0x40; MFPDELAY(); 88 MFPDELAY();
89 *ctla = 0x40;
90 MFPDELAY();
134 91
135 *ctla = 2; MFPDELAY(); 92 *ctla = 2;
136 if (*ctla != 0x40) return( 0 ); 93 MFPDELAY();
94 if (*ctla != 0x40)
95 return 0;
137 MFPDELAY(); 96 MFPDELAY();
138 97
139 *ctla = 2; MFPDELAY(); 98 *ctla = 2;
140 *ctla = 0x60; MFPDELAY(); 99 MFPDELAY();
100 *ctla = 0x60;
101 MFPDELAY();
141 102
142 *ctla = 2; MFPDELAY(); 103 *ctla = 2;
143 if (*ctla != 0x60) return( 0 ); 104 MFPDELAY();
105 if (*ctla != 0x60)
106 return 0;
144 107
145 return( 1 ); 108 return 1;
146} 109}
147 110
148 111
@@ -152,61 +115,66 @@ static int __init scc_test( volatile char *ctla )
152 115
153int __init atari_parse_bootinfo(const struct bi_record *record) 116int __init atari_parse_bootinfo(const struct bi_record *record)
154{ 117{
155 int unknown = 0; 118 int unknown = 0;
156 const u_long *data = record->data; 119 const u_long *data = record->data;
157 120
158 switch (record->tag) { 121 switch (record->tag) {
159 case BI_ATARI_MCH_COOKIE: 122 case BI_ATARI_MCH_COOKIE:
160 atari_mch_cookie = *data; 123 atari_mch_cookie = *data;
161 break; 124 break;
162 case BI_ATARI_MCH_TYPE: 125 case BI_ATARI_MCH_TYPE:
163 atari_mch_type = *data; 126 atari_mch_type = *data;
164 break; 127 break;
165 default: 128 default:
166 unknown = 1; 129 unknown = 1;
167 } 130 break;
168 return(unknown); 131 }
132 return unknown;
169} 133}
170 134
171 135
172/* Parse the Atari-specific switches= option. */ 136/* Parse the Atari-specific switches= option. */
173void __init atari_switches_setup( const char *str, unsigned len ) 137static int __init atari_switches_setup(char *str)
174{ 138{
175 char switches[len+1]; 139 char switches[strlen(str) + 1];
176 char *p; 140 char *p;
177 int ovsc_shift; 141 int ovsc_shift;
178 char *args = switches; 142 char *args = switches;
179 143
180 /* copy string to local array, strsep works destructively... */ 144 if (!MACH_IS_ATARI)
181 strlcpy( switches, str, sizeof(switches) ); 145 return 0;
182 atari_switches = 0; 146
183 147 /* copy string to local array, strsep works destructively... */
184 /* parse the options */ 148 strcpy(switches, str);
185 while ((p = strsep(&args, ",")) != NULL) { 149 atari_switches = 0;
186 if (!*p) continue; 150
187 ovsc_shift = 0; 151 /* parse the options */
188 if (strncmp( p, "ov_", 3 ) == 0) { 152 while ((p = strsep(&args, ",")) != NULL) {
189 p += 3; 153 if (!*p)
190 ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; 154 continue;
191 } 155 ovsc_shift = 0;
192 156 if (strncmp(p, "ov_", 3) == 0) {
193 if (strcmp( p, "ikbd" ) == 0) { 157 p += 3;
194 /* RTS line of IKBD ACIA */ 158 ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
195 atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; 159 }
196 } 160
197 else if (strcmp( p, "midi" ) == 0) { 161 if (strcmp(p, "ikbd") == 0) {
198 /* RTS line of MIDI ACIA */ 162 /* RTS line of IKBD ACIA */
199 atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; 163 atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
164 } else if (strcmp(p, "midi") == 0) {
165 /* RTS line of MIDI ACIA */
166 atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
167 } else if (strcmp(p, "snd6") == 0) {
168 atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
169 } else if (strcmp(p, "snd7") == 0) {
170 atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
171 }
200 } 172 }
201 else if (strcmp( p, "snd6" ) == 0) { 173 return 0;
202 atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
203 }
204 else if (strcmp( p, "snd7" ) == 0) {
205 atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
206 }
207 }
208} 174}
209 175
176early_param("switches", atari_switches_setup);
177
210 178
211 /* 179 /*
212 * Setup the Atari configuration info 180 * Setup the Atari configuration info
@@ -214,284 +182,281 @@ void __init atari_switches_setup( const char *str, unsigned len )
214 182
215void __init config_atari(void) 183void __init config_atari(void)
216{ 184{
217 unsigned short tos_version; 185 unsigned short tos_version;
218 186
219 memset(&atari_hw_present, 0, sizeof(atari_hw_present)); 187 memset(&atari_hw_present, 0, sizeof(atari_hw_present));
220 188
221 atari_debug_init(); 189 /* Change size of I/O space from 64KB to 4GB. */
190 ioport_resource.end = 0xFFFFFFFF;
222 191
223 ioport_resource.end = 0xFFFFFFFF; /* Change size of I/O space from 64KB 192 mach_sched_init = atari_sched_init;
224 to 4GB. */ 193 mach_init_IRQ = atari_init_IRQ;
225 194 mach_get_model = atari_get_model;
226 mach_sched_init = atari_sched_init; 195 mach_get_hardware_list = atari_get_hardware_list;
227 mach_init_IRQ = atari_init_IRQ; 196 mach_gettimeoffset = atari_gettimeoffset;
228 mach_get_model = atari_get_model; 197 mach_reset = atari_reset;
229 mach_get_hardware_list = atari_get_hardware_list; 198 mach_max_dma_address = 0xffffff;
230 mach_gettimeoffset = atari_gettimeoffset;
231 mach_reset = atari_reset;
232 mach_max_dma_address = 0xffffff;
233#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 199#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
234 mach_beep = atari_mksound; 200 mach_beep = atari_mksound;
235#endif 201#endif
236#ifdef CONFIG_HEARTBEAT 202#ifdef CONFIG_HEARTBEAT
237 mach_heartbeat = atari_heartbeat; 203 mach_heartbeat = atari_heartbeat;
238#endif 204#endif
239 205
240 /* Set switches as requested by the user */ 206 /* Set switches as requested by the user */
241 if (atari_switches & ATARI_SWITCH_IKBD) 207 if (atari_switches & ATARI_SWITCH_IKBD)
242 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; 208 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
243 if (atari_switches & ATARI_SWITCH_MIDI) 209 if (atari_switches & ATARI_SWITCH_MIDI)
244 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; 210 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
245 if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { 211 if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
246 sound_ym.rd_data_reg_sel = 14; 212 sound_ym.rd_data_reg_sel = 14;
247 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 213 sound_ym.wd_data = sound_ym.rd_data_reg_sel |
248 ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | 214 ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
249 ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); 215 ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
250 } 216 }
251
252 /* ++bjoern:
253 * Determine hardware present
254 */
255 217
256 printk( "Atari hardware found: " ); 218 /* ++bjoern:
257 if (MACH_IS_MEDUSA || MACH_IS_HADES) { 219 * Determine hardware present
258 /* There's no Atari video hardware on the Medusa, but all the 220 */
259 * addresses below generate a DTACK so no bus error occurs! */ 221
260 } 222 printk("Atari hardware found: ");
261 else if (hwreg_present( f030_xreg )) { 223 if (MACH_IS_MEDUSA || MACH_IS_HADES) {
262 ATARIHW_SET(VIDEL_SHIFTER); 224 /* There's no Atari video hardware on the Medusa, but all the
263 printk( "VIDEL " ); 225 * addresses below generate a DTACK so no bus error occurs! */
264 /* This is a temporary hack: If there is Falcon video 226 } else if (hwreg_present(f030_xreg)) {
265 * hardware, we assume that the ST-DMA serves SCSI instead of 227 ATARIHW_SET(VIDEL_SHIFTER);
266 * ACSI. In the future, there should be a better method for 228 printk("VIDEL ");
267 * this... 229 /* This is a temporary hack: If there is Falcon video
268 */ 230 * hardware, we assume that the ST-DMA serves SCSI instead of
269 ATARIHW_SET(ST_SCSI); 231 * ACSI. In the future, there should be a better method for
270 printk( "STDMA-SCSI " ); 232 * this...
271 } 233 */
272 else if (hwreg_present( tt_palette )) { 234 ATARIHW_SET(ST_SCSI);
273 ATARIHW_SET(TT_SHIFTER); 235 printk("STDMA-SCSI ");
274 printk( "TT_SHIFTER " ); 236 } else if (hwreg_present(tt_palette)) {
275 } 237 ATARIHW_SET(TT_SHIFTER);
276 else if (hwreg_present( &shifter.bas_hi )) { 238 printk("TT_SHIFTER ");
277 if (hwreg_present( &shifter.bas_lo ) && 239 } else if (hwreg_present(&shifter.bas_hi)) {
278 (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { 240 if (hwreg_present(&shifter.bas_lo) &&
279 ATARIHW_SET(EXTD_SHIFTER); 241 (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) {
280 printk( "EXTD_SHIFTER " ); 242 ATARIHW_SET(EXTD_SHIFTER);
281 } 243 printk("EXTD_SHIFTER ");
282 else { 244 } else {
283 ATARIHW_SET(STND_SHIFTER); 245 ATARIHW_SET(STND_SHIFTER);
284 printk( "STND_SHIFTER " ); 246 printk("STND_SHIFTER ");
285 } 247 }
286 } 248 }
287 if (hwreg_present( &mfp.par_dt_reg )) { 249 if (hwreg_present(&mfp.par_dt_reg)) {
288 ATARIHW_SET(ST_MFP); 250 ATARIHW_SET(ST_MFP);
289 printk( "ST_MFP " ); 251 printk("ST_MFP ");
290 } 252 }
291 if (hwreg_present( &tt_mfp.par_dt_reg )) { 253 if (hwreg_present(&tt_mfp.par_dt_reg)) {
292 ATARIHW_SET(TT_MFP); 254 ATARIHW_SET(TT_MFP);
293 printk( "TT_MFP " ); 255 printk("TT_MFP ");
294 } 256 }
295 if (hwreg_present( &tt_scsi_dma.dma_addr_hi )) { 257 if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
296 ATARIHW_SET(SCSI_DMA); 258 ATARIHW_SET(SCSI_DMA);
297 printk( "TT_SCSI_DMA " ); 259 printk("TT_SCSI_DMA ");
298 } 260 }
299 if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) { 261 if (!MACH_IS_HADES && hwreg_present(&st_dma.dma_hi)) {
300 ATARIHW_SET(STND_DMA); 262 ATARIHW_SET(STND_DMA);
301 printk( "STND_DMA " ); 263 printk("STND_DMA ");
302 } 264 }
303 if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable 265 /*
304 * on all Medusas, so the test below may fail */ 266 * The ST-DMA address registers aren't readable
305 (hwreg_present( &st_dma.dma_vhi ) && 267 * on all Medusas, so the test below may fail
306 (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && 268 */
307 st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && 269 if (MACH_IS_MEDUSA ||
308 (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && 270 (hwreg_present(&st_dma.dma_vhi) &&
309 st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { 271 (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
310 ATARIHW_SET(EXTD_DMA); 272 st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
311 printk( "EXTD_DMA " ); 273 (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
312 } 274 st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
313 if (hwreg_present( &tt_scsi.scsi_data )) { 275 ATARIHW_SET(EXTD_DMA);
314 ATARIHW_SET(TT_SCSI); 276 printk("EXTD_DMA ");
315 printk( "TT_SCSI " ); 277 }
316 } 278 if (hwreg_present(&tt_scsi.scsi_data)) {
317 if (hwreg_present( &sound_ym.rd_data_reg_sel )) { 279 ATARIHW_SET(TT_SCSI);
318 ATARIHW_SET(YM_2149); 280 printk("TT_SCSI ");
319 printk( "YM2149 " ); 281 }
320 } 282 if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
321 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 283 ATARIHW_SET(YM_2149);
322 hwreg_present( &tt_dmasnd.ctrl )) { 284 printk("YM2149 ");
323 ATARIHW_SET(PCM_8BIT); 285 }
324 printk( "PCM " ); 286 if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
325 } 287 hwreg_present(&tt_dmasnd.ctrl)) {
326 if (!MACH_IS_HADES && hwreg_present( &falcon_codec.unused5 )) { 288 ATARIHW_SET(PCM_8BIT);
327 ATARIHW_SET(CODEC); 289 printk("PCM ");
328 printk( "CODEC " ); 290 }
329 } 291 if (!MACH_IS_HADES && hwreg_present(&falcon_codec.unused5)) {
330 if (hwreg_present( &dsp56k_host_interface.icr )) { 292 ATARIHW_SET(CODEC);
331 ATARIHW_SET(DSP56K); 293 printk("CODEC ");
332 printk( "DSP56K " ); 294 }
333 } 295 if (hwreg_present(&dsp56k_host_interface.icr)) {
334 if (hwreg_present( &tt_scc_dma.dma_ctrl ) && 296 ATARIHW_SET(DSP56K);
297 printk("DSP56K ");
298 }
299 if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
335#if 0 300#if 0
336 /* This test sucks! Who knows some better? */ 301 /* This test sucks! Who knows some better? */
337 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && 302 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
338 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) 303 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
339#else 304#else
340 !MACH_IS_MEDUSA && !MACH_IS_HADES 305 !MACH_IS_MEDUSA && !MACH_IS_HADES
341#endif 306#endif
342 ) { 307 ) {
343 ATARIHW_SET(SCC_DMA); 308 ATARIHW_SET(SCC_DMA);
344 printk( "SCC_DMA " ); 309 printk("SCC_DMA ");
345 } 310 }
346 if (scc_test( &scc.cha_a_ctrl )) { 311 if (scc_test(&scc.cha_a_ctrl)) {
347 ATARIHW_SET(SCC); 312 ATARIHW_SET(SCC);
348 printk( "SCC " ); 313 printk("SCC ");
349 } 314 }
350 if (scc_test( &st_escc.cha_b_ctrl )) { 315 if (scc_test(&st_escc.cha_b_ctrl)) {
351 ATARIHW_SET( ST_ESCC ); 316 ATARIHW_SET(ST_ESCC);
352 printk( "ST_ESCC " ); 317 printk("ST_ESCC ");
353 } 318 }
354 if (MACH_IS_HADES) 319 if (MACH_IS_HADES) {
355 { 320 ATARIHW_SET(VME);
356 ATARIHW_SET( VME ); 321 printk("VME ");
357 printk( "VME " ); 322 } else if (hwreg_present(&tt_scu.sys_mask)) {
358 } 323 ATARIHW_SET(SCU);
359 else if (hwreg_present( &tt_scu.sys_mask )) { 324 /* Assume a VME bus if there's a SCU */
360 ATARIHW_SET(SCU); 325 ATARIHW_SET(VME);
361 /* Assume a VME bus if there's a SCU */ 326 printk("VME SCU ");
362 ATARIHW_SET( VME ); 327 }
363 printk( "VME SCU " ); 328 if (hwreg_present((void *)(0xffff9210))) {
364 } 329 ATARIHW_SET(ANALOG_JOY);
365 if (hwreg_present( (void *)(0xffff9210) )) { 330 printk("ANALOG_JOY ");
366 ATARIHW_SET(ANALOG_JOY); 331 }
367 printk( "ANALOG_JOY " ); 332 if (!MACH_IS_HADES && hwreg_present(blitter.halftone)) {
368 } 333 ATARIHW_SET(BLITTER);
369 if (!MACH_IS_HADES && hwreg_present( blitter.halftone )) { 334 printk("BLITTER ");
370 ATARIHW_SET(BLITTER); 335 }
371 printk( "BLITTER " ); 336 if (hwreg_present((void *)0xfff00039)) {
372 } 337 ATARIHW_SET(IDE);
373 if (hwreg_present((void *)0xfff00039)) { 338 printk("IDE ");
374 ATARIHW_SET(IDE); 339 }
375 printk( "IDE " );
376 }
377#if 1 /* This maybe wrong */ 340#if 1 /* This maybe wrong */
378 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 341 if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
379 hwreg_present( &tt_microwire.data ) && 342 hwreg_present(&tt_microwire.data) &&
380 hwreg_present( &tt_microwire.mask ) && 343 hwreg_present(&tt_microwire.mask) &&
381 (tt_microwire.mask = 0x7ff, 344 (tt_microwire.mask = 0x7ff,
382 udelay(1), 345 udelay(1),
383 tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, 346 tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
384 udelay(1), 347 udelay(1),
385 tt_microwire.data != 0)) { 348 tt_microwire.data != 0)) {
386 ATARIHW_SET(MICROWIRE); 349 ATARIHW_SET(MICROWIRE);
387 while (tt_microwire.mask != 0x7ff) ; 350 while (tt_microwire.mask != 0x7ff)
388 printk( "MICROWIRE " ); 351 ;
389 } 352 printk("MICROWIRE ");
353 }
390#endif 354#endif
391 if (hwreg_present( &tt_rtc.regsel )) { 355 if (hwreg_present(&tt_rtc.regsel)) {
392 ATARIHW_SET(TT_CLK); 356 ATARIHW_SET(TT_CLK);
393 printk( "TT_CLK " ); 357 printk("TT_CLK ");
394 mach_hwclk = atari_tt_hwclk; 358 mach_hwclk = atari_tt_hwclk;
395 mach_set_clock_mmss = atari_tt_set_clock_mmss; 359 mach_set_clock_mmss = atari_tt_set_clock_mmss;
396 } 360 }
397 if (!MACH_IS_HADES && hwreg_present( &mste_rtc.sec_ones)) { 361 if (!MACH_IS_HADES && hwreg_present(&mste_rtc.sec_ones)) {
398 ATARIHW_SET(MSTE_CLK); 362 ATARIHW_SET(MSTE_CLK);
399 printk( "MSTE_CLK "); 363 printk("MSTE_CLK ");
400 mach_hwclk = atari_mste_hwclk; 364 mach_hwclk = atari_mste_hwclk;
401 mach_set_clock_mmss = atari_mste_set_clock_mmss; 365 mach_set_clock_mmss = atari_mste_set_clock_mmss;
402 } 366 }
403 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 367 if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
404 hwreg_present( &dma_wd.fdc_speed ) && 368 hwreg_present(&dma_wd.fdc_speed) &&
405 hwreg_write( &dma_wd.fdc_speed, 0 )) { 369 hwreg_write(&dma_wd.fdc_speed, 0)) {
406 ATARIHW_SET(FDCSPEED); 370 ATARIHW_SET(FDCSPEED);
407 printk( "FDC_SPEED "); 371 printk("FDC_SPEED ");
408 } 372 }
409 if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { 373 if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) {
410 ATARIHW_SET(ACSI); 374 ATARIHW_SET(ACSI);
411 printk( "ACSI " ); 375 printk("ACSI ");
412 } 376 }
413 printk("\n"); 377 printk("\n");
414 378
415 if (CPU_IS_040_OR_060) 379 if (CPU_IS_040_OR_060)
416 /* Now it seems to be safe to turn of the tt0 transparent 380 /* Now it seems to be safe to turn of the tt0 transparent
417 * translation (the one that must not be turned off in 381 * translation (the one that must not be turned off in
418 * head.S...) 382 * head.S...)
419 */ 383 */
420 __asm__ volatile ("moveq #0,%/d0\n\t" 384 asm volatile ("\n"
421 ".chip 68040\n\t" 385 " moveq #0,%%d0\n"
422 "movec %%d0,%%itt0\n\t" 386 " .chip 68040\n"
423 "movec %%d0,%%dtt0\n\t" 387 " movec %%d0,%%itt0\n"
424 ".chip 68k" 388 " movec %%d0,%%dtt0\n"
425 : /* no outputs */ 389 " .chip 68k"
426 : /* no inputs */ 390 : /* no outputs */
427 : "d0"); 391 : /* no inputs */
428 392 : "d0");
429 /* allocator for memory that must reside in st-ram */ 393
430 atari_stram_init (); 394 /* allocator for memory that must reside in st-ram */
431 395 atari_stram_init();
432 /* Set up a mapping for the VMEbus address region: 396
433 * 397 /* Set up a mapping for the VMEbus address region:
434 * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff 398 *
435 * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at 399 * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff
436 * 0xfe000000 virt., because this can be done with a single 400 * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at
437 * transparent translation. On the 68040, lots of often unused 401 * 0xfe000000 virt., because this can be done with a single
438 * page tables would be needed otherwise. On a MegaSTE or similar, 402 * transparent translation. On the 68040, lots of often unused
439 * the highest byte is stripped off by hardware due to the 24 bit 403 * page tables would be needed otherwise. On a MegaSTE or similar,
440 * design of the bus. 404 * the highest byte is stripped off by hardware due to the 24 bit
441 */ 405 * design of the bus.
406 */
407
408 if (CPU_IS_020_OR_030) {
409 unsigned long tt1_val;
410 tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache
411 * inhibit, read and write, FDC mask = 3,
412 * FDC val = 4 -> Supervisor only */
413 asm volatile ("\n"
414 " .chip 68030\n"
415 " pmove %0@,%/tt1\n"
416 " .chip 68k"
417 : : "a" (&tt1_val));
418 } else {
419 asm volatile ("\n"
420 " .chip 68040\n"
421 " movec %0,%%itt1\n"
422 " movec %0,%%dtt1\n"
423 " .chip 68k"
424 :
425 : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable,
426 * supervisor only, non-cacheable/
427 * serialized, writable */
428
429 }
442 430
443 if (CPU_IS_020_OR_030) { 431 /* Fetch tos version at Physical 2 */
444 unsigned long tt1_val; 432 /*
445 tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache 433 * We my not be able to access this address if the kernel is
446 * inhibit, read and write, FDC mask = 3, 434 * loaded to st ram, since the first page is unmapped. On the
447 * FDC val = 4 -> Supervisor only */ 435 * Medusa this is always the case and there is nothing we can do
448 __asm__ __volatile__ ( ".chip 68030\n\t" 436 * about this, so we just assume the smaller offset. For the TT
449 "pmove %0@,%/tt1\n\t" 437 * we use the fact that in head.S we have set up a mapping
450 ".chip 68k" 438 * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
451 : : "a" (&tt1_val) ); 439 * in the last 16MB of the address space.
452 } 440 */
453 else { 441 tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
454 __asm__ __volatile__ 442 0xfff : *(unsigned short *)0xff000002;
455 ( "movel %0,%/d0\n\t" 443 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
456 ".chip 68040\n\t"
457 "movec %%d0,%%itt1\n\t"
458 "movec %%d0,%%dtt1\n\t"
459 ".chip 68k"
460 :
461 : "g" (0xfe00a040) /* Translate 0xfexxxxxx, enable,
462 * supervisor only, non-cacheable/
463 * serialized, writable */
464 : "d0" );
465
466 }
467
468 /* Fetch tos version at Physical 2 */
469 /* We my not be able to access this address if the kernel is
470 loaded to st ram, since the first page is unmapped. On the
471 Medusa this is always the case and there is nothing we can do
472 about this, so we just assume the smaller offset. For the TT
473 we use the fact that in head.S we have set up a mapping
474 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
475 in the last 16MB of the address space. */
476 tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
477 0xfff : *(unsigned short *)0xff000002;
478 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
479} 444}
480 445
481#ifdef CONFIG_HEARTBEAT 446#ifdef CONFIG_HEARTBEAT
482static void atari_heartbeat( int on ) 447static void atari_heartbeat(int on)
483{ 448{
484 unsigned char tmp; 449 unsigned char tmp;
485 unsigned long flags; 450 unsigned long flags;
486 451
487 if (atari_dont_touch_floppy_select) 452 if (atari_dont_touch_floppy_select)
488 return; 453 return;
489 454
490 local_irq_save(flags); 455 local_irq_save(flags);
491 sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ 456 sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
492 tmp = sound_ym.rd_data_reg_sel; 457 tmp = sound_ym.rd_data_reg_sel;
493 sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); 458 sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
494 local_irq_restore(flags); 459 local_irq_restore(flags);
495} 460}
496#endif 461#endif
497 462
@@ -526,180 +491,171 @@ static void atari_heartbeat( int on )
526 491
527/* ++andreas: no need for complicated code, just depend on prefetch */ 492/* ++andreas: no need for complicated code, just depend on prefetch */
528 493
529static void atari_reset (void) 494static void atari_reset(void)
530{ 495{
531 long tc_val = 0; 496 long tc_val = 0;
532 long reset_addr; 497 long reset_addr;
533 498
534 /* On the Medusa, phys. 0x4 may contain garbage because it's no 499 /*
535 ROM. See above for explanation why we cannot use PTOV(4). */ 500 * On the Medusa, phys. 0x4 may contain garbage because it's no
536 reset_addr = MACH_IS_HADES ? 0x7fe00030 : 501 * ROM. See above for explanation why we cannot use PTOV(4).
537 MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : 502 */
538 *(unsigned long *) 0xff000004; 503 reset_addr = MACH_IS_HADES ? 0x7fe00030 :
539 504 MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
540 /* reset ACIA for switch off OverScan, if it's active */ 505 *(unsigned long *) 0xff000004;
541 if (atari_switches & ATARI_SWITCH_OVSC_IKBD) 506
542 acia.key_ctrl = ACIA_RESET; 507 /* reset ACIA for switch off OverScan, if it's active */
543 if (atari_switches & ATARI_SWITCH_OVSC_MIDI) 508 if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
544 acia.mid_ctrl = ACIA_RESET; 509 acia.key_ctrl = ACIA_RESET;
545 510 if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
546 /* processor independent: turn off interrupts and reset the VBR; 511 acia.mid_ctrl = ACIA_RESET;
547 * the caches must be left enabled, else prefetching the final jump 512
548 * instruction doesn't work. */ 513 /* processor independent: turn off interrupts and reset the VBR;
549 local_irq_disable(); 514 * the caches must be left enabled, else prefetching the final jump
550 __asm__ __volatile__ 515 * instruction doesn't work.
551 ("moveq #0,%/d0\n\t" 516 */
552 "movec %/d0,%/vbr" 517 local_irq_disable();
553 : : : "d0" ); 518 asm volatile ("movec %0,%%vbr"
554 519 : : "d" (0));
555 if (CPU_IS_040_OR_060) { 520
556 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 521 if (CPU_IS_040_OR_060) {
557 if (CPU_IS_060) { 522 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
558 /* 68060: clear PCR to turn off superscalar operation */ 523 if (CPU_IS_060) {
559 __asm__ __volatile__ 524 /* 68060: clear PCR to turn off superscalar operation */
560 ("moveq #0,%/d0\n\t" 525 asm volatile ("\n"
561 ".chip 68060\n\t" 526 " .chip 68060\n"
562 "movec %%d0,%%pcr\n\t" 527 " movec %0,%%pcr\n"
563 ".chip 68k" 528 " .chip 68k"
564 : : : "d0" ); 529 : : "d" (0));
565 } 530 }
566 531
567 __asm__ __volatile__ 532 asm volatile ("\n"
568 ("movel %0,%/d0\n\t" 533 " move.l %0,%%d0\n"
569 "andl #0xff000000,%/d0\n\t" 534 " and.l #0xff000000,%%d0\n"
570 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ 535 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
571 ".chip 68040\n\t" 536 " .chip 68040\n"
572 "movec %%d0,%%itt0\n\t" 537 " movec %%d0,%%itt0\n"
573 "movec %%d0,%%dtt0\n\t" 538 " movec %%d0,%%dtt0\n"
574 ".chip 68k\n\t" 539 " .chip 68k\n"
575 "jmp %0@\n\t" 540 " jmp %0@"
576 : /* no outputs */ 541 : : "a" (jmp_addr040)
577 : "a" (jmp_addr040) 542 : "d0");
578 : "d0" ); 543 jmp_addr_label040:
579 jmp_addr_label040: 544 asm volatile ("\n"
580 __asm__ __volatile__ 545 " moveq #0,%%d0\n"
581 ("moveq #0,%/d0\n\t" 546 " nop\n"
582 "nop\n\t" 547 " .chip 68040\n"
583 ".chip 68040\n\t" 548 " cinva %%bc\n"
584 "cinva %%bc\n\t" 549 " nop\n"
585 "nop\n\t" 550 " pflusha\n"
586 "pflusha\n\t" 551 " nop\n"
587 "nop\n\t" 552 " movec %%d0,%%tc\n"
588 "movec %%d0,%%tc\n\t" 553 " nop\n"
589 "nop\n\t" 554 /* the following setup of transparent translations is needed on the
590 /* the following setup of transparent translations is needed on the 555 * Afterburner040 to successfully reboot. Other machines shouldn't
591 * Afterburner040 to successfully reboot. Other machines shouldn't 556 * care about a different tt regs setup, they also didn't care in
592 * care about a different tt regs setup, they also didn't care in 557 * the past that the regs weren't turned off. */
593 * the past that the regs weren't turned off. */ 558 " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */
594 "movel #0xffc000,%%d0\n\t" /* whole insn space cacheable */ 559 " movec %%d0,%%itt0\n"
595 "movec %%d0,%%itt0\n\t" 560 " movec %%d0,%%itt1\n"
596 "movec %%d0,%%itt1\n\t" 561 " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */
597 "orw #0x40,%/d0\n\t" /* whole data space non-cacheable/ser. */ 562 " movec %%d0,%%dtt0\n"
598 "movec %%d0,%%dtt0\n\t" 563 " movec %%d0,%%dtt1\n"
599 "movec %%d0,%%dtt1\n\t" 564 " .chip 68k\n"
600 ".chip 68k\n\t" 565 " jmp %0@"
601 "jmp %0@" 566 : /* no outputs */
602 : /* no outputs */ 567 : "a" (reset_addr)
603 : "a" (reset_addr) 568 : "d0");
604 : "d0"); 569 } else
605 } 570 asm volatile ("\n"
606 else 571 " pmove %0@,%%tc\n"
607 __asm__ __volatile__ 572 " jmp %1@"
608 ("pmove %0@,%/tc\n\t" 573 : /* no outputs */
609 "jmp %1@" 574 : "a" (&tc_val), "a" (reset_addr));
610 : /* no outputs */
611 : "a" (&tc_val), "a" (reset_addr));
612} 575}
613 576
614 577
615static void atari_get_model(char *model) 578static void atari_get_model(char *model)
616{ 579{
617 strcpy(model, "Atari "); 580 strcpy(model, "Atari ");
618 switch (atari_mch_cookie >> 16) { 581 switch (atari_mch_cookie >> 16) {
619 case ATARI_MCH_ST: 582 case ATARI_MCH_ST:
620 if (ATARIHW_PRESENT(MSTE_CLK)) 583 if (ATARIHW_PRESENT(MSTE_CLK))
621 strcat (model, "Mega ST"); 584 strcat(model, "Mega ST");
622 else 585 else
623 strcat (model, "ST"); 586 strcat(model, "ST");
624 break; 587 break;
625 case ATARI_MCH_STE: 588 case ATARI_MCH_STE:
626 if (MACH_IS_MSTE) 589 if (MACH_IS_MSTE)
627 strcat (model, "Mega STE"); 590 strcat(model, "Mega STE");
628 else 591 else
629 strcat (model, "STE"); 592 strcat(model, "STE");
630 break; 593 break;
631 case ATARI_MCH_TT: 594 case ATARI_MCH_TT:
632 if (MACH_IS_MEDUSA) 595 if (MACH_IS_MEDUSA)
633 /* Medusa has TT _MCH cookie */ 596 /* Medusa has TT _MCH cookie */
634 strcat (model, "Medusa"); 597 strcat(model, "Medusa");
635 else if (MACH_IS_HADES) 598 else if (MACH_IS_HADES)
636 strcat(model, "Hades"); 599 strcat(model, "Hades");
637 else 600 else
638 strcat (model, "TT"); 601 strcat(model, "TT");
639 break; 602 break;
640 case ATARI_MCH_FALCON: 603 case ATARI_MCH_FALCON:
641 strcat (model, "Falcon"); 604 strcat(model, "Falcon");
642 if (MACH_IS_AB40) 605 if (MACH_IS_AB40)
643 strcat (model, " (with Afterburner040)"); 606 strcat(model, " (with Afterburner040)");
644 break; 607 break;
645 default: 608 default:
646 sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)", 609 sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)",
647 atari_mch_cookie); 610 atari_mch_cookie);
648 break; 611 break;
649 } 612 }
650} 613}
651 614
652 615
653static int atari_get_hardware_list(char *buffer) 616static int atari_get_hardware_list(char *buffer)
654{ 617{
655 int len = 0, i; 618 int len = 0, i;
656 619
657 for (i = 0; i < m68k_num_memory; i++) 620 for (i = 0; i < m68k_num_memory; i++)
658 len += sprintf (buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", 621 len += sprintf(buffer+len, "\t%3ld MB at 0x%08lx (%s)\n",
659 m68k_memory[i].size >> 20, m68k_memory[i].addr, 622 m68k_memory[i].size >> 20, m68k_memory[i].addr,
660 (m68k_memory[i].addr & 0xff000000 ? 623 (m68k_memory[i].addr & 0xff000000 ?
661 "alternate RAM" : "ST-RAM")); 624 "alternate RAM" : "ST-RAM"));
662 625
663#define ATARIHW_ANNOUNCE(name,str) \ 626#define ATARIHW_ANNOUNCE(name, str) \
664 if (ATARIHW_PRESENT(name)) \ 627 if (ATARIHW_PRESENT(name)) \
665 len += sprintf (buffer + len, "\t%s\n", str) 628 len += sprintf(buffer + len, "\t%s\n", str)
666 629
667 len += sprintf (buffer + len, "Detected hardware:\n"); 630 len += sprintf(buffer + len, "Detected hardware:\n");
668 ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); 631 ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
669 ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); 632 ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
670 ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); 633 ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
671 ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); 634 ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
672 ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); 635 ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
673 ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); 636 ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
674 ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); 637 ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
675 ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); 638 ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
676 ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); 639 ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
677 ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); 640 ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
678 ATARIHW_ANNOUNCE(IDE, "IDE Interface"); 641 ATARIHW_ANNOUNCE(IDE, "IDE Interface");
679 ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); 642 ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
680 ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); 643 ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
681 ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); 644 ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
682 ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); 645 ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
683 ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); 646 ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
684 ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); 647 ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
685 ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); 648 ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
686 ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); 649 ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
687 ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); 650 ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
688 ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); 651 ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
689 ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); 652 ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
690 ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); 653 ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
691 ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); 654 ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
692 ATARIHW_ANNOUNCE(SCU, "System Control Unit"); 655 ATARIHW_ANNOUNCE(SCU, "System Control Unit");
693 ATARIHW_ANNOUNCE(BLITTER, "Blitter"); 656 ATARIHW_ANNOUNCE(BLITTER, "Blitter");
694 ATARIHW_ANNOUNCE(VME, "VME Bus"); 657 ATARIHW_ANNOUNCE(VME, "VME Bus");
695 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); 658 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
696 659
697 return(len); 660 return len;
698} 661}
699
700/*
701 * Local variables:
702 * c-indent-level: 4
703 * tab-width: 8
704 * End:
705 */
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index 4ae01004d8dd..fbeed8c8ecbc 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -19,8 +19,6 @@
19#include <asm/atarihw.h> 19#include <asm/atarihw.h>
20#include <asm/atariints.h> 20#include <asm/atariints.h>
21 21
22extern char m68k_debug_device[];
23
24/* Flag that Modem1 port is already initialized and used */ 22/* Flag that Modem1 port is already initialized and used */
25int atari_MFP_init_done; 23int atari_MFP_init_done;
26/* Flag that Modem1 port is already initialized and used */ 24/* Flag that Modem1 port is already initialized and used */
@@ -30,317 +28,317 @@ int atari_SCC_init_done;
30int atari_SCC_reset_done; 28int atari_SCC_reset_done;
31 29
32static struct console atari_console_driver = { 30static struct console atari_console_driver = {
33 .name = "debug", 31 .name = "debug",
34 .flags = CON_PRINTBUFFER, 32 .flags = CON_PRINTBUFFER,
35 .index = -1, 33 .index = -1,
36}; 34};
37 35
38 36
39static inline void ata_mfp_out (char c) 37static inline void ata_mfp_out(char c)
40{ 38{
41 while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ 39 while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */
42 barrier (); 40 barrier();
43 mfp.usart_dta = c; 41 mfp.usart_dta = c;
44} 42}
45 43
46void atari_mfp_console_write (struct console *co, const char *str, 44void atari_mfp_console_write(struct console *co, const char *str,
47 unsigned int count) 45 unsigned int count)
48{ 46{
49 while (count--) { 47 while (count--) {
50 if (*str == '\n') 48 if (*str == '\n')
51 ata_mfp_out( '\r' ); 49 ata_mfp_out('\r');
52 ata_mfp_out( *str++ ); 50 ata_mfp_out(*str++);
53 } 51 }
54} 52}
55 53
56static inline void ata_scc_out (char c) 54static inline void ata_scc_out(char c)
57{ 55{
58 do { 56 do {
57 MFPDELAY();
58 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
59 MFPDELAY(); 59 MFPDELAY();
60 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ 60 scc.cha_b_data = c;
61 MFPDELAY();
62 scc.cha_b_data = c;
63} 61}
64 62
65void atari_scc_console_write (struct console *co, const char *str, 63void atari_scc_console_write(struct console *co, const char *str,
66 unsigned int count) 64 unsigned int count)
67{ 65{
68 while (count--) { 66 while (count--) {
69 if (*str == '\n') 67 if (*str == '\n')
70 ata_scc_out( '\r' ); 68 ata_scc_out('\r');
71 ata_scc_out( *str++ ); 69 ata_scc_out(*str++);
72 } 70 }
73} 71}
74 72
75static inline void ata_midi_out (char c) 73static inline void ata_midi_out(char c)
76{ 74{
77 while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */ 75 while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */
78 barrier (); 76 barrier();
79 acia.mid_data = c; 77 acia.mid_data = c;
80} 78}
81 79
82void atari_midi_console_write (struct console *co, const char *str, 80void atari_midi_console_write(struct console *co, const char *str,
83 unsigned int count) 81 unsigned int count)
84{ 82{
85 while (count--) { 83 while (count--) {
86 if (*str == '\n') 84 if (*str == '\n')
87 ata_midi_out( '\r' ); 85 ata_midi_out('\r');
88 ata_midi_out( *str++ ); 86 ata_midi_out(*str++);
89 } 87 }
90} 88}
91 89
92static int ata_par_out (char c) 90static int ata_par_out(char c)
93{ 91{
94 unsigned char tmp; 92 unsigned char tmp;
95 /* This a some-seconds timeout in case no printer is connected */ 93 /* This a some-seconds timeout in case no printer is connected */
96 unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; 94 unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ;
97 95
98 while( (mfp.par_dt_reg & 1) && --i ) /* wait for BUSY == L */ 96 while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
99 ; 97 ;
100 if (!i) return( 0 ); 98 if (!i)
101 99 return 0;
102 sound_ym.rd_data_reg_sel = 15; /* select port B */ 100
103 sound_ym.wd_data = c; /* put char onto port */ 101 sound_ym.rd_data_reg_sel = 15; /* select port B */
104 sound_ym.rd_data_reg_sel = 14; /* select port A */ 102 sound_ym.wd_data = c; /* put char onto port */
105 tmp = sound_ym.rd_data_reg_sel; 103 sound_ym.rd_data_reg_sel = 14; /* select port A */
106 sound_ym.wd_data = tmp & ~0x20; /* set strobe L */ 104 tmp = sound_ym.rd_data_reg_sel;
107 MFPDELAY(); /* wait a bit */ 105 sound_ym.wd_data = tmp & ~0x20; /* set strobe L */
108 sound_ym.wd_data = tmp | 0x20; /* set strobe H */ 106 MFPDELAY(); /* wait a bit */
109 return( 1 ); 107 sound_ym.wd_data = tmp | 0x20; /* set strobe H */
108 return 1;
110} 109}
111 110
112static void atari_par_console_write (struct console *co, const char *str, 111static void atari_par_console_write(struct console *co, const char *str,
113 unsigned int count) 112 unsigned int count)
114{ 113{
115 static int printer_present = 1; 114 static int printer_present = 1;
116 115
117 if (!printer_present) 116 if (!printer_present)
118 return;
119
120 while (count--) {
121 if (*str == '\n')
122 if (!ata_par_out( '\r' )) {
123 printer_present = 0;
124 return; 117 return;
125 } 118
126 if (!ata_par_out( *str++ )) { 119 while (count--) {
127 printer_present = 0; 120 if (*str == '\n') {
128 return; 121 if (!ata_par_out('\r')) {
122 printer_present = 0;
123 return;
124 }
125 }
126 if (!ata_par_out(*str++)) {
127 printer_present = 0;
128 return;
129 }
129 } 130 }
130 }
131} 131}
132 132
133#ifdef CONFIG_SERIAL_CONSOLE 133#ifdef CONFIG_SERIAL_CONSOLE
134int atari_mfp_console_wait_key(struct console *co) 134int atari_mfp_console_wait_key(struct console *co)
135{ 135{
136 while( !(mfp.rcv_stat & 0x80) ) /* wait for rx buf filled */ 136 while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */
137 barrier(); 137 barrier();
138 return( mfp.usart_dta ); 138 return mfp.usart_dta;
139} 139}
140 140
141int atari_scc_console_wait_key(struct console *co) 141int atari_scc_console_wait_key(struct console *co)
142{ 142{
143 do { 143 do {
144 MFPDELAY();
145 } while (!(scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */
144 MFPDELAY(); 146 MFPDELAY();
145 } while( !(scc.cha_b_ctrl & 0x01) ); /* wait for rx buf filled */ 147 return scc.cha_b_data;
146 MFPDELAY();
147 return( scc.cha_b_data );
148} 148}
149 149
150int atari_midi_console_wait_key(struct console *co) 150int atari_midi_console_wait_key(struct console *co)
151{ 151{
152 while( !(acia.mid_ctrl & ACIA_RDRF) ) /* wait for rx buf filled */ 152 while (!(acia.mid_ctrl & ACIA_RDRF)) /* wait for rx buf filled */
153 barrier(); 153 barrier();
154 return( acia.mid_data ); 154 return acia.mid_data;
155} 155}
156#endif 156#endif
157 157
158/* The following two functions do a quick'n'dirty initialization of the MFP or 158/*
159 * The following two functions do a quick'n'dirty initialization of the MFP or
159 * SCC serial ports. They're used by the debugging interface, kgdb, and the 160 * SCC serial ports. They're used by the debugging interface, kgdb, and the
160 * serial console code. */ 161 * serial console code.
162 */
161#ifndef CONFIG_SERIAL_CONSOLE 163#ifndef CONFIG_SERIAL_CONSOLE
162static void __init atari_init_mfp_port( int cflag ) 164static void __init atari_init_mfp_port(int cflag)
163#else 165#else
164void atari_init_mfp_port( int cflag ) 166void atari_init_mfp_port(int cflag)
165#endif 167#endif
166{ 168{
167 /* timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 169 /*
168 * bps, resp., and work only correct if there's a RSVE or RSSPEED */ 170 * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150
169 static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 }; 171 * bps, resp., and work only correct if there's a RSVE or RSSPEED
170 int baud = cflag & CBAUD; 172 */
171 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0; 173 static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 };
172 int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00; 174 int baud = cflag & CBAUD;
173 175 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0;
174 if (cflag & CBAUDEX) 176 int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00;
175 baud += B38400; 177
176 if (baud < B1200 || baud > B38400+2) 178 if (cflag & CBAUDEX)
177 baud = B9600; /* use default 9600bps for non-implemented rates */ 179 baud += B38400;
178 baud -= B1200; /* baud_table[] starts at 1200bps */ 180 if (baud < B1200 || baud > B38400+2)
179 181 baud = B9600; /* use default 9600bps for non-implemented rates */
180 mfp.trn_stat &= ~0x01; /* disable TX */ 182 baud -= B1200; /* baud_table[] starts at 1200bps */
181 mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ 183
182 mfp.tim_ct_cd &= 0x70; /* stop timer D */ 184 mfp.trn_stat &= ~0x01; /* disable TX */
183 mfp.tim_dt_d = baud_table[baud]; 185 mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
184 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ 186 mfp.tim_ct_cd &= 0x70; /* stop timer D */
185 mfp.trn_stat |= 0x01; /* enable TX */ 187 mfp.tim_dt_d = baud_table[baud];
186 188 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */
187 atari_MFP_init_done = 1; 189 mfp.trn_stat |= 0x01; /* enable TX */
190
191 atari_MFP_init_done = 1;
188} 192}
189 193
190#define SCC_WRITE(reg,val) \ 194#define SCC_WRITE(reg, val) \
191 do { \ 195 do { \
192 scc.cha_b_ctrl = (reg); \ 196 scc.cha_b_ctrl = (reg); \
193 MFPDELAY(); \ 197 MFPDELAY(); \
194 scc.cha_b_ctrl = (val); \ 198 scc.cha_b_ctrl = (val); \
195 MFPDELAY(); \ 199 MFPDELAY(); \
196 } while(0) 200 } while (0)
197 201
198/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a 202/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
199 * delay of ~ 60us. */ 203 * delay of ~ 60us. */
200#define LONG_DELAY() \ 204#define LONG_DELAY() \
201 do { \ 205 do { \
202 int i; \ 206 int i; \
203 for( i = 100; i > 0; --i ) \ 207 for (i = 100; i > 0; --i) \
204 MFPDELAY(); \ 208 MFPDELAY(); \
205 } while(0) 209 } while (0)
206 210
207#ifndef CONFIG_SERIAL_CONSOLE 211#ifndef CONFIG_SERIAL_CONSOLE
208static void __init atari_init_scc_port( int cflag ) 212static void __init atari_init_scc_port(int cflag)
209#else 213#else
210void atari_init_scc_port( int cflag ) 214void atari_init_scc_port(int cflag)
211#endif 215#endif
212{ 216{
213 extern int atari_SCC_reset_done; 217 extern int atari_SCC_reset_done;
214 static int clksrc_table[9] = 218 static int clksrc_table[9] =
215 /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ 219 /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
216 { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; 220 { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
217 static int brgsrc_table[9] = 221 static int brgsrc_table[9] =
218 /* reg 14: 0 = RTxC, 2 = PCLK */ 222 /* reg 14: 0 = RTxC, 2 = PCLK */
219 { 2, 2, 2, 2, 2, 2, 0, 2, 2 }; 223 { 2, 2, 2, 2, 2, 2, 0, 2, 2 };
220 static int clkmode_table[9] = 224 static int clkmode_table[9] =
221 /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ 225 /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */
222 { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; 226 { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
223 static int div_table[9] = 227 static int div_table[9] =
224 /* reg12 (BRG low) */ 228 /* reg12 (BRG low) */
225 { 208, 138, 103, 50, 24, 11, 1, 0, 0 }; 229 { 208, 138, 103, 50, 24, 11, 1, 0, 0 };
226 230
227 int baud = cflag & CBAUD; 231 int baud = cflag & CBAUD;
228 int clksrc, clkmode, div, reg3, reg5; 232 int clksrc, clkmode, div, reg3, reg5;
229 233
230 if (cflag & CBAUDEX) 234 if (cflag & CBAUDEX)
231 baud += B38400; 235 baud += B38400;
232 if (baud < B1200 || baud > B38400+2) 236 if (baud < B1200 || baud > B38400+2)
233 baud = B9600; /* use default 9600bps for non-implemented rates */ 237 baud = B9600; /* use default 9600bps for non-implemented rates */
234 baud -= B1200; /* tables starts at 1200bps */ 238 baud -= B1200; /* tables starts at 1200bps */
235 239
236 clksrc = clksrc_table[baud]; 240 clksrc = clksrc_table[baud];
237 clkmode = clkmode_table[baud]; 241 clkmode = clkmode_table[baud];
238 div = div_table[baud]; 242 div = div_table[baud];
239 if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) { 243 if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) {
240 /* special treatment for TT, where rates >= 38400 are done via TRxC */ 244 /* special treatment for TT, where rates >= 38400 are done via TRxC */
241 clksrc = 0x28; /* TRxC */ 245 clksrc = 0x28; /* TRxC */
242 clkmode = baud == 6 ? 0xc0 : 246 clkmode = baud == 6 ? 0xc0 :
243 baud == 7 ? 0x80 : /* really 76800bps */ 247 baud == 7 ? 0x80 : /* really 76800bps */
244 0x40; /* really 153600bps */ 248 0x40; /* really 153600bps */
245 div = 0; 249 div = 0;
246 } 250 }
247 251
248 reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; 252 reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40;
249 reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; 253 reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */;
250 254
251 (void)scc.cha_b_ctrl; /* reset reg pointer */ 255 (void)scc.cha_b_ctrl; /* reset reg pointer */
252 SCC_WRITE( 9, 0xc0 ); /* reset */ 256 SCC_WRITE(9, 0xc0); /* reset */
253 LONG_DELAY(); /* extra delay after WR9 access */ 257 LONG_DELAY(); /* extra delay after WR9 access */
254 SCC_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 258 SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03)
255 0x04 /* 1 stopbit */ | 259 : 0 | 0x04 /* 1 stopbit */ | clkmode);
256 clkmode ); 260 SCC_WRITE(3, reg3);
257 SCC_WRITE( 3, reg3 ); 261 SCC_WRITE(5, reg5);
258 SCC_WRITE( 5, reg5 ); 262 SCC_WRITE(9, 0); /* no interrupts */
259 SCC_WRITE( 9, 0 ); /* no interrupts */ 263 LONG_DELAY(); /* extra delay after WR9 access */
260 LONG_DELAY(); /* extra delay after WR9 access */ 264 SCC_WRITE(10, 0); /* NRZ mode */
261 SCC_WRITE( 10, 0 ); /* NRZ mode */ 265 SCC_WRITE(11, clksrc); /* main clock source */
262 SCC_WRITE( 11, clksrc ); /* main clock source */ 266 SCC_WRITE(12, div); /* BRG value */
263 SCC_WRITE( 12, div ); /* BRG value */ 267 SCC_WRITE(13, 0); /* BRG high byte */
264 SCC_WRITE( 13, 0 ); /* BRG high byte */ 268 SCC_WRITE(14, brgsrc_table[baud]);
265 SCC_WRITE( 14, brgsrc_table[baud] ); 269 SCC_WRITE(14, brgsrc_table[baud] | (div ? 1 : 0));
266 SCC_WRITE( 14, brgsrc_table[baud] | (div ? 1 : 0) ); 270 SCC_WRITE(3, reg3 | 1);
267 SCC_WRITE( 3, reg3 | 1 ); 271 SCC_WRITE(5, reg5 | 8);
268 SCC_WRITE( 5, reg5 | 8 ); 272
269 273 atari_SCC_reset_done = 1;
270 atari_SCC_reset_done = 1; 274 atari_SCC_init_done = 1;
271 atari_SCC_init_done = 1;
272} 275}
273 276
274#ifndef CONFIG_SERIAL_CONSOLE 277#ifndef CONFIG_SERIAL_CONSOLE
275static void __init atari_init_midi_port( int cflag ) 278static void __init atari_init_midi_port(int cflag)
276#else 279#else
277void atari_init_midi_port( int cflag ) 280void atari_init_midi_port(int cflag)
278#endif 281#endif
279{ 282{
280 int baud = cflag & CBAUD; 283 int baud = cflag & CBAUD;
281 int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; 284 int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00;
282 /* warning 7N1 isn't possible! (instead 7O2 is used...) */ 285 /* warning 7N1 isn't possible! (instead 7O2 is used...) */
283 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04; 286 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04;
284 int div; 287 int div;
285 288
286 /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as 289 /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as
287 * default) the standard MIDI speed 31250. */ 290 * default) the standard MIDI speed 31250. */
288 if (cflag & CBAUDEX) 291 if (cflag & CBAUDEX)
289 baud += B38400; 292 baud += B38400;
290 if (baud == B4800) 293 if (baud == B4800)
291 div = ACIA_DIV64; /* really 7812.5 bps */ 294 div = ACIA_DIV64; /* really 7812.5 bps */
292 else if (baud == B38400+2 /* 115200 */) 295 else if (baud == B38400+2 /* 115200 */)
293 div = ACIA_DIV1; /* really 500 kbps (does that work??) */ 296 div = ACIA_DIV1; /* really 500 kbps (does that work??) */
294 else 297 else
295 div = ACIA_DIV16; /* 31250 bps, standard for MIDI */ 298 div = ACIA_DIV16; /* 31250 bps, standard for MIDI */
296 299
297 /* RTS low, ints disabled */ 300 /* RTS low, ints disabled */
298 acia.mid_ctrl = div | csize | parity | 301 acia.mid_ctrl = div | csize | parity |
299 ((atari_switches & ATARI_SWITCH_MIDI) ? 302 ((atari_switches & ATARI_SWITCH_MIDI) ?
300 ACIA_RHTID : ACIA_RLTID); 303 ACIA_RHTID : ACIA_RLTID);
301} 304}
302 305
303void __init atari_debug_init(void) 306static int __init atari_debug_setup(char *arg)
304{ 307{
305 if (!strcmp( m68k_debug_device, "ser" )) { 308 if (!MACH_IS_ATARI)
306 /* defaults to ser2 for a Falcon and ser1 otherwise */ 309 return 0;
307 strcpy( m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1" ); 310
308 311 if (!strcmp(arg, "ser"))
309 } 312 /* defaults to ser2 for a Falcon and ser1 otherwise */
310 313 arg = MACH_IS_FALCON ? "ser2" : "ser1";
311 if (!strcmp( m68k_debug_device, "ser1" )) { 314
312 /* ST-MFP Modem1 serial port */ 315 if (!strcmp(arg, "ser1")) {
313 atari_init_mfp_port( B9600|CS8 ); 316 /* ST-MFP Modem1 serial port */
314 atari_console_driver.write = atari_mfp_console_write; 317 atari_init_mfp_port(B9600|CS8);
315 } 318 atari_console_driver.write = atari_mfp_console_write;
316 else if (!strcmp( m68k_debug_device, "ser2" )) { 319 } else if (!strcmp(arg, "ser2")) {
317 /* SCC Modem2 serial port */ 320 /* SCC Modem2 serial port */
318 atari_init_scc_port( B9600|CS8 ); 321 atari_init_scc_port(B9600|CS8);
319 atari_console_driver.write = atari_scc_console_write; 322 atari_console_driver.write = atari_scc_console_write;
320 } 323 } else if (!strcmp(arg, "midi")) {
321 else if (!strcmp( m68k_debug_device, "midi" )) { 324 /* MIDI port */
322 /* MIDI port */ 325 atari_init_midi_port(B9600|CS8);
323 atari_init_midi_port( B9600|CS8 ); 326 atari_console_driver.write = atari_midi_console_write;
324 atari_console_driver.write = atari_midi_console_write; 327 } else if (!strcmp(arg, "par")) {
325 } 328 /* parallel printer */
326 else if (!strcmp( m68k_debug_device, "par" )) { 329 atari_turnoff_irq(IRQ_MFP_BUSY); /* avoid ints */
327 /* parallel printer */ 330 sound_ym.rd_data_reg_sel = 7; /* select mixer control */
328 atari_turnoff_irq( IRQ_MFP_BUSY ); /* avoid ints */ 331 sound_ym.wd_data = 0xff; /* sound off, ports are output */
329 sound_ym.rd_data_reg_sel = 7; /* select mixer control */ 332 sound_ym.rd_data_reg_sel = 15; /* select port B */
330 sound_ym.wd_data = 0xff; /* sound off, ports are output */ 333 sound_ym.wd_data = 0; /* no char */
331 sound_ym.rd_data_reg_sel = 15; /* select port B */ 334 sound_ym.rd_data_reg_sel = 14; /* select port A */
332 sound_ym.wd_data = 0; /* no char */ 335 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
333 sound_ym.rd_data_reg_sel = 14; /* select port A */ 336 atari_console_driver.write = atari_par_console_write;
334 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ 337 }
335 atari_console_driver.write = atari_par_console_write; 338 if (atari_console_driver.write)
336 } 339 register_console(&atari_console_driver);
337 if (atari_console_driver.write) 340
338 register_console(&atari_console_driver); 341 return 0;
339} 342}
340 343
341/* 344early_param("debug", atari_debug_setup);
342 * Local variables:
343 * c-indent-level: 4
344 * tab-width: 8
345 * End:
346 */
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 222ce4244564..e162ee685d20 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -692,7 +692,7 @@ sys_call_table:
692 .long sys_tgkill /* 265 */ 692 .long sys_tgkill /* 265 */
693 .long sys_utimes 693 .long sys_utimes
694 .long sys_fadvise64_64 694 .long sys_fadvise64_64
695 .long sys_mbind 695 .long sys_mbind
696 .long sys_get_mempolicy 696 .long sys_get_mempolicy
697 .long sys_set_mempolicy /* 270 */ 697 .long sys_set_mempolicy /* 270 */
698 .long sys_mq_open 698 .long sys_mq_open
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 6739e87fe825..05741f233567 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -3195,7 +3195,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1
3195 jbra L(serial_putc_done) 3195 jbra L(serial_putc_done)
31963: 31963:
3197#endif 3197#endif
3198 3198
3199L(serial_putc_done): 3199L(serial_putc_done):
3200func_return serial_putc 3200func_return serial_putc
3201 3201
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 42b8fd09ea8f..610319356691 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -71,9 +71,6 @@ static struct mem_info m68k_ramdisk;
71 71
72static char m68k_command_line[CL_SIZE]; 72static char m68k_command_line[CL_SIZE];
73 73
74char m68k_debug_device[6] = "";
75EXPORT_SYMBOL(m68k_debug_device);
76
77void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL; 74void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL;
78/* machine dependent irq functions */ 75/* machine dependent irq functions */
79void (*mach_init_IRQ) (void) __initdata = NULL; 76void (*mach_init_IRQ) (void) __initdata = NULL;
@@ -133,78 +130,78 @@ extern void config_hp300(void);
133extern void config_q40(void); 130extern void config_q40(void);
134extern void config_sun3x(void); 131extern void config_sun3x(void);
135 132
136extern void mac_debugging_short (int, short);
137extern void mac_debugging_long (int, long);
138
139#define MASK_256K 0xfffc0000 133#define MASK_256K 0xfffc0000
140 134
141extern void paging_init(void); 135extern void paging_init(void);
142 136
143static void __init m68k_parse_bootinfo(const struct bi_record *record) 137static void __init m68k_parse_bootinfo(const struct bi_record *record)
144{ 138{
145 while (record->tag != BI_LAST) { 139 while (record->tag != BI_LAST) {
146 int unknown = 0; 140 int unknown = 0;
147 const unsigned long *data = record->data; 141 const unsigned long *data = record->data;
148 switch (record->tag) { 142
149 case BI_MACHTYPE: 143 switch (record->tag) {
150 case BI_CPUTYPE: 144 case BI_MACHTYPE:
151 case BI_FPUTYPE: 145 case BI_CPUTYPE:
152 case BI_MMUTYPE: 146 case BI_FPUTYPE:
153 /* Already set up by head.S */ 147 case BI_MMUTYPE:
154 break; 148 /* Already set up by head.S */
155 149 break;
156 case BI_MEMCHUNK: 150
157 if (m68k_num_memory < NUM_MEMINFO) { 151 case BI_MEMCHUNK:
158 m68k_memory[m68k_num_memory].addr = data[0]; 152 if (m68k_num_memory < NUM_MEMINFO) {
159 m68k_memory[m68k_num_memory].size = data[1]; 153 m68k_memory[m68k_num_memory].addr = data[0];
160 m68k_num_memory++; 154 m68k_memory[m68k_num_memory].size = data[1];
161 } else 155 m68k_num_memory++;
162 printk("m68k_parse_bootinfo: too many memory chunks\n"); 156 } else
163 break; 157 printk("m68k_parse_bootinfo: too many memory chunks\n");
164 158 break;
165 case BI_RAMDISK: 159
166 m68k_ramdisk.addr = data[0]; 160 case BI_RAMDISK:
167 m68k_ramdisk.size = data[1]; 161 m68k_ramdisk.addr = data[0];
168 break; 162 m68k_ramdisk.size = data[1];
169 163 break;
170 case BI_COMMAND_LINE: 164
171 strlcpy(m68k_command_line, (const char *)data, sizeof(m68k_command_line)); 165 case BI_COMMAND_LINE:
172 break; 166 strlcpy(m68k_command_line, (const char *)data,
173 167 sizeof(m68k_command_line));
174 default: 168 break;
175 if (MACH_IS_AMIGA) 169
176 unknown = amiga_parse_bootinfo(record); 170 default:
177 else if (MACH_IS_ATARI) 171 if (MACH_IS_AMIGA)
178 unknown = atari_parse_bootinfo(record); 172 unknown = amiga_parse_bootinfo(record);
179 else if (MACH_IS_MAC) 173 else if (MACH_IS_ATARI)
180 unknown = mac_parse_bootinfo(record); 174 unknown = atari_parse_bootinfo(record);
181 else if (MACH_IS_Q40) 175 else if (MACH_IS_MAC)
182 unknown = q40_parse_bootinfo(record); 176 unknown = mac_parse_bootinfo(record);
183 else if (MACH_IS_BVME6000) 177 else if (MACH_IS_Q40)
184 unknown = bvme6000_parse_bootinfo(record); 178 unknown = q40_parse_bootinfo(record);
185 else if (MACH_IS_MVME16x) 179 else if (MACH_IS_BVME6000)
186 unknown = mvme16x_parse_bootinfo(record); 180 unknown = bvme6000_parse_bootinfo(record);
187 else if (MACH_IS_MVME147) 181 else if (MACH_IS_MVME16x)
188 unknown = mvme147_parse_bootinfo(record); 182 unknown = mvme16x_parse_bootinfo(record);
189 else if (MACH_IS_HP300) 183 else if (MACH_IS_MVME147)
190 unknown = hp300_parse_bootinfo(record); 184 unknown = mvme147_parse_bootinfo(record);
191 else 185 else if (MACH_IS_HP300)
192 unknown = 1; 186 unknown = hp300_parse_bootinfo(record);
187 else
188 unknown = 1;
189 }
190 if (unknown)
191 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
192 record->tag);
193 record = (struct bi_record *)((unsigned long)record +
194 record->size);
193 } 195 }
194 if (unknown)
195 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
196 record->tag);
197 record = (struct bi_record *)((unsigned long)record+record->size);
198 }
199 196
200 m68k_realnum_memory = m68k_num_memory; 197 m68k_realnum_memory = m68k_num_memory;
201#ifdef CONFIG_SINGLE_MEMORY_CHUNK 198#ifdef CONFIG_SINGLE_MEMORY_CHUNK
202 if (m68k_num_memory > 1) { 199 if (m68k_num_memory > 1) {
203 printk("Ignoring last %i chunks of physical memory\n", 200 printk("Ignoring last %i chunks of physical memory\n",
204 (m68k_num_memory - 1)); 201 (m68k_num_memory - 1));
205 m68k_num_memory = 1; 202 m68k_num_memory = 1;
206 } 203 }
207 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET; 204 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
208#endif 205#endif
209} 206}
210 207
@@ -215,7 +212,6 @@ void __init setup_arch(char **cmdline_p)
215 unsigned long endmem, startmem; 212 unsigned long endmem, startmem;
216#endif 213#endif
217 int i; 214 int i;
218 char *p, *q;
219 215
220 /* The bootinfo is located right after the kernel bss */ 216 /* The bootinfo is located right after the kernel bss */
221 m68k_parse_bootinfo((const struct bi_record *)&_end); 217 m68k_parse_bootinfo((const struct bi_record *)&_end);
@@ -234,7 +230,7 @@ void __init setup_arch(char **cmdline_p)
234 /* clear the fpu if we have one */ 230 /* clear the fpu if we have one */
235 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) { 231 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
236 volatile int zero = 0; 232 volatile int zero = 0;
237 asm __volatile__ ("frestore %0" : : "m" (zero)); 233 asm volatile ("frestore %0" : : "m" (zero));
238 } 234 }
239#endif 235#endif
240 236
@@ -258,37 +254,7 @@ void __init setup_arch(char **cmdline_p)
258 *cmdline_p = m68k_command_line; 254 *cmdline_p = m68k_command_line;
259 memcpy(boot_command_line, *cmdline_p, CL_SIZE); 255 memcpy(boot_command_line, *cmdline_p, CL_SIZE);
260 256
261 /* Parse the command line for arch-specific options. 257 parse_early_param();
262 * For the m68k, this is currently only "debug=xxx" to enable printing
263 * certain kernel messages to some machine-specific device.
264 */
265 for( p = *cmdline_p; p && *p; ) {
266 i = 0;
267 if (!strncmp( p, "debug=", 6 )) {
268 strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) );
269 if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0;
270 i = 1;
271 }
272#ifdef CONFIG_ATARI
273 /* This option must be parsed very early */
274 if (!strncmp( p, "switches=", 9 )) {
275 extern void atari_switches_setup( const char *, int );
276 atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ?
277 (q - (p+9)) : strlen(p+9) );
278 i = 1;
279 }
280#endif
281
282 if (i) {
283 /* option processed, delete it */
284 if ((q = strchr( p, ' ' )))
285 strcpy( p, q+1 );
286 else
287 *p = 0;
288 } else {
289 if ((p = strchr( p, ' ' ))) ++p;
290 }
291 }
292 258
293#ifdef CONFIG_DUMMY_CONSOLE 259#ifdef CONFIG_DUMMY_CONSOLE
294 conswitchp = &dummy_con; 260 conswitchp = &dummy_con;
@@ -296,62 +262,62 @@ void __init setup_arch(char **cmdline_p)
296 262
297 switch (m68k_machtype) { 263 switch (m68k_machtype) {
298#ifdef CONFIG_AMIGA 264#ifdef CONFIG_AMIGA
299 case MACH_AMIGA: 265 case MACH_AMIGA:
300 config_amiga(); 266 config_amiga();
301 break; 267 break;
302#endif 268#endif
303#ifdef CONFIG_ATARI 269#ifdef CONFIG_ATARI
304 case MACH_ATARI: 270 case MACH_ATARI:
305 config_atari(); 271 config_atari();
306 break; 272 break;
307#endif 273#endif
308#ifdef CONFIG_MAC 274#ifdef CONFIG_MAC
309 case MACH_MAC: 275 case MACH_MAC:
310 config_mac(); 276 config_mac();
311 break; 277 break;
312#endif 278#endif
313#ifdef CONFIG_SUN3 279#ifdef CONFIG_SUN3
314 case MACH_SUN3: 280 case MACH_SUN3:
315 config_sun3(); 281 config_sun3();
316 break; 282 break;
317#endif 283#endif
318#ifdef CONFIG_APOLLO 284#ifdef CONFIG_APOLLO
319 case MACH_APOLLO: 285 case MACH_APOLLO:
320 config_apollo(); 286 config_apollo();
321 break; 287 break;
322#endif 288#endif
323#ifdef CONFIG_MVME147 289#ifdef CONFIG_MVME147
324 case MACH_MVME147: 290 case MACH_MVME147:
325 config_mvme147(); 291 config_mvme147();
326 break; 292 break;
327#endif 293#endif
328#ifdef CONFIG_MVME16x 294#ifdef CONFIG_MVME16x
329 case MACH_MVME16x: 295 case MACH_MVME16x:
330 config_mvme16x(); 296 config_mvme16x();
331 break; 297 break;
332#endif 298#endif
333#ifdef CONFIG_BVME6000 299#ifdef CONFIG_BVME6000
334 case MACH_BVME6000: 300 case MACH_BVME6000:
335 config_bvme6000(); 301 config_bvme6000();
336 break; 302 break;
337#endif 303#endif
338#ifdef CONFIG_HP300 304#ifdef CONFIG_HP300
339 case MACH_HP300: 305 case MACH_HP300:
340 config_hp300(); 306 config_hp300();
341 break; 307 break;
342#endif 308#endif
343#ifdef CONFIG_Q40 309#ifdef CONFIG_Q40
344 case MACH_Q40: 310 case MACH_Q40:
345 config_q40(); 311 config_q40();
346 break; 312 break;
347#endif 313#endif
348#ifdef CONFIG_SUN3X 314#ifdef CONFIG_SUN3X
349 case MACH_SUN3X: 315 case MACH_SUN3X:
350 config_sun3x(); 316 config_sun3x();
351 break; 317 break;
352#endif 318#endif
353 default: 319 default:
354 panic ("No configuration setup"); 320 panic("No configuration setup");
355 } 321 }
356 322
357#ifndef CONFIG_SUN3 323#ifndef CONFIG_SUN3
@@ -380,7 +346,7 @@ void __init setup_arch(char **cmdline_p)
380 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); 346 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size);
381 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 347 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
382 initrd_end = initrd_start + m68k_ramdisk.size; 348 initrd_end = initrd_start + m68k_ramdisk.size;
383 printk ("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 349 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
384 } 350 }
385#endif 351#endif
386 352
@@ -402,18 +368,18 @@ void __init setup_arch(char **cmdline_p)
402#if defined(CONFIG_ISA) && defined(MULTI_ISA) 368#if defined(CONFIG_ISA) && defined(MULTI_ISA)
403#if defined(CONFIG_Q40) 369#if defined(CONFIG_Q40)
404 if (MACH_IS_Q40) { 370 if (MACH_IS_Q40) {
405 isa_type = Q40_ISA; 371 isa_type = Q40_ISA;
406 isa_sex = 0; 372 isa_sex = 0;
407 } 373 }
408#elif defined(CONFIG_GG2) 374#elif defined(CONFIG_GG2)
409 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)){ 375 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)) {
410 isa_type = GG2_ISA; 376 isa_type = GG2_ISA;
411 isa_sex = 0; 377 isa_sex = 0;
412 } 378 }
413#elif defined(CONFIG_AMIGA_PCMCIA) 379#elif defined(CONFIG_AMIGA_PCMCIA)
414 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)){ 380 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
415 isa_type = AG_ISA; 381 isa_type = AG_ISA;
416 isa_sex = 1; 382 isa_sex = 1;
417 } 383 }
418#endif 384#endif
419#endif 385#endif
@@ -421,66 +387,66 @@ void __init setup_arch(char **cmdline_p)
421 387
422static int show_cpuinfo(struct seq_file *m, void *v) 388static int show_cpuinfo(struct seq_file *m, void *v)
423{ 389{
424 const char *cpu, *mmu, *fpu; 390 const char *cpu, *mmu, *fpu;
425 unsigned long clockfreq, clockfactor; 391 unsigned long clockfreq, clockfactor;
426 392
427#define LOOP_CYCLES_68020 (8) 393#define LOOP_CYCLES_68020 (8)
428#define LOOP_CYCLES_68030 (8) 394#define LOOP_CYCLES_68030 (8)
429#define LOOP_CYCLES_68040 (3) 395#define LOOP_CYCLES_68040 (3)
430#define LOOP_CYCLES_68060 (1) 396#define LOOP_CYCLES_68060 (1)
431 397
432 if (CPU_IS_020) { 398 if (CPU_IS_020) {
433 cpu = "68020"; 399 cpu = "68020";
434 clockfactor = LOOP_CYCLES_68020; 400 clockfactor = LOOP_CYCLES_68020;
435 } else if (CPU_IS_030) { 401 } else if (CPU_IS_030) {
436 cpu = "68030"; 402 cpu = "68030";
437 clockfactor = LOOP_CYCLES_68030; 403 clockfactor = LOOP_CYCLES_68030;
438 } else if (CPU_IS_040) { 404 } else if (CPU_IS_040) {
439 cpu = "68040"; 405 cpu = "68040";
440 clockfactor = LOOP_CYCLES_68040; 406 clockfactor = LOOP_CYCLES_68040;
441 } else if (CPU_IS_060) { 407 } else if (CPU_IS_060) {
442 cpu = "68060"; 408 cpu = "68060";
443 clockfactor = LOOP_CYCLES_68060; 409 clockfactor = LOOP_CYCLES_68060;
444 } else { 410 } else {
445 cpu = "680x0"; 411 cpu = "680x0";
446 clockfactor = 0; 412 clockfactor = 0;
447 } 413 }
448 414
449#ifdef CONFIG_M68KFPU_EMU_ONLY 415#ifdef CONFIG_M68KFPU_EMU_ONLY
450 fpu="none(soft float)"; 416 fpu = "none(soft float)";
451#else 417#else
452 if (m68k_fputype & FPU_68881) 418 if (m68k_fputype & FPU_68881)
453 fpu = "68881"; 419 fpu = "68881";
454 else if (m68k_fputype & FPU_68882) 420 else if (m68k_fputype & FPU_68882)
455 fpu = "68882"; 421 fpu = "68882";
456 else if (m68k_fputype & FPU_68040) 422 else if (m68k_fputype & FPU_68040)
457 fpu = "68040"; 423 fpu = "68040";
458 else if (m68k_fputype & FPU_68060) 424 else if (m68k_fputype & FPU_68060)
459 fpu = "68060"; 425 fpu = "68060";
460 else if (m68k_fputype & FPU_SUNFPA) 426 else if (m68k_fputype & FPU_SUNFPA)
461 fpu = "Sun FPA"; 427 fpu = "Sun FPA";
462 else 428 else
463 fpu = "none"; 429 fpu = "none";
464#endif 430#endif
465 431
466 if (m68k_mmutype & MMU_68851) 432 if (m68k_mmutype & MMU_68851)
467 mmu = "68851"; 433 mmu = "68851";
468 else if (m68k_mmutype & MMU_68030) 434 else if (m68k_mmutype & MMU_68030)
469 mmu = "68030"; 435 mmu = "68030";
470 else if (m68k_mmutype & MMU_68040) 436 else if (m68k_mmutype & MMU_68040)
471 mmu = "68040"; 437 mmu = "68040";
472 else if (m68k_mmutype & MMU_68060) 438 else if (m68k_mmutype & MMU_68060)
473 mmu = "68060"; 439 mmu = "68060";
474 else if (m68k_mmutype & MMU_SUN3) 440 else if (m68k_mmutype & MMU_SUN3)
475 mmu = "Sun-3"; 441 mmu = "Sun-3";
476 else if (m68k_mmutype & MMU_APOLLO) 442 else if (m68k_mmutype & MMU_APOLLO)
477 mmu = "Apollo"; 443 mmu = "Apollo";
478 else 444 else
479 mmu = "unknown"; 445 mmu = "unknown";
480 446
481 clockfreq = loops_per_jiffy*HZ*clockfactor; 447 clockfreq = loops_per_jiffy * HZ * clockfactor;
482 448
483 seq_printf(m, "CPU:\t\t%s\n" 449 seq_printf(m, "CPU:\t\t%s\n"
484 "MMU:\t\t%s\n" 450 "MMU:\t\t%s\n"
485 "FPU:\t\t%s\n" 451 "FPU:\t\t%s\n"
486 "Clocking:\t%lu.%1luMHz\n" 452 "Clocking:\t%lu.%1luMHz\n"
@@ -490,7 +456,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
490 clockfreq/1000000,(clockfreq/100000)%10, 456 clockfreq/1000000,(clockfreq/100000)%10,
491 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100, 457 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100,
492 loops_per_jiffy); 458 loops_per_jiffy);
493 return 0; 459 return 0;
494} 460}
495 461
496static void *c_start(struct seq_file *m, loff_t *pos) 462static void *c_start(struct seq_file *m, loff_t *pos)
@@ -506,44 +472,54 @@ static void c_stop(struct seq_file *m, void *v)
506{ 472{
507} 473}
508struct seq_operations cpuinfo_op = { 474struct seq_operations cpuinfo_op = {
509 .start = c_start, 475 .start = c_start,
510 .next = c_next, 476 .next = c_next,
511 .stop = c_stop, 477 .stop = c_stop,
512 .show = show_cpuinfo, 478 .show = show_cpuinfo,
513}; 479};
514 480
515int get_hardware_list(char *buffer) 481int get_hardware_list(char *buffer)
516{ 482{
517 int len = 0; 483 int len = 0;
518 char model[80]; 484 char model[80];
519 unsigned long mem; 485 unsigned long mem;
520 int i; 486 int i;
521 487
522 if (mach_get_model) 488 if (mach_get_model)
523 mach_get_model(model); 489 mach_get_model(model);
524 else 490 else
525 strcpy(model, "Unknown m68k"); 491 strcpy(model, "Unknown m68k");
526 492
527 len += sprintf(buffer+len, "Model:\t\t%s\n", model); 493 len += sprintf(buffer + len, "Model:\t\t%s\n", model);
528 for (mem = 0, i = 0; i < m68k_num_memory; i++) 494 for (mem = 0, i = 0; i < m68k_num_memory; i++)
529 mem += m68k_memory[i].size; 495 mem += m68k_memory[i].size;
530 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10); 496 len += sprintf(buffer + len, "System Memory:\t%ldK\n", mem >> 10);
531 497
532 if (mach_get_hardware_list) 498 if (mach_get_hardware_list)
533 len += mach_get_hardware_list(buffer+len); 499 len += mach_get_hardware_list(buffer + len);
534 500
535 return(len); 501 return len;
536} 502}
537 503
538void check_bugs(void) 504void check_bugs(void)
539{ 505{
540#ifndef CONFIG_M68KFPU_EMU 506#ifndef CONFIG_M68KFPU_EMU
541 if (m68k_fputype == 0) { 507 if (m68k_fputype == 0) {
542 printk( KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, " 508 printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
543 "WHICH IS REQUIRED BY LINUX/M68K ***\n" ); 509 "WHICH IS REQUIRED BY LINUX/M68K ***\n");
544 printk( KERN_EMERG "Upgrade your hardware or join the FPU " 510 printk(KERN_EMERG "Upgrade your hardware or join the FPU "
545 "emulation project\n" ); 511 "emulation project\n");
546 panic( "no FPU" ); 512 panic("no FPU");
547 } 513 }
548#endif /* !CONFIG_M68KFPU_EMU */ 514#endif /* !CONFIG_M68KFPU_EMU */
549} 515}
516
517#ifdef CONFIG_ADB
518static int __init adb_probe_sync_enable (char *str) {
519 extern int __adb_probe_sync;
520 __adb_probe_sync = 1;
521 return 1;
522}
523
524__setup("adb_sync", adb_probe_sync_enable);
525#endif /* CONFIG_ADB */
diff --git a/arch/m68k/lib/checksum.c b/arch/m68k/lib/checksum.c
index aed3be29e06b..cf6bb51945a2 100644
--- a/arch/m68k/lib/checksum.c
+++ b/arch/m68k/lib/checksum.c
@@ -320,6 +320,9 @@ csum_partial_copy_from_user(const void __user *src, void *dst,
320 return(sum); 320 return(sum);
321} 321}
322 322
323EXPORT_SYMBOL(csum_partial_copy_from_user);
324
325
323/* 326/*
324 * copy from kernel space while checksumming, otherwise like csum_partial 327 * copy from kernel space while checksumming, otherwise like csum_partial
325 */ 328 */
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index a1c7ec706741..673a1085984d 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -22,7 +22,7 @@
22/* #define DEBUG_BABOON */ 22/* #define DEBUG_BABOON */
23/* #define DEBUG_IRQS */ 23/* #define DEBUG_IRQS */
24 24
25int baboon_present,baboon_active; 25int baboon_present;
26volatile struct baboon *baboon; 26volatile struct baboon *baboon;
27 27
28irqreturn_t baboon_irq(int, void *); 28irqreturn_t baboon_irq(int, void *);
@@ -45,7 +45,6 @@ void __init baboon_init(void)
45 45
46 baboon = (struct baboon *) BABOON_BASE; 46 baboon = (struct baboon *) BABOON_BASE;
47 baboon_present = 1; 47 baboon_present = 1;
48 baboon_active = 0;
49 48
50 printk("Baboon detected at %p\n", baboon); 49 printk("Baboon detected at %p\n", baboon);
51} 50}
@@ -66,26 +65,28 @@ void __init baboon_register_interrupts(void)
66 65
67irqreturn_t baboon_irq(int irq, void *dev_id) 66irqreturn_t baboon_irq(int irq, void *dev_id)
68{ 67{
69 int irq_bit,i; 68 int irq_bit, irq_num;
70 unsigned char events; 69 unsigned char events;
71 70
72#ifdef DEBUG_IRQS 71#ifdef DEBUG_IRQS
73 printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X active %02X\n", 72 printk("baboon_irq: mb_control %02X mb_ifr %02X mb_status %02X\n",
74 (uint) baboon->mb_control, (uint) baboon->mb_ifr, 73 (uint) baboon->mb_control, (uint) baboon->mb_ifr,
75 (uint) baboon->mb_status, baboon_active); 74 (uint) baboon->mb_status);
76#endif 75#endif
77 76
78 if (!(events = baboon->mb_ifr & 0x07)) 77 if (!(events = baboon->mb_ifr & 0x07))
79 return IRQ_NONE; 78 return IRQ_NONE;
80 79
81 for (i = 0, irq_bit = 1 ; i < 3 ; i++, irq_bit <<= 1) { 80 irq_num = IRQ_BABOON_0;
82 if (events & irq_bit/* & baboon_active*/) { 81 irq_bit = 1;
83 baboon_active &= ~irq_bit; 82 do {
84 m68k_handle_int(IRQ_BABOON_0 + i); 83 if (events & irq_bit) {
85 baboon_active |= irq_bit;
86 baboon->mb_ifr &= ~irq_bit; 84 baboon->mb_ifr &= ~irq_bit;
85 m68k_handle_int(irq_num);
87 } 86 }
88 } 87 irq_bit <<= 1;
88 irq_num++;
89 } while(events >= irq_bit);
89#if 0 90#if 0
90 if (baboon->mb_ifr & 0x02) macide_ack_intr(NULL); 91 if (baboon->mb_ifr & 0x02) macide_ack_intr(NULL);
91 /* for now we need to smash all interrupts */ 92 /* for now we need to smash all interrupts */
@@ -95,21 +96,18 @@ irqreturn_t baboon_irq(int irq, void *dev_id)
95} 96}
96 97
97void baboon_irq_enable(int irq) { 98void baboon_irq_enable(int irq) {
98 int irq_idx = IRQ_IDX(irq);
99
100#ifdef DEBUG_IRQUSE 99#ifdef DEBUG_IRQUSE
101 printk("baboon_irq_enable(%d)\n", irq); 100 printk("baboon_irq_enable(%d)\n", irq);
102#endif 101#endif
103 baboon_active |= (1 << irq_idx); 102 /* FIXME: figure out how to mask and unmask baboon interrupt sources */
103 enable_irq(IRQ_NUBUS_C);
104} 104}
105 105
106void baboon_irq_disable(int irq) { 106void baboon_irq_disable(int irq) {
107 int irq_idx = IRQ_IDX(irq);
108
109#ifdef DEBUG_IRQUSE 107#ifdef DEBUG_IRQUSE
110 printk("baboon_irq_disable(%d)\n", irq); 108 printk("baboon_irq_disable(%d)\n", irq);
111#endif 109#endif
112 baboon_active &= ~(1 << irq_idx); 110 disable_irq(IRQ_NUBUS_C);
113} 111}
114 112
115void baboon_irq_clear(int irq) { 113void baboon_irq_clear(int irq) {
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 562b38d00180..5fd413246f89 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -59,15 +59,15 @@ extern struct mem_info m68k_ramdisk;
59 59
60extern char m68k_command_line[CL_SIZE]; 60extern char m68k_command_line[CL_SIZE];
61 61
62void *mac_env; /* Loaded by the boot asm */ 62void *mac_env; /* Loaded by the boot asm */
63 63
64/* The phys. video addr. - might be bogus on some machines */ 64/* The phys. video addr. - might be bogus on some machines */
65unsigned long mac_orig_videoaddr; 65unsigned long mac_orig_videoaddr;
66 66
67/* Mac specific timer functions */ 67/* Mac specific timer functions */
68extern unsigned long mac_gettimeoffset (void); 68extern unsigned long mac_gettimeoffset(void);
69extern int mac_hwclk (int, struct rtc_time *); 69extern int mac_hwclk(int, struct rtc_time *);
70extern int mac_set_clock_mmss (unsigned long); 70extern int mac_set_clock_mmss(unsigned long);
71extern int show_mac_interrupts(struct seq_file *, void *); 71extern int show_mac_interrupts(struct seq_file *, void *);
72extern void iop_preinit(void); 72extern void iop_preinit(void);
73extern void iop_init(void); 73extern void iop_init(void);
@@ -82,10 +82,6 @@ extern void mac_mksound(unsigned int, unsigned int);
82 82
83extern void nubus_sweep_video(void); 83extern void nubus_sweep_video(void);
84 84
85/* Mac specific debug functions (in debug.c) */
86extern void mac_debug_init(void);
87extern void mac_debugging_long(int, long);
88
89static void mac_get_model(char *str); 85static void mac_get_model(char *str);
90 86
91static void mac_sched_init(irq_handler_t vector) 87static void mac_sched_init(irq_handler_t vector)
@@ -99,51 +95,52 @@ static void mac_sched_init(irq_handler_t vector)
99 95
100int __init mac_parse_bootinfo(const struct bi_record *record) 96int __init mac_parse_bootinfo(const struct bi_record *record)
101{ 97{
102 int unknown = 0; 98 int unknown = 0;
103 const u_long *data = record->data; 99 const u_long *data = record->data;
104 100
105 switch (record->tag) { 101 switch (record->tag) {
106 case BI_MAC_MODEL: 102 case BI_MAC_MODEL:
107 mac_bi_data.id = *data; 103 mac_bi_data.id = *data;
108 break; 104 break;
109 case BI_MAC_VADDR: 105 case BI_MAC_VADDR:
110 mac_bi_data.videoaddr = *data; 106 mac_bi_data.videoaddr = *data;
111 break; 107 break;
112 case BI_MAC_VDEPTH: 108 case BI_MAC_VDEPTH:
113 mac_bi_data.videodepth = *data; 109 mac_bi_data.videodepth = *data;
114 break; 110 break;
115 case BI_MAC_VROW: 111 case BI_MAC_VROW:
116 mac_bi_data.videorow = *data; 112 mac_bi_data.videorow = *data;
117 break; 113 break;
118 case BI_MAC_VDIM: 114 case BI_MAC_VDIM:
119 mac_bi_data.dimensions = *data; 115 mac_bi_data.dimensions = *data;
120 break; 116 break;
121 case BI_MAC_VLOGICAL: 117 case BI_MAC_VLOGICAL:
122 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK); 118 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
123 mac_orig_videoaddr = *data; 119 mac_orig_videoaddr = *data;
124 break; 120 break;
125 case BI_MAC_SCCBASE: 121 case BI_MAC_SCCBASE:
126 mac_bi_data.sccbase = *data; 122 mac_bi_data.sccbase = *data;
127 break; 123 break;
128 case BI_MAC_BTIME: 124 case BI_MAC_BTIME:
129 mac_bi_data.boottime = *data; 125 mac_bi_data.boottime = *data;
130 break; 126 break;
131 case BI_MAC_GMTBIAS: 127 case BI_MAC_GMTBIAS:
132 mac_bi_data.gmtbias = *data; 128 mac_bi_data.gmtbias = *data;
133 break; 129 break;
134 case BI_MAC_MEMSIZE: 130 case BI_MAC_MEMSIZE:
135 mac_bi_data.memsize = *data; 131 mac_bi_data.memsize = *data;
136 break; 132 break;
137 case BI_MAC_CPUID: 133 case BI_MAC_CPUID:
138 mac_bi_data.cpuid = *data; 134 mac_bi_data.cpuid = *data;
139 break; 135 break;
140 case BI_MAC_ROMBASE: 136 case BI_MAC_ROMBASE:
141 mac_bi_data.rombase = *data; 137 mac_bi_data.rombase = *data;
142 break; 138 break;
143 default: 139 default:
144 unknown = 1; 140 unknown = 1;
145 } 141 break;
146 return(unknown); 142 }
143 return unknown;
147} 144}
148 145
149/* 146/*
@@ -155,6 +152,7 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
155static void mac_cache_card_flush(int writeback) 152static void mac_cache_card_flush(int writeback)
156{ 153{
157 unsigned long flags; 154 unsigned long flags;
155
158 local_irq_save(flags); 156 local_irq_save(flags);
159 via_flush_cache(); 157 via_flush_cache();
160 local_irq_restore(flags); 158 local_irq_restore(flags);
@@ -162,28 +160,24 @@ static void mac_cache_card_flush(int writeback)
162 160
163void __init config_mac(void) 161void __init config_mac(void)
164{ 162{
165 if (!MACH_IS_MAC) { 163 if (!MACH_IS_MAC)
166 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n"); 164 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
167 }
168 165
169 mach_sched_init = mac_sched_init; 166 mach_sched_init = mac_sched_init;
170 mach_init_IRQ = mac_init_IRQ; 167 mach_init_IRQ = mac_init_IRQ;
171 mach_get_model = mac_get_model; 168 mach_get_model = mac_get_model;
172 mach_gettimeoffset = mac_gettimeoffset; 169 mach_gettimeoffset = mac_gettimeoffset;
173#warning move to adb/via init 170#warning move to adb/via init
174#if 0 171#if 0
175 mach_hwclk = mac_hwclk; 172 mach_hwclk = mac_hwclk;
176#endif 173#endif
177 mach_set_clock_mmss = mac_set_clock_mmss; 174 mach_set_clock_mmss = mac_set_clock_mmss;
178 mach_reset = mac_reset; 175 mach_reset = mac_reset;
179 mach_halt = mac_poweroff; 176 mach_halt = mac_poweroff;
180 mach_power_off = mac_poweroff; 177 mach_power_off = mac_poweroff;
181 mach_max_dma_address = 0xffffffff; 178 mach_max_dma_address = 0xffffffff;
182#if 0
183 mach_debug_init = mac_debug_init;
184#endif
185#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 179#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
186 mach_beep = mac_mksound; 180 mach_beep = mac_mksound;
187#endif 181#endif
188#ifdef CONFIG_HEARTBEAT 182#ifdef CONFIG_HEARTBEAT
189#if 0 183#if 0
@@ -199,21 +193,22 @@ void __init config_mac(void)
199 mac_identify(); 193 mac_identify();
200 mac_report_hardware(); 194 mac_report_hardware();
201 195
202 /* AFAIK only the IIci takes a cache card. The IIfx has onboard 196 /*
203 cache ... someone needs to figure out how to tell if it's on or 197 * AFAIK only the IIci takes a cache card. The IIfx has onboard
204 not. */ 198 * cache ... someone needs to figure out how to tell if it's on or
199 * not.
200 */
205 201
206 if (macintosh_config->ident == MAC_MODEL_IICI 202 if (macintosh_config->ident == MAC_MODEL_IICI
207 || macintosh_config->ident == MAC_MODEL_IIFX) { 203 || macintosh_config->ident == MAC_MODEL_IIFX)
208 mach_l2_flush = mac_cache_card_flush; 204 mach_l2_flush = mac_cache_card_flush;
209 }
210 205
211 /* 206 /*
212 * Check for machine specific fixups. 207 * Check for machine specific fixups.
213 */ 208 */
214 209
215#ifdef OLD_NUBUS_CODE 210#ifdef OLD_NUBUS_CODE
216 nubus_sweep_video(); 211 nubus_sweep_video();
217#endif 212#endif
218} 213}
219 214
@@ -233,8 +228,7 @@ void __init config_mac(void)
233struct mac_model *macintosh_config; 228struct mac_model *macintosh_config;
234EXPORT_SYMBOL(macintosh_config); 229EXPORT_SYMBOL(macintosh_config);
235 230
236static struct mac_model mac_data_table[]= 231static struct mac_model mac_data_table[] = {
237{
238 /* 232 /*
239 * We'll pretend to be a Macintosh II, that's pretty safe. 233 * We'll pretend to be a Macintosh II, that's pretty safe.
240 */ 234 */
@@ -784,12 +778,12 @@ void mac_identify(void)
784 if (!model) { 778 if (!model) {
785 /* no bootinfo model id -> NetBSD booter was used! */ 779 /* no bootinfo model id -> NetBSD booter was used! */
786 /* XXX FIXME: breaks for model > 31 */ 780 /* XXX FIXME: breaks for model > 31 */
787 model=(mac_bi_data.cpuid>>2)&63; 781 model = (mac_bi_data.cpuid >> 2) & 63;
788 printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n"); 782 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
789 } 783 }
790 784
791 macintosh_config = mac_data_table; 785 macintosh_config = mac_data_table;
792 for (m = macintosh_config ; m->ident != -1 ; m++) { 786 for (m = macintosh_config; m->ident != -1; m++) {
793 if (m->ident == model) { 787 if (m->ident == model) {
794 macintosh_config = m; 788 macintosh_config = m;
795 break; 789 break;
@@ -801,27 +795,26 @@ void mac_identify(void)
801 /* the serial ports set to "Faster" mode in MacOS. */ 795 /* the serial ports set to "Faster" mode in MacOS. */
802 796
803 iop_preinit(); 797 iop_preinit();
804 mac_debug_init();
805 798
806 printk (KERN_INFO "Detected Macintosh model: %d \n", model); 799 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
807 800
808 /* 801 /*
809 * Report booter data: 802 * Report booter data:
810 */ 803 */
811 printk (KERN_DEBUG " Penguin bootinfo data:\n"); 804 printk(KERN_DEBUG " Penguin bootinfo data:\n");
812 printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", 805 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
813 mac_bi_data.videoaddr, mac_bi_data.videorow, 806 mac_bi_data.videoaddr, mac_bi_data.videorow,
814 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, 807 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
815 mac_bi_data.dimensions >> 16); 808 mac_bi_data.dimensions >> 16);
816 printk (KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n", 809 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
817 mac_bi_data.videological, mac_orig_videoaddr, 810 mac_bi_data.videological, mac_orig_videoaddr,
818 mac_bi_data.sccbase); 811 mac_bi_data.sccbase);
819 printk (KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n", 812 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
820 mac_bi_data.boottime, mac_bi_data.gmtbias); 813 mac_bi_data.boottime, mac_bi_data.gmtbias);
821 printk (KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n", 814 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
822 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 815 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
823#if 0 816#if 0
824 printk ("Ramdisk: addr 0x%lx size 0x%lx\n", 817 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
825 m68k_ramdisk.addr, m68k_ramdisk.size); 818 m68k_ramdisk.addr, m68k_ramdisk.size);
826#endif 819#endif
827 820
@@ -830,22 +823,22 @@ void mac_identify(void)
830 */ 823 */
831 switch (macintosh_config->scsi_type) { 824 switch (macintosh_config->scsi_type) {
832 case MAC_SCSI_OLD: 825 case MAC_SCSI_OLD:
833 MACHW_SET(MAC_SCSI_80); 826 MACHW_SET(MAC_SCSI_80);
834 break; 827 break;
835 case MAC_SCSI_QUADRA: 828 case MAC_SCSI_QUADRA:
836 case MAC_SCSI_QUADRA2: 829 case MAC_SCSI_QUADRA2:
837 case MAC_SCSI_QUADRA3: 830 case MAC_SCSI_QUADRA3:
838 MACHW_SET(MAC_SCSI_96); 831 MACHW_SET(MAC_SCSI_96);
839 if ((macintosh_config->ident == MAC_MODEL_Q900) || 832 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
840 (macintosh_config->ident == MAC_MODEL_Q950)) 833 (macintosh_config->ident == MAC_MODEL_Q950))
841 MACHW_SET(MAC_SCSI_96_2); 834 MACHW_SET(MAC_SCSI_96_2);
842 break; 835 break;
843 default: 836 default:
844 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n"); 837 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n");
845 MACHW_SET(MAC_SCSI_80); 838 MACHW_SET(MAC_SCSI_80);
846 break; 839 break;
847
848 } 840 }
841
849 iop_init(); 842 iop_init();
850 via_init(); 843 via_init();
851 oss_init(); 844 oss_init();
@@ -860,6 +853,6 @@ void mac_report_hardware(void)
860 853
861static void mac_get_model(char *str) 854static void mac_get_model(char *str)
862{ 855{
863 strcpy(str,"Macintosh "); 856 strcpy(str, "Macintosh ");
864 strcat(str, macintosh_config->name); 857 strcat(str, macintosh_config->name);
865} 858}
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index 4eeb09dc0e8f..7a5bed5bdc57 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -27,10 +27,6 @@
27#include <asm/machw.h> 27#include <asm/machw.h>
28#include <asm/macints.h> 28#include <asm/macints.h>
29 29
30extern char m68k_debug_device[];
31
32extern struct compat_bootinfo compat_boot_info;
33
34extern unsigned long mac_videobase; 30extern unsigned long mac_videobase;
35extern unsigned long mac_videodepth; 31extern unsigned long mac_videodepth;
36extern unsigned long mac_rowbytes; 32extern unsigned long mac_rowbytes;
@@ -52,7 +48,7 @@ extern void mac_serial_print(const char *);
52 */ 48 */
53 49
54#ifdef DEBUG_SCREEN 50#ifdef DEBUG_SCREEN
55static int peng=0, line=0; 51static int peng, line;
56#endif 52#endif
57 53
58void mac_debugging_short(int pos, short num) 54void mac_debugging_short(int pos, short num)
@@ -74,15 +70,14 @@ void mac_debugging_short(int pos, short num)
74 } 70 }
75 71
76 /* calculate current offset */ 72 /* calculate current offset */
77 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) 73 pengoffset = (unsigned char *)mac_videobase +
78 +80*peng; 74 (150+line*2) * mac_rowbytes) + 80 * peng;
79 75
80 pptr=pengoffset; 76 pptr = pengoffset;
81 77
82 for(i=0;i<8*sizeof(short);i++) /* # of bits */ 78 for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */
83 {
84 /* value mask for bit i, reverse order */ 79 /* value mask for bit i, reverse order */
85 *pptr++ = (num & ( 1 << (8*sizeof(short)-i-1) ) ? 0xFF : 0x00); 80 *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00);
86 } 81 }
87 82
88 peng++; 83 peng++;
@@ -115,11 +110,10 @@ void mac_debugging_long(int pos, long addr)
115 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) 110 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
116 +80*peng; 111 +80*peng;
117 112
118 pptr=pengoffset; 113 pptr = pengoffset;
119 114
120 for(i=0;i<8*sizeof(long);i++) /* # of bits */ 115 for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */
121 { 116 *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00);
122 *pptr++ = (addr & ( 1 << (8*sizeof(long)-i-1) ) ? 0xFF : 0x00);
123 } 117 }
124 118
125 peng++; 119 peng++;
@@ -136,16 +130,15 @@ void mac_debugging_long(int pos, long addr)
136 * TODO: serial debug code 130 * TODO: serial debug code
137 */ 131 */
138 132
139struct mac_SCC 133struct mac_SCC {
140 { 134 u_char cha_b_ctrl;
141 u_char cha_b_ctrl; 135 u_char char_dummy1;
142 u_char char_dummy1; 136 u_char cha_a_ctrl;
143 u_char cha_a_ctrl; 137 u_char char_dummy2;
144 u_char char_dummy2; 138 u_char cha_b_data;
145 u_char cha_b_data; 139 u_char char_dummy3;
146 u_char char_dummy3; 140 u_char cha_a_data;
147 u_char cha_a_data; 141};
148 };
149 142
150# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) 143# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
151 144
@@ -158,9 +151,9 @@ int mac_SCC_reset_done;
158static int scc_port = -1; 151static int scc_port = -1;
159 152
160static struct console mac_console_driver = { 153static struct console mac_console_driver = {
161 .name = "debug", 154 .name = "debug",
162 .flags = CON_PRINTBUFFER, 155 .flags = CON_PRINTBUFFER,
163 .index = -1, 156 .index = -1,
164}; 157};
165 158
166/* 159/*
@@ -178,8 +171,8 @@ static struct console mac_console_driver = {
178 * this driver if Mac. 171 * this driver if Mac.
179 */ 172 */
180 173
181void mac_debug_console_write (struct console *co, const char *str, 174void mac_debug_console_write(struct console *co, const char *str,
182 unsigned int count) 175 unsigned int count)
183{ 176{
184 mac_serial_print(str); 177 mac_serial_print(str);
185} 178}
@@ -190,48 +183,50 @@ void mac_debug_console_write (struct console *co, const char *str,
190 183
191#define uSEC 1 184#define uSEC 1
192 185
193static inline void mac_sccb_out (char c) 186static inline void mac_sccb_out(char c)
194{ 187{
195 int i; 188 int i;
196 do { 189
197 for( i = uSEC; i > 0; --i ) 190 do {
191 for (i = uSEC; i > 0; --i)
192 barrier();
193 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
194 for (i = uSEC; i > 0; --i)
198 barrier(); 195 barrier();
199 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ 196 scc.cha_b_data = c;
200 for( i = uSEC; i > 0; --i )
201 barrier();
202 scc.cha_b_data = c;
203} 197}
204 198
205static inline void mac_scca_out (char c) 199static inline void mac_scca_out(char c)
206{ 200{
207 int i; 201 int i;
208 do { 202
209 for( i = uSEC; i > 0; --i ) 203 do {
204 for (i = uSEC; i > 0; --i)
205 barrier();
206 } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */
207 for (i = uSEC; i > 0; --i)
210 barrier(); 208 barrier();
211 } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */ 209 scc.cha_a_data = c;
212 for( i = uSEC; i > 0; --i )
213 barrier();
214 scc.cha_a_data = c;
215} 210}
216 211
217void mac_sccb_console_write (struct console *co, const char *str, 212void mac_sccb_console_write(struct console *co, const char *str,
218 unsigned int count) 213 unsigned int count)
219{ 214{
220 while (count--) { 215 while (count--) {
221 if (*str == '\n') 216 if (*str == '\n')
222 mac_sccb_out( '\r' ); 217 mac_sccb_out('\r');
223 mac_sccb_out( *str++ ); 218 mac_sccb_out(*str++);
224 } 219 }
225} 220}
226 221
227void mac_scca_console_write (struct console *co, const char *str, 222void mac_scca_console_write(struct console *co, const char *str,
228 unsigned int count) 223 unsigned int count)
229{ 224{
230 while (count--) { 225 while (count--) {
231 if (*str == '\n') 226 if (*str == '\n')
232 mac_scca_out( '\r' ); 227 mac_scca_out('\r');
233 mac_scca_out( *str++ ); 228 mac_scca_out(*str++);
234 } 229 }
235} 230}
236 231
237 232
@@ -239,41 +234,41 @@ void mac_scca_console_write (struct console *co, const char *str,
239 * SCC serial ports. They're used by the debugging interface, kgdb, and the 234 * SCC serial ports. They're used by the debugging interface, kgdb, and the
240 * serial console code. */ 235 * serial console code. */
241#define SCCB_WRITE(reg,val) \ 236#define SCCB_WRITE(reg,val) \
242 do { \ 237 do { \
243 int i; \ 238 int i; \
244 scc.cha_b_ctrl = (reg); \ 239 scc.cha_b_ctrl = (reg); \
245 for( i = uSEC; i > 0; --i ) \ 240 for (i = uSEC; i > 0; --i) \
246 barrier(); \ 241 barrier(); \
247 scc.cha_b_ctrl = (val); \ 242 scc.cha_b_ctrl = (val); \
248 for( i = uSEC; i > 0; --i ) \ 243 for (i = uSEC; i > 0; --i) \
249 barrier(); \ 244 barrier(); \
250 } while(0) 245 } while(0)
251 246
252#define SCCA_WRITE(reg,val) \ 247#define SCCA_WRITE(reg,val) \
253 do { \ 248 do { \
254 int i; \ 249 int i; \
255 scc.cha_a_ctrl = (reg); \ 250 scc.cha_a_ctrl = (reg); \
256 for( i = uSEC; i > 0; --i ) \ 251 for (i = uSEC; i > 0; --i) \
257 barrier(); \ 252 barrier(); \
258 scc.cha_a_ctrl = (val); \ 253 scc.cha_a_ctrl = (val); \
259 for( i = uSEC; i > 0; --i ) \ 254 for (i = uSEC; i > 0; --i) \
260 barrier(); \ 255 barrier(); \
261 } while(0) 256 } while(0)
262 257
263/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a 258/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
264 * delay of ~ 60us. */ 259 * delay of ~ 60us. */
265/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ 260/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/
266#define LONG_DELAY() \ 261#define LONG_DELAY() \
267 do { \ 262 do { \
268 int i; \ 263 int i; \
269 for( i = 60*uSEC; i > 0; --i ) \ 264 for (i = 60*uSEC; i > 0; --i) \
270 barrier(); \ 265 barrier(); \
271 } while(0) 266 } while(0)
272 267
273#ifndef CONFIG_SERIAL_CONSOLE 268#ifndef CONFIG_SERIAL_CONSOLE
274static void __init mac_init_scc_port( int cflag, int port ) 269static void __init mac_init_scc_port(int cflag, int port)
275#else 270#else
276void mac_init_scc_port( int cflag, int port ) 271void mac_init_scc_port(int cflag, int port)
277#endif 272#endif
278{ 273{
279 extern int mac_SCC_reset_done; 274 extern int mac_SCC_reset_done;
@@ -292,106 +287,102 @@ void mac_init_scc_port( int cflag, int port )
292 /* reg12 (BRG low) */ 287 /* reg12 (BRG low) */
293 { 94, 62, 46, 22, 10, 4, 1, 0, 0 }; 288 { 94, 62, 46, 22, 10, 4, 1, 0, 0 };
294 289
295 int baud = cflag & CBAUD; 290 int baud = cflag & CBAUD;
296 int clksrc, clkmode, div, reg3, reg5; 291 int clksrc, clkmode, div, reg3, reg5;
297 292
298 if (cflag & CBAUDEX) 293 if (cflag & CBAUDEX)
299 baud += B38400; 294 baud += B38400;
300 if (baud < B1200 || baud > B38400+2) 295 if (baud < B1200 || baud > B38400+2)
301 baud = B9600; /* use default 9600bps for non-implemented rates */ 296 baud = B9600; /* use default 9600bps for non-implemented rates */
302 baud -= B1200; /* tables starts at 1200bps */ 297 baud -= B1200; /* tables starts at 1200bps */
303 298
304 clksrc = clksrc_table[baud]; 299 clksrc = clksrc_table[baud];
305 clkmode = clkmode_table[baud]; 300 clkmode = clkmode_table[baud];
306 div = div_table[baud]; 301 div = div_table[baud];
307 302
308 reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40); 303 reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40);
309 reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */; 304 reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */;
310 305
311 if (port == 1) { 306 if (port == 1) {
312 (void)scc.cha_b_ctrl; /* reset reg pointer */ 307 (void)scc.cha_b_ctrl; /* reset reg pointer */
313 SCCB_WRITE( 9, 0xc0 ); /* reset */ 308 SCCB_WRITE(9, 0xc0); /* reset */
314 LONG_DELAY(); /* extra delay after WR9 access */ 309 LONG_DELAY(); /* extra delay after WR9 access */
315 SCCB_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 310 SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
311 0x04 /* 1 stopbit */ |
312 clkmode);
313 SCCB_WRITE(3, reg3);
314 SCCB_WRITE(5, reg5);
315 SCCB_WRITE(9, 0); /* no interrupts */
316 LONG_DELAY(); /* extra delay after WR9 access */
317 SCCB_WRITE(10, 0); /* NRZ mode */
318 SCCB_WRITE(11, clksrc); /* main clock source */
319 SCCB_WRITE(12, div); /* BRG value */
320 SCCB_WRITE(13, 0); /* BRG high byte */
321 SCCB_WRITE(14, 1);
322 SCCB_WRITE(3, reg3 | 1);
323 SCCB_WRITE(5, reg5 | 8);
324 } else if (port == 0) {
325 (void)scc.cha_a_ctrl; /* reset reg pointer */
326 SCCA_WRITE(9, 0xc0); /* reset */
327 LONG_DELAY(); /* extra delay after WR9 access */
328 SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
316 0x04 /* 1 stopbit */ | 329 0x04 /* 1 stopbit */ |
317 clkmode ); 330 clkmode);
318 SCCB_WRITE( 3, reg3 ); 331 SCCA_WRITE(3, reg3);
319 SCCB_WRITE( 5, reg5 ); 332 SCCA_WRITE(5, reg5);
320 SCCB_WRITE( 9, 0 ); /* no interrupts */ 333 SCCA_WRITE(9, 0); /* no interrupts */
321 LONG_DELAY(); /* extra delay after WR9 access */ 334 LONG_DELAY(); /* extra delay after WR9 access */
322 SCCB_WRITE( 10, 0 ); /* NRZ mode */ 335 SCCA_WRITE(10, 0); /* NRZ mode */
323 SCCB_WRITE( 11, clksrc ); /* main clock source */ 336 SCCA_WRITE(11, clksrc); /* main clock source */
324 SCCB_WRITE( 12, div ); /* BRG value */ 337 SCCA_WRITE(12, div); /* BRG value */
325 SCCB_WRITE( 13, 0 ); /* BRG high byte */ 338 SCCA_WRITE(13, 0); /* BRG high byte */
326 SCCB_WRITE( 14, 1 ); 339 SCCA_WRITE(14, 1);
327 SCCB_WRITE( 3, reg3 | 1 ); 340 SCCA_WRITE(3, reg3 | 1);
328 SCCB_WRITE( 5, reg5 | 8 ); 341 SCCA_WRITE(5, reg5 | 8);
329 } else if (port == 0) { 342 }
330 (void)scc.cha_a_ctrl; /* reset reg pointer */ 343
331 SCCA_WRITE( 9, 0xc0 ); /* reset */ 344 mac_SCC_reset_done = 1;
332 LONG_DELAY(); /* extra delay after WR9 access */ 345 mac_SCC_init_done = 1;
333 SCCA_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
334 0x04 /* 1 stopbit */ |
335 clkmode );
336 SCCA_WRITE( 3, reg3 );
337 SCCA_WRITE( 5, reg5 );
338 SCCA_WRITE( 9, 0 ); /* no interrupts */
339 LONG_DELAY(); /* extra delay after WR9 access */
340 SCCA_WRITE( 10, 0 ); /* NRZ mode */
341 SCCA_WRITE( 11, clksrc ); /* main clock source */
342 SCCA_WRITE( 12, div ); /* BRG value */
343 SCCA_WRITE( 13, 0 ); /* BRG high byte */
344 SCCA_WRITE( 14, 1 );
345 SCCA_WRITE( 3, reg3 | 1 );
346 SCCA_WRITE( 5, reg5 | 8 );
347 }
348
349 mac_SCC_reset_done = 1;
350 mac_SCC_init_done = 1;
351} 346}
352#endif /* DEBUG_SERIAL */ 347#endif /* DEBUG_SERIAL */
353 348
354void mac_init_scca_port( int cflag ) 349void mac_init_scca_port(int cflag)
355{ 350{
356 mac_init_scc_port(cflag, 0); 351 mac_init_scc_port(cflag, 0);
357} 352}
358 353
359void mac_init_sccb_port( int cflag ) 354void mac_init_sccb_port(int cflag)
360{ 355{
361 mac_init_scc_port(cflag, 1); 356 mac_init_scc_port(cflag, 1);
362} 357}
363 358
364void __init mac_debug_init(void) 359static int __init mac_debug_setup(char *arg)
365{ 360{
361 if (!MACH_IS_MAC)
362 return 0;
363
366#ifdef DEBUG_SERIAL 364#ifdef DEBUG_SERIAL
367 if ( !strcmp( m68k_debug_device, "ser" ) 365 if (!strcmp(arg, "ser") || !strcmp(arg, "ser1")) {
368 || !strcmp( m68k_debug_device, "ser1" )) { 366 /* Mac modem port */
369 /* Mac modem port */ 367 mac_init_scc_port(B9600|CS8, 0);
370 mac_init_scc_port( B9600|CS8, 0 ); 368 mac_console_driver.write = mac_scca_console_write;
371 mac_console_driver.write = mac_scca_console_write; 369 scc_port = 0;
372 scc_port = 0; 370 } else if (!strcmp(arg, "ser2")) {
373 } 371 /* Mac printer port */
374 else if (!strcmp( m68k_debug_device, "ser2" )) { 372 mac_init_scc_port(B9600|CS8, 1);
375 /* Mac printer port */ 373 mac_console_driver.write = mac_sccb_console_write;
376 mac_init_scc_port( B9600|CS8, 1 ); 374 scc_port = 1;
377 mac_console_driver.write = mac_sccb_console_write; 375 }
378 scc_port = 1;
379 }
380#endif 376#endif
381#ifdef DEBUG_HEADS 377#ifdef DEBUG_HEADS
382 if ( !strcmp( m68k_debug_device, "scn" ) 378 if (!strcmp(arg, "scn") || !strcmp(arg, "con")) {
383 || !strcmp( m68k_debug_device, "con" )) { 379 /* display, using head.S console routines */
384 /* display, using head.S console routines */ 380 mac_console_driver.write = mac_debug_console_write;
385 mac_console_driver.write = mac_debug_console_write; 381 }
386 }
387#endif 382#endif
388 if (mac_console_driver.write) 383 if (mac_console_driver.write)
389 register_console(&mac_console_driver); 384 register_console(&mac_console_driver);
385 return 0;
390} 386}
391 387
392/* 388early_param("debug", mac_debug_setup);
393 * Local variables:
394 * c-indent-level: 4
395 * tab-width: 8
396 * End:
397 */
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index 63690819565a..d7be16917efd 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -109,13 +109,11 @@ irqreturn_t oss_irq(int irq, void *dev_id)
109 /* FIXME: how do you clear a pending IRQ? */ 109 /* FIXME: how do you clear a pending IRQ? */
110 110
111 if (events & OSS_IP_SOUND) { 111 if (events & OSS_IP_SOUND) {
112 /* FIXME: call sound handler */
113 oss->irq_pending &= ~OSS_IP_SOUND; 112 oss->irq_pending &= ~OSS_IP_SOUND;
113 /* FIXME: call sound handler */
114 } else if (events & OSS_IP_SCSI) { 114 } else if (events & OSS_IP_SCSI) {
115 oss->irq_level[OSS_SCSI] = OSS_IRQLEV_DISABLED;
116 m68k_handle_int(IRQ_MAC_SCSI);
117 oss->irq_pending &= ~OSS_IP_SCSI; 115 oss->irq_pending &= ~OSS_IP_SCSI;
118 oss->irq_level[OSS_SCSI] = OSS_IRQLEV_SCSI; 116 m68k_handle_int(IRQ_MAC_SCSI);
119 } else { 117 } else {
120 /* FIXME: error check here? */ 118 /* FIXME: error check here? */
121 } 119 }
@@ -143,14 +141,16 @@ irqreturn_t oss_nubus_irq(int irq, void *dev_id)
143#endif 141#endif
144 /* There are only six slots on the OSS, not seven */ 142 /* There are only six slots on the OSS, not seven */
145 143
146 for (i = 0, irq_bit = 1 ; i < 6 ; i++, irq_bit <<= 1) { 144 i = 6;
145 irq_bit = 0x40;
146 do {
147 --i;
148 irq_bit >>= 1;
147 if (events & irq_bit) { 149 if (events & irq_bit) {
148 oss->irq_level[i] = OSS_IRQLEV_DISABLED;
149 m68k_handle_int(NUBUS_SOURCE_BASE + i);
150 oss->irq_pending &= ~irq_bit; 150 oss->irq_pending &= ~irq_bit;
151 oss->irq_level[i] = OSS_IRQLEV_NUBUS; 151 m68k_handle_int(NUBUS_SOURCE_BASE + i);
152 } 152 }
153 } 153 } while(events & (irq_bit - 1));
154 return IRQ_HANDLED; 154 return IRQ_HANDLED;
155} 155}
156 156
diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
index 15378a5878c9..d66f723b17c3 100644
--- a/arch/m68k/mac/psc.c
+++ b/arch/m68k/mac/psc.c
@@ -131,11 +131,8 @@ irqreturn_t psc_irq(int irq, void *dev_id)
131{ 131{
132 int pIFR = pIFRbase + ((int) dev_id); 132 int pIFR = pIFRbase + ((int) dev_id);
133 int pIER = pIERbase + ((int) dev_id); 133 int pIER = pIERbase + ((int) dev_id);
134 int base_irq; 134 int irq_num;
135 int irq_bit,i; 135 unsigned char irq_bit, events;
136 unsigned char events;
137
138 base_irq = irq << 3;
139 136
140#ifdef DEBUG_IRQS 137#ifdef DEBUG_IRQS
141 printk("psc_irq: irq %d pIFR = 0x%02X pIER = 0x%02X\n", 138 printk("psc_irq: irq %d pIFR = 0x%02X pIER = 0x%02X\n",
@@ -146,14 +143,16 @@ irqreturn_t psc_irq(int irq, void *dev_id)
146 if (!events) 143 if (!events)
147 return IRQ_NONE; 144 return IRQ_NONE;
148 145
149 for (i = 0, irq_bit = 1 ; i < 4 ; i++, irq_bit <<= 1) { 146 irq_num = irq << 3;
150 if (events & irq_bit) { 147 irq_bit = 1;
151 psc_write_byte(pIER, irq_bit); 148 do {
152 m68k_handle_int(base_irq + i); 149 if (events & irq_bit) {
153 psc_write_byte(pIFR, irq_bit); 150 psc_write_byte(pIFR, irq_bit);
154 psc_write_byte(pIER, irq_bit | 0x80); 151 m68k_handle_int(irq_num);
155 } 152 }
156 } 153 irq_num++;
154 irq_bit <<= 1;
155 } while (events >= irq_bit);
157 return IRQ_HANDLED; 156 return IRQ_HANDLED;
158} 157}
159 158
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index e27735be2924..d5cac72eb3db 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -13,6 +13,10 @@
13 * for info. A full-text web search on 6522 AND VIA will probably also 13 * for info. A full-text web search on 6522 AND VIA will probably also
14 * net some usefulness. <cananian@alumni.princeton.edu> 20apr1999 14 * net some usefulness. <cananian@alumni.princeton.edu> 20apr1999
15 * 15 *
16 * Additional data is here (the SY6522 was used in the Mac II etc):
17 * http://www.6502.org/documents/datasheets/synertek/synertek_sy6522.pdf
18 * http://www.6502.org/documents/datasheets/synertek/synertek_sy6522_programming_reference.pdf
19 *
16 * PRAM/RTC access algorithms are from the NetBSD RTC toolkit version 1.08b 20 * PRAM/RTC access algorithms are from the NetBSD RTC toolkit version 1.08b
17 * by Erik Vogan and adapted to Linux by Joshua M. Thompson (funaho@jurai.org) 21 * by Erik Vogan and adapted to Linux by Joshua M. Thompson (funaho@jurai.org)
18 * 22 *
@@ -37,7 +41,7 @@ volatile __u8 *via1, *via2;
37/* See note in mac_via.h about how this is possibly not useful */ 41/* See note in mac_via.h about how this is possibly not useful */
38volatile long *via_memory_bogon=(long *)&via_memory_bogon; 42volatile long *via_memory_bogon=(long *)&via_memory_bogon;
39#endif 43#endif
40int rbv_present,via_alt_mapping; 44int rbv_present, via_alt_mapping;
41__u8 rbv_clear; 45__u8 rbv_clear;
42 46
43/* 47/*
@@ -60,7 +64,19 @@ static int gIER,gIFR,gBufA,gBufB;
60#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF) 64#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)
61#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8) 65#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8)
62 66
63static int nubus_active; 67/* To disable a NuBus slot on Quadras we make the slot IRQ lines outputs, set
68 * high. On RBV we just use the slot interrupt enable register. On Macs with
69 * genuine VIA chips we must use nubus_disabled to keep track of disabled slot
70 * interrupts. When any slot IRQ is disabled we mask the (edge triggered) CA1
71 * or "SLOTS" interrupt. When no slot is disabled, we unmask the CA1 interrupt.
72 * So, on genuine VIAs, having more than one NuBus IRQ can mean trouble,
73 * because closing one of those drivers can mask all of the NuBus interrupts.
74 * Also, since we can't mask the unregistered slot IRQs on genuine VIAs, it's
75 * possible to get interrupts from cards that MacOS or the ROM has configured
76 * but we have not. FWIW, "Designing Cards and Drivers for Macintosh II and
77 * Macintosh SE", page 9-8, says, a slot IRQ with no driver would crash MacOS.
78 */
79static u8 nubus_disabled;
64 80
65void via_debug_dump(void); 81void via_debug_dump(void);
66irqreturn_t via1_irq(int, void *); 82irqreturn_t via1_irq(int, void *);
@@ -138,11 +154,11 @@ void __init via_init(void)
138 154
139 printk(KERN_INFO "VIA2 at %p is ", via2); 155 printk(KERN_INFO "VIA2 at %p is ", via2);
140 if (rbv_present) { 156 if (rbv_present) {
141 printk(KERN_INFO "an RBV\n"); 157 printk("an RBV\n");
142 } else if (oss_present) { 158 } else if (oss_present) {
143 printk(KERN_INFO "an OSS\n"); 159 printk("an OSS\n");
144 } else { 160 } else {
145 printk(KERN_INFO "a 6522 or clone\n"); 161 printk("a 6522 or clone\n");
146 } 162 }
147 163
148#ifdef DEBUG_VIA 164#ifdef DEBUG_VIA
@@ -163,6 +179,7 @@ void __init via_init(void)
163 via1[vT2CL] = 0; 179 via1[vT2CL] = 0;
164 via1[vT2CH] = 0; 180 via1[vT2CH] = 0;
165 via1[vACR] &= 0x3F; 181 via1[vACR] &= 0x3F;
182 via1[vACR] &= ~0x03; /* disable port A & B latches */
166 183
167 /* 184 /*
168 * SE/30: disable video IRQ 185 * SE/30: disable video IRQ
@@ -193,8 +210,14 @@ void __init via_init(void)
193 /* that the IIfx emulates this alternate mapping using the OSS. */ 210 /* that the IIfx emulates this alternate mapping using the OSS. */
194 211
195 switch(macintosh_config->ident) { 212 switch(macintosh_config->ident) {
213 case MAC_MODEL_P475:
214 case MAC_MODEL_P475F:
215 case MAC_MODEL_P575:
216 case MAC_MODEL_Q605:
217 case MAC_MODEL_Q605_ACC:
196 case MAC_MODEL_C610: 218 case MAC_MODEL_C610:
197 case MAC_MODEL_Q610: 219 case MAC_MODEL_Q610:
220 case MAC_MODEL_Q630:
198 case MAC_MODEL_C650: 221 case MAC_MODEL_C650:
199 case MAC_MODEL_Q650: 222 case MAC_MODEL_Q650:
200 case MAC_MODEL_Q700: 223 case MAC_MODEL_Q700:
@@ -228,6 +251,22 @@ void __init via_init(void)
228 via2[vT2CL] = 0; 251 via2[vT2CL] = 0;
229 via2[vT2CH] = 0; 252 via2[vT2CH] = 0;
230 via2[vACR] &= 0x3F; 253 via2[vACR] &= 0x3F;
254 via2[vACR] &= ~0x03; /* disable port A & B latches */
255 }
256
257 /*
258 * Set vPCR for SCSI interrupts (but not on RBV)
259 */
260 if (!rbv_present) {
261 if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
262 /* CB2 (IRQ) indep. input, positive edge */
263 /* CA2 (DRQ) indep. input, positive edge */
264 via2[vPCR] = 0x66;
265 } else {
266 /* CB2 (IRQ) indep. input, negative edge */
267 /* CA2 (DRQ) indep. input, negative edge */
268 via2[vPCR] = 0x22;
269 }
231 } 270 }
232} 271}
233 272
@@ -356,78 +395,75 @@ int via_get_cache_disable(void)
356 395
357void __init via_nubus_init(void) 396void __init via_nubus_init(void)
358{ 397{
359 /* don't set nubus_active = 0 here, it kills the Baboon */
360 /* interrupt that we've already registered. */
361
362 /* unlock nubus transactions */ 398 /* unlock nubus transactions */
363 399
364 if (!rbv_present) { 400 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
401 (macintosh_config->adb_type != MAC_ADB_PB2)) {
365 /* set the line to be an output on non-RBV machines */ 402 /* set the line to be an output on non-RBV machines */
366 if ((macintosh_config->adb_type != MAC_ADB_PB1) && 403 if (!rbv_present)
367 (macintosh_config->adb_type != MAC_ADB_PB2)) {
368 via2[vDirB] |= 0x02; 404 via2[vDirB] |= 0x02;
369 }
370 }
371 405
372 /* this seems to be an ADB bit on PMU machines */ 406 /* this seems to be an ADB bit on PMU machines */
373 /* according to MkLinux. -- jmt */ 407 /* according to MkLinux. -- jmt */
374
375 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
376 (macintosh_config->adb_type != MAC_ADB_PB2)) {
377 via2[gBufB] |= 0x02; 408 via2[gBufB] |= 0x02;
378 } 409 }
379 410
380 /* disable nubus slot interrupts. */ 411 /* Disable all the slot interrupts (where possible). */
381 if (rbv_present) { 412
413 switch (macintosh_config->via_type) {
414 case MAC_VIA_II:
415 /* Just make the port A lines inputs. */
416 switch(macintosh_config->ident) {
417 case MAC_MODEL_II:
418 case MAC_MODEL_IIX:
419 case MAC_MODEL_IICX:
420 case MAC_MODEL_SE30:
421 /* The top two bits are RAM size outputs. */
422 via2[vDirA] &= 0xC0;
423 break;
424 default:
425 via2[vDirA] &= 0x80;
426 }
427 break;
428 case MAC_VIA_IIci:
429 /* RBV. Disable all the slot interrupts. SIER works like IER. */
382 via2[rSIER] = 0x7F; 430 via2[rSIER] = 0x7F;
383 via2[rSIER] = nubus_active | 0x80; 431 break;
384 } else { 432 case MAC_VIA_QUADRA:
385 /* These are ADB bits on PMU */ 433 /* Disable the inactive slot interrupts by making those lines outputs. */
386 if ((macintosh_config->adb_type != MAC_ADB_PB1) && 434 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
387 (macintosh_config->adb_type != MAC_ADB_PB2)) { 435 (macintosh_config->adb_type != MAC_ADB_PB2)) {
388 switch(macintosh_config->ident) 436 via2[vBufA] |= 0x7F;
389 { 437 via2[vDirA] |= 0x7F;
390 case MAC_MODEL_II:
391 case MAC_MODEL_IIX:
392 case MAC_MODEL_IICX:
393 case MAC_MODEL_SE30:
394 via2[vBufA] |= 0x3F;
395 via2[vDirA] = ~nubus_active | 0xc0;
396 break;
397 default:
398 via2[vBufA] = 0xFF;
399 via2[vDirA] = ~nubus_active;
400 }
401 } 438 }
439 break;
402 } 440 }
403} 441}
404 442
405/* 443/*
406 * The generic VIA interrupt routines (shamelessly stolen from Alan Cox's 444 * The generic VIA interrupt routines (shamelessly stolen from Alan Cox's
407 * via6522.c :-), disable/pending masks added. 445 * via6522.c :-), disable/pending masks added.
408 *
409 * The new interrupt architecture in macints.c takes care of a lot of the
410 * gruntwork for us, including tallying the interrupts and calling the
411 * handlers on the linked list. All we need to do here is basically generate
412 * the machspec interrupt number after clearing the interrupt.
413 */ 446 */
414 447
415irqreturn_t via1_irq(int irq, void *dev_id) 448irqreturn_t via1_irq(int irq, void *dev_id)
416{ 449{
417 int irq_bit, i; 450 int irq_num;
418 unsigned char events, mask; 451 unsigned char irq_bit, events;
419 452
420 mask = via1[vIER] & 0x7F; 453 events = via1[vIFR] & via1[vIER] & 0x7F;
421 if (!(events = via1[vIFR] & mask)) 454 if (!events)
422 return IRQ_NONE; 455 return IRQ_NONE;
423 456
424 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) 457 irq_num = VIA1_SOURCE_BASE;
458 irq_bit = 1;
459 do {
425 if (events & irq_bit) { 460 if (events & irq_bit) {
426 via1[vIER] = irq_bit;
427 m68k_handle_int(VIA1_SOURCE_BASE + i);
428 via1[vIFR] = irq_bit; 461 via1[vIFR] = irq_bit;
429 via1[vIER] = irq_bit | 0x80; 462 m68k_handle_int(irq_num);
430 } 463 }
464 ++irq_num;
465 irq_bit <<= 1;
466 } while (events >= irq_bit);
431 467
432#if 0 /* freakin' pmu is doing weird stuff */ 468#if 0 /* freakin' pmu is doing weird stuff */
433 if (!oss_present) { 469 if (!oss_present) {
@@ -448,20 +484,23 @@ irqreturn_t via1_irq(int irq, void *dev_id)
448 484
449irqreturn_t via2_irq(int irq, void *dev_id) 485irqreturn_t via2_irq(int irq, void *dev_id)
450{ 486{
451 int irq_bit, i; 487 int irq_num;
452 unsigned char events, mask; 488 unsigned char irq_bit, events;
453 489
454 mask = via2[gIER] & 0x7F; 490 events = via2[gIFR] & via2[gIER] & 0x7F;
455 if (!(events = via2[gIFR] & mask)) 491 if (!events)
456 return IRQ_NONE; 492 return IRQ_NONE;
457 493
458 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) 494 irq_num = VIA2_SOURCE_BASE;
495 irq_bit = 1;
496 do {
459 if (events & irq_bit) { 497 if (events & irq_bit) {
460 via2[gIER] = irq_bit;
461 via2[gIFR] = irq_bit | rbv_clear; 498 via2[gIFR] = irq_bit | rbv_clear;
462 m68k_handle_int(VIA2_SOURCE_BASE + i); 499 m68k_handle_int(irq_num);
463 via2[gIER] = irq_bit | 0x80;
464 } 500 }
501 ++irq_num;
502 irq_bit <<= 1;
503 } while (events >= irq_bit);
465 return IRQ_HANDLED; 504 return IRQ_HANDLED;
466} 505}
467 506
@@ -472,71 +511,75 @@ irqreturn_t via2_irq(int irq, void *dev_id)
472 511
473irqreturn_t via_nubus_irq(int irq, void *dev_id) 512irqreturn_t via_nubus_irq(int irq, void *dev_id)
474{ 513{
475 int irq_bit, i; 514 int slot_irq;
476 unsigned char events; 515 unsigned char slot_bit, events;
477 516
478 if (!(events = ~via2[gBufA] & nubus_active)) 517 events = ~via2[gBufA] & 0x7F;
518 if (rbv_present)
519 events &= via2[rSIER];
520 else
521 events &= ~via2[vDirA];
522 if (!events)
479 return IRQ_NONE; 523 return IRQ_NONE;
480 524
481 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) { 525 do {
482 if (events & irq_bit) { 526 slot_irq = IRQ_NUBUS_F;
483 via_irq_disable(NUBUS_SOURCE_BASE + i); 527 slot_bit = 0x40;
484 m68k_handle_int(NUBUS_SOURCE_BASE + i); 528 do {
485 via_irq_enable(NUBUS_SOURCE_BASE + i); 529 if (events & slot_bit) {
486 } 530 events &= ~slot_bit;
487 } 531 m68k_handle_int(slot_irq);
532 }
533 --slot_irq;
534 slot_bit >>= 1;
535 } while (events);
536
537 /* clear the CA1 interrupt and make certain there's no more. */
538 via2[gIFR] = 0x02 | rbv_clear;
539 events = ~via2[gBufA] & 0x7F;
540 if (rbv_present)
541 events &= via2[rSIER];
542 else
543 events &= ~via2[vDirA];
544 } while (events);
488 return IRQ_HANDLED; 545 return IRQ_HANDLED;
489} 546}
490 547
491void via_irq_enable(int irq) { 548void via_irq_enable(int irq) {
492 int irq_src = IRQ_SRC(irq); 549 int irq_src = IRQ_SRC(irq);
493 int irq_idx = IRQ_IDX(irq); 550 int irq_idx = IRQ_IDX(irq);
494 int irq_bit = 1 << irq_idx;
495 551
496#ifdef DEBUG_IRQUSE 552#ifdef DEBUG_IRQUSE
497 printk(KERN_DEBUG "via_irq_enable(%d)\n", irq); 553 printk(KERN_DEBUG "via_irq_enable(%d)\n", irq);
498#endif 554#endif
499 555
500 if (irq_src == 1) { 556 if (irq_src == 1) {
501 via1[vIER] = irq_bit | 0x80; 557 via1[vIER] = IER_SET_BIT(irq_idx);
502 } else if (irq_src == 2) { 558 } else if (irq_src == 2) {
503 /* 559 if (irq != IRQ_MAC_NUBUS || nubus_disabled == 0)
504 * Set vPCR for SCSI interrupts (but not on RBV) 560 via2[gIER] = IER_SET_BIT(irq_idx);
505 */
506 if ((irq_idx == 0) && !rbv_present) {
507 if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
508 /* CB2 (IRQ) indep. input, positive edge */
509 /* CA2 (DRQ) indep. input, positive edge */
510 via2[vPCR] = 0x66;
511 } else {
512 /* CB2 (IRQ) indep. input, negative edge */
513 /* CA2 (DRQ) indep. input, negative edge */
514 via2[vPCR] = 0x22;
515 }
516 }
517 via2[gIER] = irq_bit | 0x80;
518 } else if (irq_src == 7) { 561 } else if (irq_src == 7) {
519 nubus_active |= irq_bit; 562 switch (macintosh_config->via_type) {
520 if (rbv_present) { 563 case MAC_VIA_II:
521 /* enable the slot interrupt. SIER works like IER. */ 564 nubus_disabled &= ~(1 << irq_idx);
565 /* Enable the CA1 interrupt when no slot is disabled. */
566 if (!nubus_disabled)
567 via2[gIER] = IER_SET_BIT(1);
568 break;
569 case MAC_VIA_IIci:
570 /* On RBV, enable the slot interrupt.
571 * SIER works like IER.
572 */
522 via2[rSIER] = IER_SET_BIT(irq_idx); 573 via2[rSIER] = IER_SET_BIT(irq_idx);
523 } else { 574 break;
524 /* Make sure the bit is an input, to enable the irq */ 575 case MAC_VIA_QUADRA:
525 /* But not on PowerBooks, that's ADB... */ 576 /* Make the port A line an input to enable the slot irq.
577 * But not on PowerBooks, that's ADB.
578 */
526 if ((macintosh_config->adb_type != MAC_ADB_PB1) && 579 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
527 (macintosh_config->adb_type != MAC_ADB_PB2)) { 580 (macintosh_config->adb_type != MAC_ADB_PB2))
528 switch(macintosh_config->ident) 581 via2[vDirA] &= ~(1 << irq_idx);
529 { 582 break;
530 case MAC_MODEL_II:
531 case MAC_MODEL_IIX:
532 case MAC_MODEL_IICX:
533 case MAC_MODEL_SE30:
534 via2[vDirA] &= (~irq_bit | 0xc0);
535 break;
536 default:
537 via2[vDirA] &= ~irq_bit;
538 }
539 }
540 } 583 }
541 } 584 }
542} 585}
@@ -544,29 +587,31 @@ void via_irq_enable(int irq) {
544void via_irq_disable(int irq) { 587void via_irq_disable(int irq) {
545 int irq_src = IRQ_SRC(irq); 588 int irq_src = IRQ_SRC(irq);
546 int irq_idx = IRQ_IDX(irq); 589 int irq_idx = IRQ_IDX(irq);
547 int irq_bit = 1 << irq_idx;
548 590
549#ifdef DEBUG_IRQUSE 591#ifdef DEBUG_IRQUSE
550 printk(KERN_DEBUG "via_irq_disable(%d)\n", irq); 592 printk(KERN_DEBUG "via_irq_disable(%d)\n", irq);
551#endif 593#endif
552 594
553 if (irq_src == 1) { 595 if (irq_src == 1) {
554 via1[vIER] = irq_bit; 596 via1[vIER] = IER_CLR_BIT(irq_idx);
555 } else if (irq_src == 2) { 597 } else if (irq_src == 2) {
556 via2[gIER] = irq_bit; 598 via2[gIER] = IER_CLR_BIT(irq_idx);
557 } else if (irq_src == 7) { 599 } else if (irq_src == 7) {
558 if (rbv_present) { 600 switch (macintosh_config->via_type) {
559 /* disable the slot interrupt. SIER works like IER. */ 601 case MAC_VIA_II:
602 nubus_disabled |= 1 << irq_idx;
603 if (nubus_disabled)
604 via2[gIER] = IER_CLR_BIT(1);
605 break;
606 case MAC_VIA_IIci:
560 via2[rSIER] = IER_CLR_BIT(irq_idx); 607 via2[rSIER] = IER_CLR_BIT(irq_idx);
561 } else { 608 break;
562 /* disable the nubus irq by changing dir to output */ 609 case MAC_VIA_QUADRA:
563 /* except on PMU */
564 if ((macintosh_config->adb_type != MAC_ADB_PB1) && 610 if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
565 (macintosh_config->adb_type != MAC_ADB_PB2)) { 611 (macintosh_config->adb_type != MAC_ADB_PB2))
566 via2[vDirA] |= irq_bit; 612 via2[vDirA] |= 1 << irq_idx;
567 } 613 break;
568 } 614 }
569 nubus_active &= ~irq_bit;
570 } 615 }
571} 616}
572 617
@@ -580,7 +625,9 @@ void via_irq_clear(int irq) {
580 } else if (irq_src == 2) { 625 } else if (irq_src == 2) {
581 via2[gIFR] = irq_bit | rbv_clear; 626 via2[gIFR] = irq_bit | rbv_clear;
582 } else if (irq_src == 7) { 627 } else if (irq_src == 7) {
583 /* FIXME: hmm.. */ 628 /* FIXME: There is no way to clear an individual nubus slot
629 * IRQ flag, other than getting the device to do it.
630 */
584 } 631 }
585} 632}
586 633
@@ -600,6 +647,7 @@ int via_irq_pending(int irq)
600 } else if (irq_src == 2) { 647 } else if (irq_src == 2) {
601 return via2[gIFR] & irq_bit; 648 return via2[gIFR] & irq_bit;
602 } else if (irq_src == 7) { 649 } else if (irq_src == 7) {
650 /* Always 0 for MAC_VIA_QUADRA if the slot irq is disabled. */
603 return ~via2[gBufA] & irq_bit; 651 return ~via2[gBufA] & irq_bit;
604 } 652 }
605 return 0; 653 return 0;
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 92f873cc7060..476e18eca758 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -35,35 +35,35 @@
35#include <asm/machdep.h> 35#include <asm/machdep.h>
36#include <asm/q40_master.h> 36#include <asm/q40_master.h>
37 37
38extern irqreturn_t q40_process_int (int level, struct pt_regs *regs); 38extern irqreturn_t q40_process_int(int level, struct pt_regs *regs);
39extern void q40_init_IRQ (void); 39extern void q40_init_IRQ(void);
40static void q40_get_model(char *model); 40static void q40_get_model(char *model);
41static int q40_get_hardware_list(char *buffer); 41static int q40_get_hardware_list(char *buffer);
42extern void q40_sched_init(irq_handler_t handler); 42extern void q40_sched_init(irq_handler_t handler);
43 43
44extern unsigned long q40_gettimeoffset (void); 44extern unsigned long q40_gettimeoffset(void);
45extern int q40_hwclk (int, struct rtc_time *); 45extern int q40_hwclk(int, struct rtc_time *);
46extern unsigned int q40_get_ss (void); 46extern unsigned int q40_get_ss(void);
47extern int q40_set_clock_mmss (unsigned long); 47extern int q40_set_clock_mmss(unsigned long);
48static int q40_get_rtc_pll(struct rtc_pll_info *pll); 48static int q40_get_rtc_pll(struct rtc_pll_info *pll);
49static int q40_set_rtc_pll(struct rtc_pll_info *pll); 49static int q40_set_rtc_pll(struct rtc_pll_info *pll);
50extern void q40_reset (void); 50extern void q40_reset(void);
51void q40_halt(void); 51void q40_halt(void);
52extern void q40_waitbut(void); 52extern void q40_waitbut(void);
53void q40_set_vectors (void); 53void q40_set_vectors(void);
54 54
55extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ ); 55extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/);
56 56
57extern char m68k_debug_device[];
58static void q40_mem_console_write(struct console *co, const char *b, 57static void q40_mem_console_write(struct console *co, const char *b,
59 unsigned int count); 58 unsigned int count);
60 59
61extern int ql_ticks; 60extern int ql_ticks;
62 61
63static struct console q40_console_driver = { 62static struct console q40_console_driver = {
64 .name = "debug", 63 .name = "debug",
65 .flags = CON_PRINTBUFFER, 64 .write = q40_mem_console_write,
66 .index = -1, 65 .flags = CON_PRINTBUFFER,
66 .index = -1,
67}; 67};
68 68
69 69
@@ -74,150 +74,162 @@ static int _cpleft;
74static void q40_mem_console_write(struct console *co, const char *s, 74static void q40_mem_console_write(struct console *co, const char *s,
75 unsigned int count) 75 unsigned int count)
76{ 76{
77 char *p=(char *)s; 77 const char *p = s;
78 78
79 if (count<_cpleft) 79 if (count < _cpleft) {
80 while (count-- >0){ 80 while (count-- > 0) {
81 *q40_mem_cptr=*p++; 81 *q40_mem_cptr = *p++;
82 q40_mem_cptr+=4; 82 q40_mem_cptr += 4;
83 _cpleft--; 83 _cpleft--;
84 } 84 }
85 }
86}
87
88static int __init q40_debug_setup(char *arg)
89{
90 /* useful for early debugging stages - writes kernel messages into SRAM */
91 if (MACH_IS_Q40 && !strncmp(arg, "mem", 3)) {
92 /*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/
93 _cpleft = 2000 - ((long)q40_mem_cptr-0xff020000) / 4;
94 register_console(&q40_console_driver);
95 }
96 return 0;
85} 97}
98
99early_param("debug", q40_debug_setup);
100
86#if 0 101#if 0
87void printq40(char *str) 102void printq40(char *str)
88{ 103{
89 int l=strlen(str); 104 int l = strlen(str);
90 char *p=q40_mem_cptr; 105 char *p = q40_mem_cptr;
91 106
92 while (l-- >0 && _cpleft-- >0) 107 while (l-- > 0 && _cpleft-- > 0) {
93 { 108 *p = *str++;
94 *p=*str++; 109 p += 4;
95 p+=4; 110 }
96 } 111 q40_mem_cptr = p;
97 q40_mem_cptr=p;
98} 112}
99#endif 113#endif
100 114
101static int halted=0; 115static int halted;
102 116
103#ifdef CONFIG_HEARTBEAT 117#ifdef CONFIG_HEARTBEAT
104static void q40_heartbeat(int on) 118static void q40_heartbeat(int on)
105{ 119{
106 if (halted) return; 120 if (halted)
121 return;
107 122
108 if (on) 123 if (on)
109 Q40_LED_ON(); 124 Q40_LED_ON();
110 else 125 else
111 Q40_LED_OFF(); 126 Q40_LED_OFF();
112} 127}
113#endif 128#endif
114 129
115void q40_reset(void) 130void q40_reset(void)
116{ 131{
117 halted=1; 132 halted = 1;
118 printk ("\n\n*******************************************\n" 133 printk("\n\n*******************************************\n"
119 "Called q40_reset : press the RESET button!! \n" 134 "Called q40_reset : press the RESET button!! \n"
120 "*******************************************\n"); 135 "*******************************************\n");
121 Q40_LED_ON(); 136 Q40_LED_ON();
122 while(1) ; 137 while (1)
138 ;
123} 139}
124void q40_halt(void) 140void q40_halt(void)
125{ 141{
126 halted=1; 142 halted = 1;
127 printk ("\n\n*******************\n" 143 printk("\n\n*******************\n"
128 " Called q40_halt\n" 144 " Called q40_halt\n"
129 "*******************\n"); 145 "*******************\n");
130 Q40_LED_ON(); 146 Q40_LED_ON();
131 while(1) ; 147 while (1)
148 ;
132} 149}
133 150
134static void q40_get_model(char *model) 151static void q40_get_model(char *model)
135{ 152{
136 sprintf(model, "Q40"); 153 sprintf(model, "Q40");
137} 154}
138 155
139/* No hardware options on Q40? */ 156/* No hardware options on Q40? */
140 157
141static int q40_get_hardware_list(char *buffer) 158static int q40_get_hardware_list(char *buffer)
142{ 159{
143 *buffer = '\0'; 160 *buffer = '\0';
144 return 0; 161 return 0;
145} 162}
146 163
147static unsigned int serports[]={0x3f8,0x2f8,0x3e8,0x2e8,0}; 164static unsigned int serports[] =
165{
166 0x3f8,0x2f8,0x3e8,0x2e8,0
167};
148void q40_disable_irqs(void) 168void q40_disable_irqs(void)
149{ 169{
150 unsigned i,j; 170 unsigned i, j;
151 171
152 j=0; 172 j = 0;
153 while((i=serports[j++])) outb(0,i+UART_IER); 173 while ((i = serports[j++]))
154 master_outb(0,EXT_ENABLE_REG); 174 outb(0, i + UART_IER);
155 master_outb(0,KEY_IRQ_ENABLE_REG); 175 master_outb(0, EXT_ENABLE_REG);
176 master_outb(0, KEY_IRQ_ENABLE_REG);
156} 177}
157 178
158void __init config_q40(void) 179void __init config_q40(void)
159{ 180{
160 mach_sched_init = q40_sched_init; 181 mach_sched_init = q40_sched_init;
161 182
162 mach_init_IRQ = q40_init_IRQ; 183 mach_init_IRQ = q40_init_IRQ;
163 mach_gettimeoffset = q40_gettimeoffset; 184 mach_gettimeoffset = q40_gettimeoffset;
164 mach_hwclk = q40_hwclk; 185 mach_hwclk = q40_hwclk;
165 mach_get_ss = q40_get_ss; 186 mach_get_ss = q40_get_ss;
166 mach_get_rtc_pll = q40_get_rtc_pll; 187 mach_get_rtc_pll = q40_get_rtc_pll;
167 mach_set_rtc_pll = q40_set_rtc_pll; 188 mach_set_rtc_pll = q40_set_rtc_pll;
168 mach_set_clock_mmss = q40_set_clock_mmss; 189 mach_set_clock_mmss = q40_set_clock_mmss;
169 190
170 mach_reset = q40_reset; 191 mach_reset = q40_reset;
171 mach_get_model = q40_get_model; 192 mach_get_model = q40_get_model;
172 mach_get_hardware_list = q40_get_hardware_list; 193 mach_get_hardware_list = q40_get_hardware_list;
173 194
174#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 195#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
175 mach_beep = q40_mksound; 196 mach_beep = q40_mksound;
176#endif 197#endif
177#ifdef CONFIG_HEARTBEAT 198#ifdef CONFIG_HEARTBEAT
178 mach_heartbeat = q40_heartbeat; 199 mach_heartbeat = q40_heartbeat;
179#endif 200#endif
180 mach_halt = q40_halt; 201 mach_halt = q40_halt;
181 202
182 /* disable a few things that SMSQ might have left enabled */ 203 /* disable a few things that SMSQ might have left enabled */
183 q40_disable_irqs(); 204 q40_disable_irqs();
184 205
185 /* no DMA at all, but ide-scsi requires it.. make sure 206 /* no DMA at all, but ide-scsi requires it.. make sure
186 * all physical RAM fits into the boundary - otherwise 207 * all physical RAM fits into the boundary - otherwise
187 * allocator may play costly and useless tricks */ 208 * allocator may play costly and useless tricks */
188 mach_max_dma_address = 1024*1024*1024; 209 mach_max_dma_address = 1024*1024*1024;
189
190 /* useful for early debugging stages - writes kernel messages into SRAM */
191 if (!strncmp( m68k_debug_device,"mem",3 ))
192 {
193 /*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/
194 _cpleft=2000-((long)q40_mem_cptr-0xff020000)/4;
195 q40_console_driver.write = q40_mem_console_write;
196 register_console(&q40_console_driver);
197 }
198} 210}
199 211
200 212
201int q40_parse_bootinfo(const struct bi_record *rec) 213int q40_parse_bootinfo(const struct bi_record *rec)
202{ 214{
203 return 1; 215 return 1;
204} 216}
205 217
206 218
207static inline unsigned char bcd2bin (unsigned char b) 219static inline unsigned char bcd2bin(unsigned char b)
208{ 220{
209 return ((b>>4)*10 + (b&15)); 221 return (b >> 4) * 10 + (b & 15);
210} 222}
211 223
212static inline unsigned char bin2bcd (unsigned char b) 224static inline unsigned char bin2bcd(unsigned char b)
213{ 225{
214 return (((b/10)*16) + (b%10)); 226 return (b / 10) * 16 + (b % 10);
215} 227}
216 228
217 229
218unsigned long q40_gettimeoffset (void) 230unsigned long q40_gettimeoffset(void)
219{ 231{
220 return 5000*(ql_ticks!=0); 232 return 5000 * (ql_ticks != 0);
221} 233}
222 234
223 235
@@ -238,9 +250,9 @@ unsigned long q40_gettimeoffset (void)
238 250
239int q40_hwclk(int op, struct rtc_time *t) 251int q40_hwclk(int op, struct rtc_time *t)
240{ 252{
241 if (op) 253 if (op) {
242 { /* Write.... */ 254 /* Write.... */
243 Q40_RTC_CTRL |= Q40_RTC_WRITE; 255 Q40_RTC_CTRL |= Q40_RTC_WRITE;
244 256
245 Q40_RTC_SECS = bin2bcd(t->tm_sec); 257 Q40_RTC_SECS = bin2bcd(t->tm_sec);
246 Q40_RTC_MINS = bin2bcd(t->tm_min); 258 Q40_RTC_MINS = bin2bcd(t->tm_min);
@@ -251,25 +263,23 @@ int q40_hwclk(int op, struct rtc_time *t)
251 if (t->tm_wday >= 0) 263 if (t->tm_wday >= 0)
252 Q40_RTC_DOW = bin2bcd(t->tm_wday+1); 264 Q40_RTC_DOW = bin2bcd(t->tm_wday+1);
253 265
254 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); 266 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
255 } 267 } else {
256 else 268 /* Read.... */
257 { /* Read.... */ 269 Q40_RTC_CTRL |= Q40_RTC_READ;
258 Q40_RTC_CTRL |= Q40_RTC_READ; 270
259 271 t->tm_year = bcd2bin (Q40_RTC_YEAR);
260 t->tm_year = bcd2bin (Q40_RTC_YEAR); 272 t->tm_mon = bcd2bin (Q40_RTC_MNTH)-1;
261 t->tm_mon = bcd2bin (Q40_RTC_MNTH)-1; 273 t->tm_mday = bcd2bin (Q40_RTC_DATE);
262 t->tm_mday = bcd2bin (Q40_RTC_DATE); 274 t->tm_hour = bcd2bin (Q40_RTC_HOUR);
263 t->tm_hour = bcd2bin (Q40_RTC_HOUR); 275 t->tm_min = bcd2bin (Q40_RTC_MINS);
264 t->tm_min = bcd2bin (Q40_RTC_MINS); 276 t->tm_sec = bcd2bin (Q40_RTC_SECS);
265 t->tm_sec = bcd2bin (Q40_RTC_SECS); 277
266 278 Q40_RTC_CTRL &= ~(Q40_RTC_READ);
267 Q40_RTC_CTRL &= ~(Q40_RTC_READ); 279
268 280 if (t->tm_year < 70)
269 if (t->tm_year < 70) 281 t->tm_year += 100;
270 t->tm_year += 100; 282 t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
271 t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
272
273 } 283 }
274 284
275 return 0; 285 return 0;
@@ -285,29 +295,25 @@ unsigned int q40_get_ss(void)
285 * clock is out by > 30 minutes. Logic lifted from atari code. 295 * clock is out by > 30 minutes. Logic lifted from atari code.
286 */ 296 */
287 297
288int q40_set_clock_mmss (unsigned long nowtime) 298int q40_set_clock_mmss(unsigned long nowtime)
289{ 299{
290 int retval = 0; 300 int retval = 0;
291 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; 301 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
292 302
293 int rtc_minutes; 303 int rtc_minutes;
294 304
305 rtc_minutes = bcd2bin(Q40_RTC_MINS);
295 306
296 rtc_minutes = bcd2bin (Q40_RTC_MINS); 307 if ((rtc_minutes < real_minutes ?
297 308 real_minutes - rtc_minutes :
298 if ((rtc_minutes < real_minutes 309 rtc_minutes - real_minutes) < 30) {
299 ? real_minutes - rtc_minutes 310 Q40_RTC_CTRL |= Q40_RTC_WRITE;
300 : rtc_minutes - real_minutes) < 30)
301 {
302 Q40_RTC_CTRL |= Q40_RTC_WRITE;
303 Q40_RTC_MINS = bin2bcd(real_minutes); 311 Q40_RTC_MINS = bin2bcd(real_minutes);
304 Q40_RTC_SECS = bin2bcd(real_seconds); 312 Q40_RTC_SECS = bin2bcd(real_seconds);
305 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); 313 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
306 } 314 } else
307 else
308 retval = -1; 315 retval = -1;
309 316
310
311 return retval; 317 return retval;
312} 318}
313 319
@@ -318,21 +324,23 @@ int q40_set_clock_mmss (unsigned long nowtime)
318 324
319static int q40_get_rtc_pll(struct rtc_pll_info *pll) 325static int q40_get_rtc_pll(struct rtc_pll_info *pll)
320{ 326{
321 int tmp=Q40_RTC_CTRL; 327 int tmp = Q40_RTC_CTRL;
328
322 pll->pll_value = tmp & Q40_RTC_PLL_MASK; 329 pll->pll_value = tmp & Q40_RTC_PLL_MASK;
323 if (tmp & Q40_RTC_PLL_SIGN) 330 if (tmp & Q40_RTC_PLL_SIGN)
324 pll->pll_value = -pll->pll_value; 331 pll->pll_value = -pll->pll_value;
325 pll->pll_max=31; 332 pll->pll_max = 31;
326 pll->pll_min=-31; 333 pll->pll_min = -31;
327 pll->pll_posmult=512; 334 pll->pll_posmult = 512;
328 pll->pll_negmult=256; 335 pll->pll_negmult = 256;
329 pll->pll_clock=125829120; 336 pll->pll_clock = 125829120;
337
330 return 0; 338 return 0;
331} 339}
332 340
333static int q40_set_rtc_pll(struct rtc_pll_info *pll) 341static int q40_set_rtc_pll(struct rtc_pll_info *pll)
334{ 342{
335 if (!pll->pll_ctrl){ 343 if (!pll->pll_ctrl) {
336 /* the docs are a bit unclear so I am doublesetting */ 344 /* the docs are a bit unclear so I am doublesetting */
337 /* RTC_WRITE here ... */ 345 /* RTC_WRITE here ... */
338 int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) | 346 int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) |
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index baf74e8de8b5..4232a2c2fae9 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -103,7 +103,7 @@ void sun3_init_IRQ(void)
103 103
104 m68k_setup_auto_interrupt(sun3_inthandle); 104 m68k_setup_auto_interrupt(sun3_inthandle);
105 m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7); 105 m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7);
106 m68k_setup_user_interrupt(VEC_USER, 192, NULL); 106 m68k_setup_user_interrupt(VEC_USER, 128, NULL);
107 107
108 request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL); 108 request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL);
109 request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL); 109 request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL);
diff --git a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
index 574cf06df9e4..48f8eb7b1565 100644
--- a/arch/m68k/sun3x/prom.c
+++ b/arch/m68k/sun3x/prom.c
@@ -34,100 +34,101 @@ e_vector *sun3x_prom_vbr;
34/* Handle returning to the prom */ 34/* Handle returning to the prom */
35void sun3x_halt(void) 35void sun3x_halt(void)
36{ 36{
37 unsigned long flags; 37 unsigned long flags;
38 38
39 /* Disable interrupts while we mess with things */ 39 /* Disable interrupts while we mess with things */
40 local_irq_save(flags); 40 local_irq_save(flags);
41 41
42 /* Restore prom vbr */ 42 /* Restore prom vbr */
43 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); 43 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
44 44
45 /* Restore prom NMI clock */ 45 /* Restore prom NMI clock */
46// sun3x_disable_intreg(5); 46// sun3x_disable_intreg(5);
47 sun3_enable_irq(7); 47 sun3_enable_irq(7);
48 48
49 /* Let 'er rip */ 49 /* Let 'er rip */
50 __asm__ volatile ("trap #14" : : ); 50 asm volatile ("trap #14");
51 51
52 /* Restore everything */ 52 /* Restore everything */
53 sun3_disable_irq(7); 53 sun3_disable_irq(7);
54 sun3_enable_irq(5); 54 sun3_enable_irq(5);
55 55
56 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors)); 56 asm volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
57 local_irq_restore(flags); 57 local_irq_restore(flags);
58} 58}
59 59
60void sun3x_reboot(void) 60void sun3x_reboot(void)
61{ 61{
62 /* This never returns, don't bother saving things */ 62 /* This never returns, don't bother saving things */
63 local_irq_disable(); 63 local_irq_disable();
64 64
65 /* Restore prom vbr */ 65 /* Restore prom vbr */
66 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); 66 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
67 67
68 /* Restore prom NMI clock */ 68 /* Restore prom NMI clock */
69 sun3_disable_irq(5); 69 sun3_disable_irq(5);
70 sun3_enable_irq(7); 70 sun3_enable_irq(7);
71 71
72 /* Let 'er rip */ 72 /* Let 'er rip */
73 (*romvec->pv_reboot)("vmlinux"); 73 (*romvec->pv_reboot)("vmlinux");
74} 74}
75 75
76extern char m68k_debug_device[];
77
78static void sun3x_prom_write(struct console *co, const char *s, 76static void sun3x_prom_write(struct console *co, const char *s,
79 unsigned int count) 77 unsigned int count)
80{ 78{
81 while (count--) { 79 while (count--) {
82 if (*s == '\n') 80 if (*s == '\n')
83 sun3x_putchar('\r'); 81 sun3x_putchar('\r');
84 sun3x_putchar(*s++); 82 sun3x_putchar(*s++);
85 } 83 }
86} 84}
87 85
88/* debug console - write-only */ 86/* debug console - write-only */
89 87
90static struct console sun3x_debug = { 88static struct console sun3x_debug = {
91 .name = "debug", 89 .name = "debug",
92 .write = sun3x_prom_write, 90 .write = sun3x_prom_write,
93 .flags = CON_PRINTBUFFER, 91 .flags = CON_PRINTBUFFER,
94 .index = -1, 92 .index = -1,
95}; 93};
96 94
97void sun3x_prom_init(void) 95void sun3x_prom_init(void)
98{ 96{
99 /* Read the vector table */ 97 /* Read the vector table */
100 98
101 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR); 99 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
102 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR); 100 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
103 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET); 101 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET);
104 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT); 102 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT);
105 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT); 103 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT);
106 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT); 104 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
107 romvec = (struct linux_romvec *)SUN3X_PROM_BASE; 105 romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
108 106
109 idprom_init(); 107 idprom_init();
110 108
111 if(!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) { 109 if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
112 printk("Warning: machine reports strange type %02x\n", 110 printk("Warning: machine reports strange type %02x\n",
113 idprom->id_machtype); 111 idprom->id_machtype);
114 printk("Pretending it's a 3/80, but very afraid...\n"); 112 printk("Pretending it's a 3/80, but very afraid...\n");
115 idprom->id_machtype = SM_SUN3X | SM_3_80; 113 idprom->id_machtype = SM_SUN3X | SM_3_80;
116 } 114 }
117 115
118 /* point trap #14 at abort. 116 /* point trap #14 at abort.
119 * XXX this is futile since we restore the vbr first - oops 117 * XXX this is futile since we restore the vbr first - oops
120 */ 118 */
121 vectors[VEC_TRAP14] = sun3x_prom_abort; 119 vectors[VEC_TRAP14] = sun3x_prom_abort;
122 120}
123 /* If debug=prom was specified, start the debug console */
124
125 if (!strcmp(m68k_debug_device, "prom"))
126 register_console(&sun3x_debug);
127
128 121
122static int __init sun3x_debug_setup(char *arg)
123{
124 /* If debug=prom was specified, start the debug console */
125 if (MACH_IS_SUN3X && !strcmp(arg, "prom"))
126 register_console(&sun3x_debug);
127 return 0;
129} 128}
130 129
130early_param("debug", sun3x_debug_setup);
131
131/* some prom functions to export */ 132/* some prom functions to export */
132int prom_getintdefault(int node, char *property, int deflt) 133int prom_getintdefault(int node, char *property, int deflt)
133{ 134{
@@ -141,7 +142,6 @@ int prom_getbool (int node, char *prop)
141 142
142void prom_printf(char *fmt, ...) 143void prom_printf(char *fmt, ...)
143{ 144{
144
145} 145}
146 146
147void prom_halt (void) 147void prom_halt (void)
@@ -159,7 +159,7 @@ prom_get_idprom(char *idbuf, int num_bytes)
159 int i; 159 int i;
160 160
161 /* make a copy of the idprom structure */ 161 /* make a copy of the idprom structure */
162 for(i = 0; i < num_bytes; i++) 162 for (i = 0; i < num_bytes; i++)
163 idbuf[i] = ((char *)SUN3X_IDPROM)[i]; 163 idbuf[i] = ((char *)SUN3X_IDPROM)[i];
164 164
165 return idbuf[0]; 165 return idbuf[0];
diff --git a/arch/m68knommu/kernel/dma.c b/arch/m68knommu/kernel/dma.c
index 14b19c4161f4..0a25874a2aae 100644
--- a/arch/m68knommu/kernel/dma.c
+++ b/arch/m68knommu/kernel/dma.c
@@ -8,7 +8,6 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pci.h>
12#include <asm/io.h> 11#include <asm/io.h>
13 12
14void *dma_alloc_coherent(struct device *dev, size_t size, 13void *dma_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
index de017c11f9b7..9565b2104dcd 100644
--- a/arch/mips/cobalt/Makefile
+++ b/arch/mips/cobalt/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Cobalt micro systems family specific parts of the kernel 2# Makefile for the Cobalt micro systems family specific parts of the kernel
3# 3#
4 4
5obj-y := irq.o reset.o setup.o 5obj-y := irq.o reset.o setup.o buttons.o
6 6
7obj-$(CONFIG_PCI) += pci.o 7obj-$(CONFIG_PCI) += pci.o
8obj-$(CONFIG_EARLY_PRINTK) += console.o 8obj-$(CONFIG_EARLY_PRINTK) += console.o
diff --git a/arch/mips/cobalt/buttons.c b/arch/mips/cobalt/buttons.c
new file mode 100644
index 000000000000..9e143989c7b8
--- /dev/null
+++ b/arch/mips/cobalt/buttons.c
@@ -0,0 +1,54 @@
1/*
2 * Cobalt buttons platform device.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/platform_device.h>
22#include <linux/errno.h>
23#include <linux/init.h>
24
25static struct resource cobalt_buttons_resource __initdata = {
26 .start = 0x1d000000,
27 .end = 0x1d000003,
28 .flags = IORESOURCE_MEM,
29};
30
31static __init int cobalt_add_buttons(void)
32{
33 struct platform_device *pd;
34 int error;
35
36 pd = platform_device_alloc("Cobalt buttons", -1);
37 if (!pd)
38 return -ENOMEM;
39
40 error = platform_device_add_resources(pd, &cobalt_buttons_resource, 1);
41 if (error)
42 goto err_free_device;
43
44 error = platform_device_add(pd);
45 if (error)
46 goto err_free_device;
47
48 return 0;
49
50 err_free_device:
51 platform_device_put(pd);
52 return error;
53}
54device_initcall(cobalt_add_buttons);
diff --git a/arch/mips/lib/iomap.c b/arch/mips/lib/iomap.c
index d51d5cb0a4a9..e3acb2dad33a 100644
--- a/arch/mips/lib/iomap.c
+++ b/arch/mips/lib/iomap.c
@@ -6,7 +6,6 @@
6 * (C) Copyright 2007 MIPS Technologies, Inc. 6 * (C) Copyright 2007 MIPS Technologies, Inc.
7 * written by Ralf Baechle <ralf@linux-mips.org> 7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */ 8 */
9#include <linux/pci.h>
10#include <linux/module.h> 9#include <linux/module.h>
11#include <asm/io.h> 10#include <asm/io.h>
12 11
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 60d7d4baa227..7138092826aa 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -340,7 +340,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
340 struct pci_dev *dev; 340 struct pci_dev *dev;
341 const char *type; 341 const char *type;
342 342
343 dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); 343 dev = alloc_pci_dev();
344 if (!dev) 344 if (!dev)
345 return NULL; 345 return NULL;
346 type = of_get_property(node, "device_type", NULL); 346 type = of_get_property(node, "device_type", NULL);
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 9eaefac5053f..b2c1b67a10a7 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -37,7 +37,7 @@
37#include <asm/iseries/hv_call_xm.h> 37#include <asm/iseries/hv_call_xm.h>
38#include <asm/iseries/iommu.h> 38#include <asm/iseries/iommu.h>
39 39
40extern struct subsystem devices_subsys; /* needed for vio_find_name() */ 40extern struct kset devices_subsys; /* needed for vio_find_name() */
41 41
42static struct vio_dev vio_bus_device = { /* fake "parent" device */ 42static struct vio_dev vio_bus_device = { /* fake "parent" device */
43 .name = vio_bus_device.dev.bus_id, 43 .name = vio_bus_device.dev.bus_id,
@@ -427,7 +427,7 @@ static struct vio_dev *vio_find_name(const char *kobj_name)
427{ 427{
428 struct kobject *found; 428 struct kobject *found;
429 429
430 found = kset_find_obj(&devices_subsys.kset, kobj_name); 430 found = kset_find_obj(&devices_subsys, kobj_name);
431 if (!found) 431 if (!found)
432 return NULL; 432 return NULL;
433 433
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 8943a9456bb7..1fe35dab0e9e 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -25,7 +25,6 @@
25#include <linux/cpufreq.h> 25#include <linux/cpufreq.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/i2c.h>
29#include <linux/hardirq.h> 28#include <linux/hardirq.h>
30#include <asm/prom.h> 29#include <asm/prom.h>
31#include <asm/machdep.h> 30#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/pseries/power.c b/arch/powerpc/platforms/pseries/power.c
index 2624b71df73d..73e69023d90a 100644
--- a/arch/powerpc/platforms/pseries/power.c
+++ b/arch/powerpc/platforms/pseries/power.c
@@ -28,13 +28,13 @@
28 28
29unsigned long rtas_poweron_auto; /* default and normal state is 0 */ 29unsigned long rtas_poweron_auto; /* default and normal state is 0 */
30 30
31static ssize_t auto_poweron_show(struct subsystem *subsys, char *buf) 31static ssize_t auto_poweron_show(struct kset *kset, char *buf)
32{ 32{
33 return sprintf(buf, "%lu\n", rtas_poweron_auto); 33 return sprintf(buf, "%lu\n", rtas_poweron_auto);
34} 34}
35 35
36static ssize_t 36static ssize_t
37auto_poweron_store(struct subsystem *subsys, const char *buf, size_t n) 37auto_poweron_store(struct kset *kset, const char *buf, size_t n)
38{ 38{
39 int ret; 39 int ret;
40 unsigned long ups_restart; 40 unsigned long ups_restart;
@@ -72,12 +72,12 @@ static int __init pm_init(void)
72{ 72{
73 int error = subsystem_register(&power_subsys); 73 int error = subsystem_register(&power_subsys);
74 if (!error) 74 if (!error)
75 error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); 75 error = sysfs_create_group(&power_subsys.kobj, &attr_group);
76 return error; 76 return error;
77} 77}
78core_initcall(pm_init); 78core_initcall(pm_init);
79#else 79#else
80extern struct subsystem power_subsys; 80extern struct kset power_subsys;
81 81
82static int __init apo_pm_init(void) 82static int __init apo_pm_init(void)
83{ 83{
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 53aa04101ced..3a393c7f390e 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -31,7 +31,6 @@
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/pci.h>
35#include <linux/delay.h> 34#include <linux/delay.h>
36#include <linux/irq.h> 35#include <linux/irq.h>
37#include <linux/random.h> 36#include <linux/random.h>
diff --git a/arch/ppc/8260_io/enet.c b/arch/ppc/8260_io/enet.c
index 48ce84f5be93..4c0a7d732f69 100644
--- a/arch/ppc/8260_io/enet.c
+++ b/arch/ppc/8260_io/enet.c
@@ -32,7 +32,6 @@
32#include <linux/ioport.h> 32#include <linux/ioport.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/pci.h>
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/delay.h> 36#include <linux/delay.h>
38#include <linux/netdevice.h> 37#include <linux/netdevice.h>
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c
index 9db825fe37f0..cab395da25da 100644
--- a/arch/ppc/8260_io/fcc_enet.c
+++ b/arch/ppc/8260_io/fcc_enet.c
@@ -29,7 +29,6 @@
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/pci.h>
33#include <linux/init.h> 32#include <linux/init.h>
34#include <linux/delay.h> 33#include <linux/delay.h>
35#include <linux/netdevice.h> 34#include <linux/netdevice.h>
diff --git a/arch/ppc/8xx_io/enet.c b/arch/ppc/8xx_io/enet.c
index bfa3f52996d1..e58288e14369 100644
--- a/arch/ppc/8xx_io/enet.c
+++ b/arch/ppc/8xx_io/enet.c
@@ -30,7 +30,6 @@
30#include <linux/ioport.h> 30#include <linux/ioport.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/pci.h>
34#include <linux/init.h> 33#include <linux/init.h>
35#include <linux/delay.h> 34#include <linux/delay.h>
36#include <linux/netdevice.h> 35#include <linux/netdevice.h>
diff --git a/arch/ppc/syslib/ppc4xx_sgdma.c b/arch/ppc/syslib/ppc4xx_sgdma.c
index 939abe3c1f45..5dadca3e0d61 100644
--- a/arch/ppc/syslib/ppc4xx_sgdma.c
+++ b/arch/ppc/syslib/ppc4xx_sgdma.c
@@ -23,7 +23,6 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/pci.h>
27 26
28#include <asm/system.h> 27#include <asm/system.h>
29#include <asm/io.h> 28#include <asm/io.h>
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 91636353f6f0..3660ca6a3306 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -119,7 +119,8 @@ static struct crypto_alg aes_alg = {
119 .cra_name = "aes", 119 .cra_name = "aes",
120 .cra_driver_name = "aes-s390", 120 .cra_driver_name = "aes-s390",
121 .cra_priority = CRYPT_S390_PRIORITY, 121 .cra_priority = CRYPT_S390_PRIORITY,
122 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 122 .cra_flags = CRYPTO_ALG_TYPE_CIPHER |
123 CRYPTO_ALG_NEED_FALLBACK,
123 .cra_blocksize = AES_BLOCK_SIZE, 124 .cra_blocksize = AES_BLOCK_SIZE,
124 .cra_ctxsize = sizeof(struct s390_aes_ctx), 125 .cra_ctxsize = sizeof(struct s390_aes_ctx),
125 .cra_module = THIS_MODULE, 126 .cra_module = THIS_MODULE,
@@ -206,7 +207,8 @@ static struct crypto_alg ecb_aes_alg = {
206 .cra_name = "ecb(aes)", 207 .cra_name = "ecb(aes)",
207 .cra_driver_name = "ecb-aes-s390", 208 .cra_driver_name = "ecb-aes-s390",
208 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, 209 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
209 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 210 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER |
211 CRYPTO_ALG_NEED_FALLBACK,
210 .cra_blocksize = AES_BLOCK_SIZE, 212 .cra_blocksize = AES_BLOCK_SIZE,
211 .cra_ctxsize = sizeof(struct s390_aes_ctx), 213 .cra_ctxsize = sizeof(struct s390_aes_ctx),
212 .cra_type = &crypto_blkcipher_type, 214 .cra_type = &crypto_blkcipher_type,
@@ -300,7 +302,8 @@ static struct crypto_alg cbc_aes_alg = {
300 .cra_name = "cbc(aes)", 302 .cra_name = "cbc(aes)",
301 .cra_driver_name = "cbc-aes-s390", 303 .cra_driver_name = "cbc-aes-s390",
302 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, 304 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
303 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 305 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER |
306 CRYPTO_ALG_NEED_FALLBACK,
304 .cra_blocksize = AES_BLOCK_SIZE, 307 .cra_blocksize = AES_BLOCK_SIZE,
305 .cra_ctxsize = sizeof(struct s390_aes_ctx), 308 .cra_ctxsize = sizeof(struct s390_aes_ctx),
306 .cra_type = &crypto_blkcipher_type, 309 .cra_type = &crypto_blkcipher_type,
@@ -333,10 +336,14 @@ static int __init aes_init(void)
333 return -EOPNOTSUPP; 336 return -EOPNOTSUPP;
334 337
335 /* z9 109 and z9 BC/EC only support 128 bit key length */ 338 /* z9 109 and z9 BC/EC only support 128 bit key length */
336 if (keylen_flag == AES_KEYLEN_128) 339 if (keylen_flag == AES_KEYLEN_128) {
340 aes_alg.cra_u.cipher.cia_max_keysize = AES_MIN_KEY_SIZE;
341 ecb_aes_alg.cra_u.blkcipher.max_keysize = AES_MIN_KEY_SIZE;
342 cbc_aes_alg.cra_u.blkcipher.max_keysize = AES_MIN_KEY_SIZE;
337 printk(KERN_INFO 343 printk(KERN_INFO
338 "aes_s390: hardware acceleration only available for" 344 "aes_s390: hardware acceleration only available for"
339 "128 bit keys\n"); 345 "128 bit keys\n");
346 }
340 347
341 ret = crypto_register_alg(&aes_alg); 348 ret = crypto_register_alg(&aes_alg);
342 if (ret) 349 if (ret)
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 06833ac2b115..0ea048d350d8 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -164,7 +164,7 @@ EXPORT_SYMBOL_GPL(diag308);
164/* SYSFS */ 164/* SYSFS */
165 165
166#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \ 166#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
167static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ 167static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
168 char *page) \ 168 char *page) \
169{ \ 169{ \
170 return sprintf(page, _format, _value); \ 170 return sprintf(page, _format, _value); \
@@ -173,13 +173,13 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
173 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL); 173 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);
174 174
175#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \ 175#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
176static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ 176static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
177 char *page) \ 177 char *page) \
178{ \ 178{ \
179 return sprintf(page, _fmt_out, \ 179 return sprintf(page, _fmt_out, \
180 (unsigned long long) _value); \ 180 (unsigned long long) _value); \
181} \ 181} \
182static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\ 182static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
183 const char *buf, size_t len) \ 183 const char *buf, size_t len) \
184{ \ 184{ \
185 unsigned long long value; \ 185 unsigned long long value; \
@@ -194,12 +194,12 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
194 sys_##_prefix##_##_name##_store); 194 sys_##_prefix##_##_name##_store);
195 195
196#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\ 196#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\
197static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ 197static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
198 char *page) \ 198 char *page) \
199{ \ 199{ \
200 return sprintf(page, _fmt_out, _value); \ 200 return sprintf(page, _fmt_out, _value); \
201} \ 201} \
202static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\ 202static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
203 const char *buf, size_t len) \ 203 const char *buf, size_t len) \
204{ \ 204{ \
205 if (sscanf(buf, _fmt_in, _value) != 1) \ 205 if (sscanf(buf, _fmt_in, _value) != 1) \
@@ -272,14 +272,14 @@ void __init setup_ipl_info(void)
272struct ipl_info ipl_info; 272struct ipl_info ipl_info;
273EXPORT_SYMBOL_GPL(ipl_info); 273EXPORT_SYMBOL_GPL(ipl_info);
274 274
275static ssize_t ipl_type_show(struct subsystem *subsys, char *page) 275static ssize_t ipl_type_show(struct kset *kset, char *page)
276{ 276{
277 return sprintf(page, "%s\n", ipl_type_str(ipl_info.type)); 277 return sprintf(page, "%s\n", ipl_type_str(ipl_info.type));
278} 278}
279 279
280static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); 280static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
281 281
282static ssize_t sys_ipl_device_show(struct subsystem *subsys, char *page) 282static ssize_t sys_ipl_device_show(struct kset *kset, char *page)
283{ 283{
284 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; 284 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
285 285
@@ -371,7 +371,7 @@ static struct attribute_group ipl_fcp_attr_group = {
371 371
372/* CCW ipl device attributes */ 372/* CCW ipl device attributes */
373 373
374static ssize_t ipl_ccw_loadparm_show(struct subsystem *subsys, char *page) 374static ssize_t ipl_ccw_loadparm_show(struct kset *kset, char *page)
375{ 375{
376 char loadparm[LOADPARM_LEN + 1] = {}; 376 char loadparm[LOADPARM_LEN + 1] = {};
377 377
@@ -469,7 +469,7 @@ static void reipl_get_ascii_loadparm(char *loadparm)
469 strstrip(loadparm); 469 strstrip(loadparm);
470} 470}
471 471
472static ssize_t reipl_ccw_loadparm_show(struct subsystem *subsys, char *page) 472static ssize_t reipl_ccw_loadparm_show(struct kset *kset, char *page)
473{ 473{
474 char buf[LOADPARM_LEN + 1]; 474 char buf[LOADPARM_LEN + 1];
475 475
@@ -477,7 +477,7 @@ static ssize_t reipl_ccw_loadparm_show(struct subsystem *subsys, char *page)
477 return sprintf(page, "%s\n", buf); 477 return sprintf(page, "%s\n", buf);
478} 478}
479 479
480static ssize_t reipl_ccw_loadparm_store(struct subsystem *subsys, 480static ssize_t reipl_ccw_loadparm_store(struct kset *kset,
481 const char *buf, size_t len) 481 const char *buf, size_t len)
482{ 482{
483 int i, lp_len; 483 int i, lp_len;
@@ -572,12 +572,12 @@ static int reipl_set_type(enum ipl_type type)
572 return 0; 572 return 0;
573} 573}
574 574
575static ssize_t reipl_type_show(struct subsystem *subsys, char *page) 575static ssize_t reipl_type_show(struct kset *kset, char *page)
576{ 576{
577 return sprintf(page, "%s\n", ipl_type_str(reipl_type)); 577 return sprintf(page, "%s\n", ipl_type_str(reipl_type));
578} 578}
579 579
580static ssize_t reipl_type_store(struct subsystem *subsys, const char *buf, 580static ssize_t reipl_type_store(struct kset *kset, const char *buf,
581 size_t len) 581 size_t len)
582{ 582{
583 int rc = -EINVAL; 583 int rc = -EINVAL;
@@ -665,12 +665,12 @@ static int dump_set_type(enum dump_type type)
665 return 0; 665 return 0;
666} 666}
667 667
668static ssize_t dump_type_show(struct subsystem *subsys, char *page) 668static ssize_t dump_type_show(struct kset *kset, char *page)
669{ 669{
670 return sprintf(page, "%s\n", dump_type_str(dump_type)); 670 return sprintf(page, "%s\n", dump_type_str(dump_type));
671} 671}
672 672
673static ssize_t dump_type_store(struct subsystem *subsys, const char *buf, 673static ssize_t dump_type_store(struct kset *kset, const char *buf,
674 size_t len) 674 size_t len)
675{ 675{
676 int rc = -EINVAL; 676 int rc = -EINVAL;
@@ -697,12 +697,12 @@ static decl_subsys(shutdown_actions, NULL, NULL);
697 697
698/* on panic */ 698/* on panic */
699 699
700static ssize_t on_panic_show(struct subsystem *subsys, char *page) 700static ssize_t on_panic_show(struct kset *kset, char *page)
701{ 701{
702 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action)); 702 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
703} 703}
704 704
705static ssize_t on_panic_store(struct subsystem *subsys, const char *buf, 705static ssize_t on_panic_store(struct kset *kset, const char *buf,
706 size_t len) 706 size_t len)
707{ 707{
708 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0) 708 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 993f35381496..23c61f6d965b 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -516,7 +516,7 @@ out:
516 return 1; 516 return 1;
517} 517}
518 518
519static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 519int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
520{ 520{
521 struct kprobe *cur = kprobe_running(); 521 struct kprobe *cur = kprobe_running();
522 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 522 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
@@ -603,7 +603,6 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
603 ret = NOTIFY_STOP; 603 ret = NOTIFY_STOP;
604 break; 604 break;
605 case DIE_TRAP: 605 case DIE_TRAP:
606 case DIE_PAGE_FAULT:
607 /* kprobe_running() needs smp_processor_id() */ 606 /* kprobe_running() needs smp_processor_id() */
608 preempt_disable(); 607 preempt_disable();
609 if (kprobe_running() && 608 if (kprobe_running() &&
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 3dfd0985861c..6bfb0889eb10 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -65,7 +65,7 @@ long psw_user_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME |
65 * User copy operations. 65 * User copy operations.
66 */ 66 */
67struct uaccess_ops uaccess; 67struct uaccess_ops uaccess;
68EXPORT_SYMBOL_GPL(uaccess); 68EXPORT_SYMBOL(uaccess);
69 69
70/* 70/*
71 * Machine setup.. 71 * Machine setup..
@@ -74,6 +74,8 @@ unsigned int console_mode = 0;
74unsigned int console_devno = -1; 74unsigned int console_devno = -1;
75unsigned int console_irq = -1; 75unsigned int console_irq = -1;
76unsigned long machine_flags = 0; 76unsigned long machine_flags = 0;
77unsigned long elf_hwcap = 0;
78char elf_platform[ELF_PLATFORM_SIZE];
77 79
78struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 80struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
79volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ 81volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
@@ -749,6 +751,98 @@ setup_memory(void)
749#endif 751#endif
750} 752}
751 753
754static __init unsigned int stfl(void)
755{
756 asm volatile(
757 " .insn s,0xb2b10000,0(0)\n" /* stfl */
758 "0:\n"
759 EX_TABLE(0b,0b));
760 return S390_lowcore.stfl_fac_list;
761}
762
763static __init int stfle(unsigned long long *list, int doublewords)
764{
765 typedef struct { unsigned long long _[doublewords]; } addrtype;
766 register unsigned long __nr asm("0") = doublewords - 1;
767
768 asm volatile(".insn s,0xb2b00000,%0" /* stfle */
769 : "=m" (*(addrtype *) list), "+d" (__nr) : : "cc");
770 return __nr + 1;
771}
772
773/*
774 * Setup hardware capabilities.
775 */
776static void __init setup_hwcaps(void)
777{
778 static const int stfl_bits[6] = { 0, 2, 7, 17, 19, 21 };
779 struct cpuinfo_S390 *cpuinfo = &S390_lowcore.cpu_data;
780 unsigned long long facility_list_extended;
781 unsigned int facility_list;
782 int i;
783
784 facility_list = stfl();
785 /*
786 * The store facility list bits numbers as found in the principles
787 * of operation are numbered with bit 1UL<<31 as number 0 to
788 * bit 1UL<<0 as number 31.
789 * Bit 0: instructions named N3, "backported" to esa-mode
790 * Bit 2: z/Architecture mode is active
791 * Bit 7: the store-facility-list-extended facility is installed
792 * Bit 17: the message-security assist is installed
793 * Bit 19: the long-displacement facility is installed
794 * Bit 21: the extended-immediate facility is installed
795 * These get translated to:
796 * HWCAP_S390_ESAN3 bit 0, HWCAP_S390_ZARCH bit 1,
797 * HWCAP_S390_STFLE bit 2, HWCAP_S390_MSA bit 3,
798 * HWCAP_S390_LDISP bit 4, and HWCAP_S390_EIMM bit 5.
799 */
800 for (i = 0; i < 6; i++)
801 if (facility_list & (1UL << (31 - stfl_bits[i])))
802 elf_hwcap |= 1UL << i;
803
804 /*
805 * Check for additional facilities with store-facility-list-extended.
806 * stfle stores doublewords (8 byte) with bit 1ULL<<63 as bit 0
807 * and 1ULL<<0 as bit 63. Bits 0-31 contain the same information
808 * as stored by stfl, bits 32-xxx contain additional facilities.
809 * How many facility words are stored depends on the number of
810 * doublewords passed to the instruction. The additional facilites
811 * are:
812 * Bit 43: decimal floating point facility is installed
813 * translated to:
814 * HWCAP_S390_DFP bit 6.
815 */
816 if ((elf_hwcap & (1UL << 2)) &&
817 stfle(&facility_list_extended, 1) > 0) {
818 if (facility_list_extended & (1ULL << (64 - 43)))
819 elf_hwcap |= 1UL << 6;
820 }
821
822 switch (cpuinfo->cpu_id.machine) {
823 case 0x9672:
824#if !defined(CONFIG_64BIT)
825 default: /* Use "g5" as default for 31 bit kernels. */
826#endif
827 strcpy(elf_platform, "g5");
828 break;
829 case 0x2064:
830 case 0x2066:
831#if defined(CONFIG_64BIT)
832 default: /* Use "z900" as default for 64 bit kernels. */
833#endif
834 strcpy(elf_platform, "z900");
835 break;
836 case 0x2084:
837 case 0x2086:
838 strcpy(elf_platform, "z990");
839 break;
840 case 0x2094:
841 strcpy(elf_platform, "z9-109");
842 break;
843 }
844}
845
752/* 846/*
753 * Setup function called from init/main.c just after the banner 847 * Setup function called from init/main.c just after the banner
754 * was printed. 848 * was printed.
@@ -805,6 +899,11 @@ setup_arch(char **cmdline_p)
805 smp_setup_cpu_possible_map(); 899 smp_setup_cpu_possible_map();
806 900
807 /* 901 /*
902 * Setup capabilities (ELF_HWCAP & ELF_PLATFORM).
903 */
904 setup_hwcaps();
905
906 /*
808 * Create kernel page tables and switch to virtual addressing. 907 * Create kernel page tables and switch to virtual addressing.
809 */ 908 */
810 paging_init(); 909 paging_init();
@@ -839,8 +938,12 @@ void print_cpu_info(struct cpuinfo_S390 *cpuinfo)
839 938
840static int show_cpuinfo(struct seq_file *m, void *v) 939static int show_cpuinfo(struct seq_file *m, void *v)
841{ 940{
941 static const char *hwcap_str[7] = {
942 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp"
943 };
842 struct cpuinfo_S390 *cpuinfo; 944 struct cpuinfo_S390 *cpuinfo;
843 unsigned long n = (unsigned long) v - 1; 945 unsigned long n = (unsigned long) v - 1;
946 int i;
844 947
845 s390_adjust_jiffies(); 948 s390_adjust_jiffies();
846 preempt_disable(); 949 preempt_disable();
@@ -850,7 +953,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
850 "bogomips per cpu: %lu.%02lu\n", 953 "bogomips per cpu: %lu.%02lu\n",
851 num_online_cpus(), loops_per_jiffy/(500000/HZ), 954 num_online_cpus(), loops_per_jiffy/(500000/HZ),
852 (loops_per_jiffy/(5000/HZ))%100); 955 (loops_per_jiffy/(5000/HZ))%100);
956 seq_puts(m, "features\t: ");
957 for (i = 0; i < 7; i++)
958 if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
959 seq_printf(m, "%s ", hwcap_str[i]);
960 seq_puts(m, "\n");
853 } 961 }
962
854 if (cpu_online(n)) { 963 if (cpu_online(n)) {
855#ifdef CONFIG_SMP 964#ifdef CONFIG_SMP
856 if (smp_processor_id() == n) 965 if (smp_processor_id() == n)
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 2b76a879a7b5..91f705adc3f9 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -52,38 +52,24 @@ extern int sysctl_userprocess_debug;
52extern void die(const char *,struct pt_regs *,long); 52extern void die(const char *,struct pt_regs *,long);
53 53
54#ifdef CONFIG_KPROBES 54#ifdef CONFIG_KPROBES
55static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
56int register_page_fault_notifier(struct notifier_block *nb)
57{
58 return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
59}
60
61int unregister_page_fault_notifier(struct notifier_block *nb)
62{
63 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
64}
65
66static int __kprobes __notify_page_fault(struct pt_regs *regs, long err)
67{
68 struct die_args args = { .str = "page fault",
69 .trapnr = 14,
70 .signr = SIGSEGV };
71 args.regs = regs;
72 args.err = err;
73 return atomic_notifier_call_chain(&notify_page_fault_chain,
74 DIE_PAGE_FAULT, &args);
75}
76
77static inline int notify_page_fault(struct pt_regs *regs, long err) 55static inline int notify_page_fault(struct pt_regs *regs, long err)
78{ 56{
79 if (unlikely(kprobe_running())) 57 int ret = 0;
80 return __notify_page_fault(regs, err); 58
81 return NOTIFY_DONE; 59 /* kprobe_running() needs smp_processor_id() */
60 if (!user_mode(regs)) {
61 preempt_disable();
62 if (kprobe_running() && kprobe_fault_handler(regs, 14))
63 ret = 1;
64 preempt_enable();
65 }
66
67 return ret;
82} 68}
83#else 69#else
84static inline int notify_page_fault(struct pt_regs *regs, long err) 70static inline int notify_page_fault(struct pt_regs *regs, long err)
85{ 71{
86 return NOTIFY_DONE; 72 return 0;
87} 73}
88#endif 74#endif
89 75
@@ -319,7 +305,7 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int write)
319 int space; 305 int space;
320 int si_code; 306 int si_code;
321 307
322 if (notify_page_fault(regs, error_code) == NOTIFY_STOP) 308 if (notify_page_fault(regs, error_code))
323 return; 309 return;
324 310
325 tsk = current; 311 tsk = current;
diff --git a/arch/sh64/mach-cayman/iomap.c b/arch/sh64/mach-cayman/iomap.c
index 2d06e9a55137..a5c645f02d57 100644
--- a/arch/sh64/mach-cayman/iomap.c
+++ b/arch/sh64/mach-cayman/iomap.c
@@ -9,7 +9,6 @@
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 10 * for more details.
11 */ 11 */
12#include <linux/pci.h>
13#include <asm/io.h> 12#include <asm/io.h>
14#include <asm/cayman.h> 13#include <asm/cayman.h>
15 14
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 590a41b864b9..be9e10b94ef8 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -306,6 +306,7 @@ config SUN_IO
306 306
307config PCI 307config PCI
308 bool "PCI support" 308 bool "PCI support"
309 select ARCH_SUPPORTS_MSI
309 help 310 help
310 Find out whether you have a PCI motherboard. PCI is the name of a 311 Find out whether you have a PCI motherboard. PCI is the name of a
311 bus system, i.e. the way the CPU talks to the other stuff inside 312 bus system, i.e. the way the CPU talks to the other stuff inside
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 023af41ad68d..9a549547cb2b 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -1092,10 +1092,10 @@ int arch_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
1092 return -EINVAL; 1092 return -EINVAL;
1093 1093
1094 err = p->setup_msi_irq(&virt_irq, pdev, desc); 1094 err = p->setup_msi_irq(&virt_irq, pdev, desc);
1095 if (err < 0) 1095 if (err)
1096 return err; 1096 return err;
1097 1097
1098 return virt_irq; 1098 return 0;
1099} 1099}
1100 1100
1101void arch_teardown_msi_irq(unsigned int virt_irq) 1101void arch_teardown_msi_irq(unsigned int virt_irq)
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 94295c219329..1ccf4c9a9a43 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -1169,8 +1169,6 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
1169 if (!devino) 1169 if (!devino)
1170 goto out_err; 1170 goto out_err;
1171 1171
1172 set_irq_msi(*virt_irq_p, entry);
1173
1174 msiqid = ((devino - pbm->msiq_first_devino) + 1172 msiqid = ((devino - pbm->msiq_first_devino) +
1175 pbm->msiq_first); 1173 pbm->msiq_first);
1176 1174
@@ -1204,6 +1202,8 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
1204 msg.address_lo = pbm->msi32_start; 1202 msg.address_lo = pbm->msi32_start;
1205 } 1203 }
1206 msg.data = msi_num; 1204 msg.data = msi_num;
1205
1206 set_irq_msi(*virt_irq_p, entry);
1207 write_msi_msg(*virt_irq_p, &msg); 1207 write_msi_msg(*virt_irq_p, &msg);
1208 1208
1209 irq_install_pre_handler(*virt_irq_p, 1209 irq_install_pre_handler(*virt_irq_p,
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 56eb14c98475..e9b4f058a49a 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -676,6 +676,7 @@ menu "Bus options (PCI etc.)"
676 676
677config PCI 677config PCI
678 bool "PCI support" 678 bool "PCI support"
679 select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
679 680
680# x86-64 doesn't support PCI BIOS access from long mode so always go direct. 681# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
681config PCI_DIRECT 682config PCI_DIRECT
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig
index 40acb67fb882..c0749d2479f5 100644
--- a/arch/x86_64/kernel/cpufreq/Kconfig
+++ b/arch/x86_64/kernel/cpufreq/Kconfig
@@ -16,6 +16,9 @@ config X86_POWERNOW_K8
16 help 16 help
17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. 17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
18 18
19 To compile this driver as a module, choose M here: the
20 module will be called powernow-k8.
21
19 For details, take a look at <file:Documentation/cpu-freq/>. 22 For details, take a look at <file:Documentation/cpu-freq/>.
20 23
21 If in doubt, say N. 24 If in doubt, say N.
@@ -38,6 +41,9 @@ config X86_SPEEDSTEP_CENTRINO
38 mobile CPUs. This means Intel Pentium M (Centrino) CPUs 41 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
39 or 64bit enabled Intel Xeons. 42 or 64bit enabled Intel Xeons.
40 43
44 To compile this driver as a module, choose M here: the
45 module will be called speedstep-centrino.
46
41 For details, take a look at <file:Documentation/cpu-freq/>. 47 For details, take a look at <file:Documentation/cpu-freq/>.
42 48
43 If in doubt, say N. 49 If in doubt, say N.
@@ -55,6 +61,9 @@ config X86_ACPI_CPUFREQ
55 Processor Performance States. 61 Processor Performance States.
56 This driver also supports Intel Enhanced Speedstep. 62 This driver also supports Intel Enhanced Speedstep.
57 63
64 To compile this driver as a module, choose M here: the
65 module will be called acpi-cpufreq.
66
58 For details, take a look at <file:Documentation/cpu-freq/>. 67 For details, take a look at <file:Documentation/cpu-freq/>.
59 68
60 If in doubt, say N. 69 If in doubt, say N.
@@ -62,7 +71,7 @@ config X86_ACPI_CPUFREQ
62comment "shared options" 71comment "shared options"
63 72
64config X86_ACPI_CPUFREQ_PROC_INTF 73config X86_ACPI_CPUFREQ_PROC_INTF
65 bool "/proc/acpi/processor/../performance interface (deprecated)" 74 bool "/proc/acpi/processor/../performance interface (deprecated)"
66 depends on PROC_FS 75 depends on PROC_FS
67 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI 76 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI
68 help 77 help
@@ -86,16 +95,18 @@ config X86_P4_CLOCKMOD
86 slowdowns and noticeable latencies. Normally Speedstep should be used 95 slowdowns and noticeable latencies. Normally Speedstep should be used
87 instead. 96 instead.
88 97
98 To compile this driver as a module, choose M here: the
99 module will be called p4-clockmod.
100
89 For details, take a look at <file:Documentation/cpu-freq/>. 101 For details, take a look at <file:Documentation/cpu-freq/>.
90 102
91 Unless you are absolutely sure say N. 103 Unless you are absolutely sure say N.
92 104
93 105
94config X86_SPEEDSTEP_LIB 106config X86_SPEEDSTEP_LIB
95 tristate 107 tristate
96 default X86_P4_CLOCKMOD 108 default X86_P4_CLOCKMOD
97 109
98endif 110endif
99 111
100endmenu 112endmenu
101
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index c6a5bc7e8118..b7d2b76b92d4 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -1983,18 +1983,18 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
1983 if (irq < 0) 1983 if (irq < 0)
1984 return irq; 1984 return irq;
1985 1985
1986 set_irq_msi(irq, desc);
1987 ret = msi_compose_msg(dev, irq, &msg); 1986 ret = msi_compose_msg(dev, irq, &msg);
1988 if (ret < 0) { 1987 if (ret < 0) {
1989 destroy_irq(irq); 1988 destroy_irq(irq);
1990 return ret; 1989 return ret;
1991 } 1990 }
1992 1991
1992 set_irq_msi(irq, desc);
1993 write_msi_msg(irq, &msg); 1993 write_msi_msg(irq, &msg);
1994 1994
1995 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); 1995 set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge");
1996 1996
1997 return irq; 1997 return 0;
1998} 1998}
1999 1999
2000void arch_teardown_msi_irq(unsigned int irq) 2000void arch_teardown_msi_irq(unsigned int irq)
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
index 0b4cb93db5a3..cd7e6a020602 100644
--- a/arch/xtensa/kernel/xtensa_ksyms.c
+++ b/arch/xtensa/kernel/xtensa_ksyms.c
@@ -18,7 +18,6 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <linux/in6.h> 20#include <linux/in6.h>
21#include <linux/pci.h>
22#include <linux/ide.h> 21#include <linux/ide.h>
23 22
24#include <asm/uaccess.h> 23#include <asm/uaccess.h>
diff --git a/arch/xtensa/platform-iss/setup.c b/arch/xtensa/platform-iss/setup.c
index c8a42b60c57a..f60c8cf6dfbe 100644
--- a/arch/xtensa/platform-iss/setup.c
+++ b/arch/xtensa/platform-iss/setup.c
@@ -20,7 +20,6 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/reboot.h> 22#include <linux/reboot.h>
23#include <linux/pci.h>
24#include <linux/kdev_t.h> 23#include <linux/kdev_t.h>
25#include <linux/types.h> 24#include <linux/types.h>
26#include <linux/major.h> 25#include <linux/major.h>