diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-10 04:12:10 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-10 04:12:10 -0500 |
| commit | 2f67bdb23d74a6c6fd4f98f64239c5c34d1833cc (patch) | |
| tree | fe533abe3e7c400848647b95e4806f5125c654c3 /arch/sparc/kernel | |
| parent | d40d9d29c020f8466c96f8e3ad4b7c014ff1085d (diff) | |
| parent | 3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff) | |
Merge branch 'master'
Diffstat (limited to 'arch/sparc/kernel')
| -rw-r--r-- | arch/sparc/kernel/Makefile | 1 | ||||
| -rw-r--r-- | arch/sparc/kernel/cpu.c | 4 | ||||
| -rw-r--r-- | arch/sparc/kernel/led.c | 139 | ||||
| -rw-r--r-- | arch/sparc/kernel/pcic.c | 2 | ||||
| -rw-r--r-- | arch/sparc/kernel/process.c | 35 | ||||
| -rw-r--r-- | arch/sparc/kernel/sunos_ioctl.c | 1 |
6 files changed, 160 insertions, 22 deletions
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 3d22ba2af01c..1b83e21841b5 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
| @@ -21,6 +21,7 @@ obj-$(CONFIG_SUN_AUXIO) += auxio.o | |||
| 21 | obj-$(CONFIG_PCI) += ebus.o | 21 | obj-$(CONFIG_PCI) += ebus.o |
| 22 | obj-$(CONFIG_SUN_PM) += apc.o pmc.o | 22 | obj-$(CONFIG_SUN_PM) += apc.o pmc.o |
| 23 | obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o | 23 | obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o |
| 24 | obj-$(CONFIG_SPARC_LED) += led.o | ||
| 24 | 25 | ||
| 25 | ifdef CONFIG_SUNOS_EMUL | 26 | ifdef CONFIG_SUNOS_EMUL |
| 26 | obj-y += sys_sunos.o sunos_ioctl.o | 27 | obj-y += sys_sunos.o sunos_ioctl.o |
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 6a4ebc62193e..d7bfc61d2879 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
| @@ -75,7 +75,7 @@ struct cpu_fp_info linux_sparc_fpu[] = { | |||
| 75 | { 9, 3, "Fujitsu or Weitek on-chip FPU"}, | 75 | { 9, 3, "Fujitsu or Weitek on-chip FPU"}, |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | #define NSPARCFPU (sizeof(linux_sparc_fpu)/sizeof(struct cpu_fp_info)) | 78 | #define NSPARCFPU ARRAY_SIZE(linux_sparc_fpu) |
| 79 | 79 | ||
| 80 | struct cpu_iu_info linux_sparc_chips[] = { | 80 | struct cpu_iu_info linux_sparc_chips[] = { |
| 81 | /* Sun4/100, 4/200, SLC */ | 81 | /* Sun4/100, 4/200, SLC */ |
| @@ -120,7 +120,7 @@ struct cpu_iu_info linux_sparc_chips[] = { | |||
| 120 | { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"}, | 120 | { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"}, |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
| 123 | #define NSPARCCHIPS (sizeof(linux_sparc_chips)/sizeof(struct cpu_iu_info)) | 123 | #define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) |
| 124 | 124 | ||
| 125 | char *sparc_cpu_type; | 125 | char *sparc_cpu_type; |
| 126 | char *sparc_fpu_type; | 126 | char *sparc_fpu_type; |
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c new file mode 100644 index 000000000000..2a3afca453c9 --- /dev/null +++ b/arch/sparc/kernel/led.c | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | #include <linux/kernel.h> | ||
| 2 | #include <linux/module.h> | ||
| 3 | #include <linux/init.h> | ||
| 4 | #include <linux/proc_fs.h> | ||
| 5 | #include <linux/string.h> | ||
| 6 | |||
| 7 | #include <asm/auxio.h> | ||
| 8 | |||
| 9 | #define LED_MAX_LENGTH 8 /* maximum chars written to proc file */ | ||
| 10 | |||
| 11 | static inline void led_toggle(void) | ||
| 12 | { | ||
| 13 | unsigned char val = get_auxio(); | ||
| 14 | unsigned char on, off; | ||
| 15 | |||
| 16 | if (val & AUXIO_LED) { | ||
| 17 | on = 0; | ||
| 18 | off = AUXIO_LED; | ||
| 19 | } else { | ||
| 20 | on = AUXIO_LED; | ||
| 21 | off = 0; | ||
| 22 | } | ||
| 23 | |||
| 24 | set_auxio(on, off); | ||
| 25 | } | ||
| 26 | |||
| 27 | static struct timer_list led_blink_timer; | ||
| 28 | |||
| 29 | static void led_blink(unsigned long timeout) | ||
| 30 | { | ||
| 31 | led_toggle(); | ||
| 32 | |||
| 33 | /* reschedule */ | ||
| 34 | if (!timeout) { /* blink according to load */ | ||
| 35 | led_blink_timer.expires = jiffies + | ||
| 36 | ((1 + (avenrun[0] >> FSHIFT)) * HZ); | ||
| 37 | led_blink_timer.data = 0; | ||
| 38 | } else { /* blink at user specified interval */ | ||
| 39 | led_blink_timer.expires = jiffies + (timeout * HZ); | ||
| 40 | led_blink_timer.data = timeout; | ||
| 41 | } | ||
| 42 | add_timer(&led_blink_timer); | ||
| 43 | } | ||
| 44 | |||
| 45 | static int led_read_proc(char *buf, char **start, off_t offset, int count, | ||
| 46 | int *eof, void *data) | ||
| 47 | { | ||
| 48 | int len = 0; | ||
| 49 | |||
| 50 | if (get_auxio() & AUXIO_LED) | ||
| 51 | len = sprintf(buf, "on\n"); | ||
| 52 | else | ||
| 53 | len = sprintf(buf, "off\n"); | ||
| 54 | |||
| 55 | return len; | ||
| 56 | } | ||
| 57 | |||
| 58 | static int led_write_proc(struct file *file, const char *buffer, | ||
| 59 | unsigned long count, void *data) | ||
| 60 | { | ||
| 61 | char *buf = NULL; | ||
| 62 | |||
| 63 | if (count > LED_MAX_LENGTH) | ||
| 64 | count = LED_MAX_LENGTH; | ||
| 65 | |||
| 66 | buf = kmalloc(sizeof(char) * (count + 1), GFP_KERNEL); | ||
| 67 | if (!buf) | ||
| 68 | return -ENOMEM; | ||
| 69 | |||
| 70 | if (copy_from_user(buf, buffer, count)) { | ||
| 71 | kfree(buf); | ||
| 72 | return -EFAULT; | ||
| 73 | } | ||
| 74 | |||
| 75 | buf[count] = '\0'; | ||
| 76 | |||
| 77 | /* work around \n when echo'ing into proc */ | ||
| 78 | if (buf[count - 1] == '\n') | ||
| 79 | buf[count - 1] = '\0'; | ||
| 80 | |||
| 81 | /* before we change anything we want to stop any running timers, | ||
| 82 | * otherwise calls such as on will have no persistent effect | ||
| 83 | */ | ||
| 84 | del_timer_sync(&led_blink_timer); | ||
| 85 | |||
| 86 | if (!strcmp(buf, "on")) { | ||
| 87 | auxio_set_led(AUXIO_LED_ON); | ||
| 88 | } else if (!strcmp(buf, "toggle")) { | ||
| 89 | led_toggle(); | ||
| 90 | } else if ((*buf > '0') && (*buf <= '9')) { | ||
| 91 | led_blink(simple_strtoul(buf, NULL, 10)); | ||
| 92 | } else if (!strcmp(buf, "load")) { | ||
| 93 | led_blink(0); | ||
| 94 | } else { | ||
| 95 | auxio_set_led(AUXIO_LED_OFF); | ||
| 96 | } | ||
| 97 | |||
| 98 | kfree(buf); | ||
| 99 | |||
| 100 | return count; | ||
| 101 | } | ||
| 102 | |||
| 103 | static struct proc_dir_entry *led; | ||
| 104 | |||
| 105 | #define LED_VERSION "0.1" | ||
| 106 | |||
| 107 | static int __init led_init(void) | ||
| 108 | { | ||
| 109 | init_timer(&led_blink_timer); | ||
| 110 | led_blink_timer.function = led_blink; | ||
| 111 | |||
| 112 | led = create_proc_entry("led", 0, NULL); | ||
| 113 | if (!led) | ||
| 114 | return -ENOMEM; | ||
| 115 | |||
| 116 | led->read_proc = led_read_proc; /* reader function */ | ||
| 117 | led->write_proc = led_write_proc; /* writer function */ | ||
| 118 | led->owner = THIS_MODULE; | ||
| 119 | |||
| 120 | printk(KERN_INFO | ||
| 121 | "led: version %s, Lars Kotthoff <metalhead@metalhead.ws>\n", | ||
| 122 | LED_VERSION); | ||
| 123 | |||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | static void __exit led_exit(void) | ||
| 128 | { | ||
| 129 | remove_proc_entry("led", NULL); | ||
| 130 | del_timer_sync(&led_blink_timer); | ||
| 131 | } | ||
| 132 | |||
| 133 | module_init(led_init); | ||
| 134 | module_exit(led_exit); | ||
| 135 | |||
| 136 | MODULE_AUTHOR("Lars Kotthoff <metalhead@metalhead.ws>"); | ||
| 137 | MODULE_DESCRIPTION("Provides control of the front LED on SPARC systems."); | ||
| 138 | MODULE_LICENSE("GPL"); | ||
| 139 | MODULE_VERSION(LED_VERSION); | ||
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 25e31d5ec99b..cccfc12802ed 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
| @@ -143,7 +143,7 @@ static struct pcic_ca2irq pcic_i_jk[] = { | |||
| 143 | * as several PROMs may be installed on the same physical board. | 143 | * as several PROMs may be installed on the same physical board. |
| 144 | */ | 144 | */ |
| 145 | #define SN2L_INIT(name, map) \ | 145 | #define SN2L_INIT(name, map) \ |
| 146 | { name, map, sizeof(map)/sizeof(struct pcic_ca2irq) } | 146 | { name, map, ARRAY_SIZE(map) } |
| 147 | 147 | ||
| 148 | static struct pcic_sn2list pcic_known_sysnames[] = { | 148 | static struct pcic_sn2list pcic_known_sysnames[] = { |
| 149 | SN2L_INIT("SUNW,JavaEngine1", pcic_i_je1a), /* JE1, PROM 2.32 */ | 149 | SN2L_INIT("SUNW,JavaEngine1", pcic_i_je1a), /* JE1, PROM 2.32 */ |
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index 29e72b57d4fd..ea8647411462 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c | |||
| @@ -67,13 +67,6 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *); | |||
| 67 | struct task_struct *last_task_used_math = NULL; | 67 | struct task_struct *last_task_used_math = NULL; |
| 68 | struct thread_info *current_set[NR_CPUS]; | 68 | struct thread_info *current_set[NR_CPUS]; |
| 69 | 69 | ||
| 70 | /* | ||
| 71 | * default_idle is new in 2.5. XXX Review, currently stolen from sparc64. | ||
| 72 | */ | ||
| 73 | void default_idle(void) | ||
| 74 | { | ||
| 75 | } | ||
| 76 | |||
| 77 | #ifndef CONFIG_SMP | 70 | #ifndef CONFIG_SMP |
| 78 | 71 | ||
| 79 | #define SUN4C_FAULT_HIGH 100 | 72 | #define SUN4C_FAULT_HIGH 100 |
| @@ -92,12 +85,11 @@ void cpu_idle(void) | |||
| 92 | static unsigned long fps; | 85 | static unsigned long fps; |
| 93 | unsigned long now; | 86 | unsigned long now; |
| 94 | unsigned long faults; | 87 | unsigned long faults; |
| 95 | unsigned long flags; | ||
| 96 | 88 | ||
| 97 | extern unsigned long sun4c_kernel_faults; | 89 | extern unsigned long sun4c_kernel_faults; |
| 98 | extern void sun4c_grow_kernel_ring(void); | 90 | extern void sun4c_grow_kernel_ring(void); |
| 99 | 91 | ||
| 100 | local_irq_save(flags); | 92 | local_irq_disable(); |
| 101 | now = jiffies; | 93 | now = jiffies; |
| 102 | count -= (now - last_jiffies); | 94 | count -= (now - last_jiffies); |
| 103 | last_jiffies = now; | 95 | last_jiffies = now; |
| @@ -113,14 +105,19 @@ void cpu_idle(void) | |||
| 113 | sun4c_grow_kernel_ring(); | 105 | sun4c_grow_kernel_ring(); |
| 114 | } | 106 | } |
| 115 | } | 107 | } |
| 116 | local_irq_restore(flags); | 108 | local_irq_enable(); |
| 117 | } | 109 | } |
| 118 | 110 | ||
| 119 | while((!need_resched()) && pm_idle) { | 111 | if (pm_idle) { |
| 120 | (*pm_idle)(); | 112 | while (!need_resched()) |
| 113 | (*pm_idle)(); | ||
| 114 | } else { | ||
| 115 | while (!need_resched()) | ||
| 116 | cpu_relax(); | ||
| 121 | } | 117 | } |
| 122 | 118 | preempt_enable_no_resched(); | |
| 123 | schedule(); | 119 | schedule(); |
| 120 | preempt_disable(); | ||
| 124 | check_pgt_cache(); | 121 | check_pgt_cache(); |
| 125 | } | 122 | } |
| 126 | } | 123 | } |
| @@ -130,13 +127,15 @@ void cpu_idle(void) | |||
| 130 | /* This is being executed in task 0 'user space'. */ | 127 | /* This is being executed in task 0 'user space'. */ |
| 131 | void cpu_idle(void) | 128 | void cpu_idle(void) |
| 132 | { | 129 | { |
| 130 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
| 133 | /* endless idle loop with no priority at all */ | 131 | /* endless idle loop with no priority at all */ |
| 134 | while(1) { | 132 | while(1) { |
| 135 | if(need_resched()) { | 133 | while (!need_resched()) |
| 136 | schedule(); | 134 | cpu_relax(); |
| 137 | check_pgt_cache(); | 135 | preempt_enable_no_resched(); |
| 138 | } | 136 | schedule(); |
| 139 | barrier(); /* or else gcc optimizes... */ | 137 | preempt_disable(); |
| 138 | check_pgt_cache(); | ||
| 140 | } | 139 | } |
| 141 | } | 140 | } |
| 142 | 141 | ||
diff --git a/arch/sparc/kernel/sunos_ioctl.c b/arch/sparc/kernel/sunos_ioctl.c index df1c0b31a930..a6ba3d26222c 100644 --- a/arch/sparc/kernel/sunos_ioctl.c +++ b/arch/sparc/kernel/sunos_ioctl.c | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/smp_lock.h> | 23 | #include <linux/smp_lock.h> |
| 24 | #include <linux/syscalls.h> | 24 | #include <linux/syscalls.h> |
| 25 | #include <linux/file.h> | 25 | #include <linux/file.h> |
| 26 | #include <asm/kbio.h> | ||
| 27 | 26 | ||
| 28 | #if 0 | 27 | #if 0 |
| 29 | extern char sunkbd_type; | 28 | extern char sunkbd_type; |
