diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/Kconfig | 2 | ||||
-rw-r--r-- | arch/mips/boot/.gitignore | 4 | ||||
-rw-r--r-- | arch/mips/configs/pnx8550-jbs_defconfig | 11 | ||||
-rw-r--r-- | arch/mips/configs/pnx8550-v2pci_defconfig | 10 | ||||
-rw-r--r-- | arch/mips/ddb5xxx/common/rtc_ds1386.c | 6 | ||||
-rw-r--r-- | arch/mips/dec/time.c | 24 | ||||
-rw-r--r-- | arch/mips/jmr3927/common/rtc_ds1742.c | 6 | ||||
-rw-r--r-- | arch/mips/kernel/irixsig.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/rtlx.c | 197 | ||||
-rw-r--r-- | arch/mips/kernel/signal.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/signal32.c | 13 | ||||
-rw-r--r-- | arch/mips/kernel/vpe.c | 100 | ||||
-rw-r--r-- | arch/mips/lasat/ds1603.c | 9 | ||||
-rw-r--r-- | arch/mips/momentum/jaguar_atx/setup.c | 6 | ||||
-rw-r--r-- | arch/mips/momentum/ocelot_3/setup.c | 6 | ||||
-rw-r--r-- | arch/mips/momentum/ocelot_c/setup.c | 6 | ||||
-rw-r--r-- | arch/mips/pmc-sierra/yosemite/setup.c | 6 | ||||
-rw-r--r-- | arch/mips/sgi-ip22/ip22-time.c | 6 | ||||
-rw-r--r-- | arch/mips/sibyte/swarm/rtc_m41t81.c | 7 | ||||
-rw-r--r-- | arch/mips/sibyte/swarm/rtc_xicor1241.c | 6 |
20 files changed, 249 insertions, 182 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0097a0d53b3b..e380a8322a94 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -958,7 +958,7 @@ config SOC_PNX8550 | |||
958 | bool | 958 | bool |
959 | select DMA_NONCOHERENT | 959 | select DMA_NONCOHERENT |
960 | select HW_HAS_PCI | 960 | select HW_HAS_PCI |
961 | select SYS_HAS_CPU_R4X00 | 961 | select SYS_HAS_CPU_MIPS32_R1 |
962 | select SYS_SUPPORTS_32BIT_KERNEL | 962 | select SYS_SUPPORTS_32BIT_KERNEL |
963 | 963 | ||
964 | config SWAP_IO_SPACE | 964 | config SWAP_IO_SPACE |
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore new file mode 100644 index 000000000000..ba63401c6e10 --- /dev/null +++ b/arch/mips/boot/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | mkboot | ||
2 | elf2ecoff | ||
3 | zImage | ||
4 | zImage.tmp | ||
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig index 95f84d711912..555837e4c06f 100644 --- a/arch/mips/configs/pnx8550-jbs_defconfig +++ b/arch/mips/configs/pnx8550-jbs_defconfig | |||
@@ -129,7 +129,7 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5 | |||
129 | # | 129 | # |
130 | # CPU selection | 130 | # CPU selection |
131 | # | 131 | # |
132 | # CONFIG_CPU_MIPS32_R1 is not set | 132 | CONFIG_CPU_MIPS32_R1=y |
133 | # CONFIG_CPU_MIPS32_R2 is not set | 133 | # CONFIG_CPU_MIPS32_R2 is not set |
134 | # CONFIG_CPU_MIPS64_R1 is not set | 134 | # CONFIG_CPU_MIPS64_R1 is not set |
135 | # CONFIG_CPU_MIPS64_R2 is not set | 135 | # CONFIG_CPU_MIPS64_R2 is not set |
@@ -137,7 +137,7 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5 | |||
137 | # CONFIG_CPU_TX39XX is not set | 137 | # CONFIG_CPU_TX39XX is not set |
138 | # CONFIG_CPU_VR41XX is not set | 138 | # CONFIG_CPU_VR41XX is not set |
139 | # CONFIG_CPU_R4300 is not set | 139 | # CONFIG_CPU_R4300 is not set |
140 | CONFIG_CPU_R4X00=y | 140 | # CONFIG_CPU_R4X00 is not set |
141 | # CONFIG_CPU_TX49XX is not set | 141 | # CONFIG_CPU_TX49XX is not set |
142 | # CONFIG_CPU_R5000 is not set | 142 | # CONFIG_CPU_R5000 is not set |
143 | # CONFIG_CPU_R5432 is not set | 143 | # CONFIG_CPU_R5432 is not set |
@@ -148,10 +148,11 @@ CONFIG_CPU_R4X00=y | |||
148 | # CONFIG_CPU_RM7000 is not set | 148 | # CONFIG_CPU_RM7000 is not set |
149 | # CONFIG_CPU_RM9000 is not set | 149 | # CONFIG_CPU_RM9000 is not set |
150 | # CONFIG_CPU_SB1 is not set | 150 | # CONFIG_CPU_SB1 is not set |
151 | CONFIG_SYS_HAS_CPU_R4X00=y | 151 | CONFIG_SYS_HAS_CPU_MIPS32_R1=y |
152 | CONFIG_CPU_MIPS32=y | ||
153 | CONFIG_CPU_MIPSR1=y | ||
152 | CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y | 154 | CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y |
153 | CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y | 155 | CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y |
154 | CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y | ||
155 | 156 | ||
156 | # | 157 | # |
157 | # Kernel type | 158 | # Kernel type |
@@ -162,11 +163,11 @@ CONFIG_PAGE_SIZE_4KB=y | |||
162 | # CONFIG_PAGE_SIZE_8KB is not set | 163 | # CONFIG_PAGE_SIZE_8KB is not set |
163 | # CONFIG_PAGE_SIZE_16KB is not set | 164 | # CONFIG_PAGE_SIZE_16KB is not set |
164 | # CONFIG_PAGE_SIZE_64KB is not set | 165 | # CONFIG_PAGE_SIZE_64KB is not set |
166 | CONFIG_CPU_HAS_PREFETCH=y | ||
165 | # CONFIG_MIPS_MT is not set | 167 | # CONFIG_MIPS_MT is not set |
166 | # CONFIG_64BIT_PHYS_ADDR is not set | 168 | # CONFIG_64BIT_PHYS_ADDR is not set |
167 | # CONFIG_CPU_ADVANCED is not set | 169 | # CONFIG_CPU_ADVANCED is not set |
168 | CONFIG_CPU_HAS_LLSC=y | 170 | CONFIG_CPU_HAS_LLSC=y |
169 | CONFIG_CPU_HAS_LLDSCD=y | ||
170 | CONFIG_CPU_HAS_SYNC=y | 171 | CONFIG_CPU_HAS_SYNC=y |
171 | CONFIG_GENERIC_HARDIRQS=y | 172 | CONFIG_GENERIC_HARDIRQS=y |
172 | CONFIG_GENERIC_IRQ_PROBE=y | 173 | CONFIG_GENERIC_IRQ_PROBE=y |
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig index deb24c29ac0a..05e65206a7b4 100644 --- a/arch/mips/configs/pnx8550-v2pci_defconfig +++ b/arch/mips/configs/pnx8550-v2pci_defconfig | |||
@@ -128,7 +128,7 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5 | |||
128 | # | 128 | # |
129 | # CPU selection | 129 | # CPU selection |
130 | # | 130 | # |
131 | # CONFIG_CPU_MIPS32_R1 is not set | 131 | CONFIG_CPU_MIPS32_R1=y |
132 | # CONFIG_CPU_MIPS32_R2 is not set | 132 | # CONFIG_CPU_MIPS32_R2 is not set |
133 | # CONFIG_CPU_MIPS64_R1 is not set | 133 | # CONFIG_CPU_MIPS64_R1 is not set |
134 | # CONFIG_CPU_MIPS64_R2 is not set | 134 | # CONFIG_CPU_MIPS64_R2 is not set |
@@ -136,7 +136,7 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5 | |||
136 | # CONFIG_CPU_TX39XX is not set | 136 | # CONFIG_CPU_TX39XX is not set |
137 | # CONFIG_CPU_VR41XX is not set | 137 | # CONFIG_CPU_VR41XX is not set |
138 | # CONFIG_CPU_R4300 is not set | 138 | # CONFIG_CPU_R4300 is not set |
139 | CONFIG_CPU_R4X00=y | 139 | # CONFIG_CPU_R4X00 is not set |
140 | # CONFIG_CPU_TX49XX is not set | 140 | # CONFIG_CPU_TX49XX is not set |
141 | # CONFIG_CPU_R5000 is not set | 141 | # CONFIG_CPU_R5000 is not set |
142 | # CONFIG_CPU_R5432 is not set | 142 | # CONFIG_CPU_R5432 is not set |
@@ -147,10 +147,11 @@ CONFIG_CPU_R4X00=y | |||
147 | # CONFIG_CPU_RM7000 is not set | 147 | # CONFIG_CPU_RM7000 is not set |
148 | # CONFIG_CPU_RM9000 is not set | 148 | # CONFIG_CPU_RM9000 is not set |
149 | # CONFIG_CPU_SB1 is not set | 149 | # CONFIG_CPU_SB1 is not set |
150 | CONFIG_SYS_HAS_CPU_R4X00=y | 150 | CONFIG_SYS_HAS_CPU_MIPS32_R1=y |
151 | CONFIG_CPU_MIPS32=y | ||
152 | CONFIG_CPU_MIPSR1=y | ||
151 | CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y | 153 | CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y |
152 | CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y | 154 | CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y |
153 | CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y | ||
154 | 155 | ||
155 | # | 156 | # |
156 | # Kernel type | 157 | # Kernel type |
@@ -161,6 +162,7 @@ CONFIG_PAGE_SIZE_4KB=y | |||
161 | # CONFIG_PAGE_SIZE_8KB is not set | 162 | # CONFIG_PAGE_SIZE_8KB is not set |
162 | # CONFIG_PAGE_SIZE_16KB is not set | 163 | # CONFIG_PAGE_SIZE_16KB is not set |
163 | # CONFIG_PAGE_SIZE_64KB is not set | 164 | # CONFIG_PAGE_SIZE_64KB is not set |
165 | CONFIG_CPU_HAS_PREFETCH=y | ||
164 | # CONFIG_MIPS_MT is not set | 166 | # CONFIG_MIPS_MT is not set |
165 | # CONFIG_64BIT_PHYS_ADDR is not set | 167 | # CONFIG_64BIT_PHYS_ADDR is not set |
166 | CONFIG_CPU_ADVANCED=y | 168 | CONFIG_CPU_ADVANCED=y |
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c index f5b11508ff2f..995896ac0e39 100644 --- a/arch/mips/ddb5xxx/common/rtc_ds1386.c +++ b/arch/mips/ddb5xxx/common/rtc_ds1386.c | |||
@@ -41,7 +41,9 @@ rtc_ds1386_get_time(void) | |||
41 | u8 byte; | 41 | u8 byte; |
42 | u8 temp; | 42 | u8 temp; |
43 | unsigned int year, month, day, hour, minute, second; | 43 | unsigned int year, month, day, hour, minute, second; |
44 | unsigned long flags; | ||
44 | 45 | ||
46 | spin_lock_irqsave(&rtc_lock, flags); | ||
45 | /* let us freeze external registers */ | 47 | /* let us freeze external registers */ |
46 | byte = READ_RTC(0xB); | 48 | byte = READ_RTC(0xB); |
47 | byte &= 0x3f; | 49 | byte &= 0x3f; |
@@ -60,6 +62,7 @@ rtc_ds1386_get_time(void) | |||
60 | /* enable time transfer */ | 62 | /* enable time transfer */ |
61 | byte |= 0x80; | 63 | byte |= 0x80; |
62 | WRITE_RTC(0xB, byte); | 64 | WRITE_RTC(0xB, byte); |
65 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
63 | 66 | ||
64 | /* calc hour */ | 67 | /* calc hour */ |
65 | if (temp & 0x40) { | 68 | if (temp & 0x40) { |
@@ -81,7 +84,9 @@ rtc_ds1386_set_time(unsigned long t) | |||
81 | u8 byte; | 84 | u8 byte; |
82 | u8 temp; | 85 | u8 temp; |
83 | u8 year, month, day, hour, minute, second; | 86 | u8 year, month, day, hour, minute, second; |
87 | unsigned long flags; | ||
84 | 88 | ||
89 | spin_lock_irqsave(&rtc_lock, flags); | ||
85 | /* let us freeze external registers */ | 90 | /* let us freeze external registers */ |
86 | byte = READ_RTC(0xB); | 91 | byte = READ_RTC(0xB); |
87 | byte &= 0x3f; | 92 | byte &= 0x3f; |
@@ -133,6 +138,7 @@ rtc_ds1386_set_time(unsigned long t) | |||
133 | if (second != READ_RTC(0x1)) { | 138 | if (second != READ_RTC(0x1)) { |
134 | WRITE_RTC(0x1, second); | 139 | WRITE_RTC(0x1, second); |
135 | } | 140 | } |
141 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
136 | 142 | ||
137 | return 0; | 143 | return 0; |
138 | } | 144 | } |
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c index dc7091caa7aa..174822344131 100644 --- a/arch/mips/dec/time.c +++ b/arch/mips/dec/time.c | |||
@@ -37,10 +37,25 @@ | |||
37 | #include <asm/dec/machtype.h> | 37 | #include <asm/dec/machtype.h> |
38 | 38 | ||
39 | 39 | ||
40 | /* | ||
41 | * Returns true if a clock update is in progress | ||
42 | */ | ||
43 | static inline unsigned char dec_rtc_is_updating(void) | ||
44 | { | ||
45 | unsigned char uip; | ||
46 | unsigned long flags; | ||
47 | |||
48 | spin_lock_irqsave(&rtc_lock, flags); | ||
49 | uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); | ||
50 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
51 | return uip; | ||
52 | } | ||
53 | |||
40 | static unsigned long dec_rtc_get_time(void) | 54 | static unsigned long dec_rtc_get_time(void) |
41 | { | 55 | { |
42 | unsigned int year, mon, day, hour, min, sec, real_year; | 56 | unsigned int year, mon, day, hour, min, sec, real_year; |
43 | int i; | 57 | int i; |
58 | unsigned long flags; | ||
44 | 59 | ||
45 | /* The Linux interpretation of the DS1287 clock register contents: | 60 | /* The Linux interpretation of the DS1287 clock register contents: |
46 | * When the Update-In-Progress (UIP) flag goes from 1 to 0, the | 61 | * When the Update-In-Progress (UIP) flag goes from 1 to 0, the |
@@ -49,11 +64,12 @@ static unsigned long dec_rtc_get_time(void) | |||
49 | */ | 64 | */ |
50 | /* read RTC exactly on falling edge of update flag */ | 65 | /* read RTC exactly on falling edge of update flag */ |
51 | for (i = 0; i < 1000000; i++) /* may take up to 1 second... */ | 66 | for (i = 0; i < 1000000; i++) /* may take up to 1 second... */ |
52 | if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) | 67 | if (dec_rtc_is_updating()) |
53 | break; | 68 | break; |
54 | for (i = 0; i < 1000000; i++) /* must try at least 2.228 ms */ | 69 | for (i = 0; i < 1000000; i++) /* must try at least 2.228 ms */ |
55 | if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) | 70 | if (!dec_rtc_is_updating()) |
56 | break; | 71 | break; |
72 | spin_lock_irqsave(&rtc_lock, flags); | ||
57 | /* Isn't this overkill? UIP above should guarantee consistency */ | 73 | /* Isn't this overkill? UIP above should guarantee consistency */ |
58 | do { | 74 | do { |
59 | sec = CMOS_READ(RTC_SECONDS); | 75 | sec = CMOS_READ(RTC_SECONDS); |
@@ -77,6 +93,7 @@ static unsigned long dec_rtc_get_time(void) | |||
77 | * of unused BBU RAM locations. | 93 | * of unused BBU RAM locations. |
78 | */ | 94 | */ |
79 | real_year = CMOS_READ(RTC_DEC_YEAR); | 95 | real_year = CMOS_READ(RTC_DEC_YEAR); |
96 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
80 | year += real_year - 72 + 2000; | 97 | year += real_year - 72 + 2000; |
81 | 98 | ||
82 | return mktime(year, mon, day, hour, min, sec); | 99 | return mktime(year, mon, day, hour, min, sec); |
@@ -95,6 +112,8 @@ static int dec_rtc_set_mmss(unsigned long nowtime) | |||
95 | int real_seconds, real_minutes, cmos_minutes; | 112 | int real_seconds, real_minutes, cmos_minutes; |
96 | unsigned char save_control, save_freq_select; | 113 | unsigned char save_control, save_freq_select; |
97 | 114 | ||
115 | /* irq are locally disabled here */ | ||
116 | spin_lock(&rtc_lock); | ||
98 | /* tell the clock it's being set */ | 117 | /* tell the clock it's being set */ |
99 | save_control = CMOS_READ(RTC_CONTROL); | 118 | save_control = CMOS_READ(RTC_CONTROL); |
100 | CMOS_WRITE((save_control | RTC_SET), RTC_CONTROL); | 119 | CMOS_WRITE((save_control | RTC_SET), RTC_CONTROL); |
@@ -141,6 +160,7 @@ static int dec_rtc_set_mmss(unsigned long nowtime) | |||
141 | */ | 160 | */ |
142 | CMOS_WRITE(save_control, RTC_CONTROL); | 161 | CMOS_WRITE(save_control, RTC_CONTROL); |
143 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); | 162 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); |
163 | spin_unlock(&rtc_lock); | ||
144 | 164 | ||
145 | return retval; | 165 | return retval; |
146 | } | 166 | } |
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c index 1ae4318e1358..8b407d7dc460 100644 --- a/arch/mips/jmr3927/common/rtc_ds1742.c +++ b/arch/mips/jmr3927/common/rtc_ds1742.c | |||
@@ -57,7 +57,9 @@ rtc_ds1742_get_time(void) | |||
57 | { | 57 | { |
58 | unsigned int year, month, day, hour, minute, second; | 58 | unsigned int year, month, day, hour, minute, second; |
59 | unsigned int century; | 59 | unsigned int century; |
60 | unsigned long flags; | ||
60 | 61 | ||
62 | spin_lock_irqsave(&rtc_lock, flags); | ||
61 | CMOS_WRITE(RTC_READ, RTC_CONTROL); | 63 | CMOS_WRITE(RTC_READ, RTC_CONTROL); |
62 | second = BCD2BIN(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); | 64 | second = BCD2BIN(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); |
63 | minute = BCD2BIN(CMOS_READ(RTC_MINUTES)); | 65 | minute = BCD2BIN(CMOS_READ(RTC_MINUTES)); |
@@ -67,6 +69,7 @@ rtc_ds1742_get_time(void) | |||
67 | year = BCD2BIN(CMOS_READ(RTC_YEAR)); | 69 | year = BCD2BIN(CMOS_READ(RTC_YEAR)); |
68 | century = BCD2BIN(CMOS_READ(RTC_CENTURY) & RTC_CENTURY_MASK); | 70 | century = BCD2BIN(CMOS_READ(RTC_CENTURY) & RTC_CENTURY_MASK); |
69 | CMOS_WRITE(0, RTC_CONTROL); | 71 | CMOS_WRITE(0, RTC_CONTROL); |
72 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
70 | 73 | ||
71 | year += century * 100; | 74 | year += century * 100; |
72 | 75 | ||
@@ -81,7 +84,9 @@ rtc_ds1742_set_time(unsigned long t) | |||
81 | u8 year, month, day, hour, minute, second; | 84 | u8 year, month, day, hour, minute, second; |
82 | u8 cmos_year, cmos_month, cmos_day, cmos_hour, cmos_minute, cmos_second; | 85 | u8 cmos_year, cmos_month, cmos_day, cmos_hour, cmos_minute, cmos_second; |
83 | int cmos_century; | 86 | int cmos_century; |
87 | unsigned long flags; | ||
84 | 88 | ||
89 | spin_lock_irqsave(&rtc_lock, flags); | ||
85 | CMOS_WRITE(RTC_READ, RTC_CONTROL); | 90 | CMOS_WRITE(RTC_READ, RTC_CONTROL); |
86 | cmos_second = (u8)(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); | 91 | cmos_second = (u8)(CMOS_READ(RTC_SECONDS) & RTC_SECONDS_MASK); |
87 | cmos_minute = (u8)CMOS_READ(RTC_MINUTES); | 92 | cmos_minute = (u8)CMOS_READ(RTC_MINUTES); |
@@ -139,6 +144,7 @@ rtc_ds1742_set_time(unsigned long t) | |||
139 | 144 | ||
140 | /* RTC_CENTURY and RTC_CONTROL share same address... */ | 145 | /* RTC_CENTURY and RTC_CONTROL share same address... */ |
141 | CMOS_WRITE(cmos_century, RTC_CONTROL); | 146 | CMOS_WRITE(cmos_century, RTC_CONTROL); |
147 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
142 | 148 | ||
143 | return 0; | 149 | return 0; |
144 | } | 150 | } |
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c index 908e63684208..dd118c60bcd0 100644 --- a/arch/mips/kernel/irixsig.c +++ b/arch/mips/kernel/irixsig.c | |||
@@ -502,8 +502,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set, | |||
502 | while(1) { | 502 | while(1) { |
503 | long tmp = 0; | 503 | long tmp = 0; |
504 | 504 | ||
505 | current->state = TASK_INTERRUPTIBLE; | 505 | expire = schedule_timeout_interruptible(expire); |
506 | expire = schedule_timeout(expire); | ||
507 | 506 | ||
508 | for (i=0; i<=4; i++) | 507 | for (i=0; i<=4; i++) |
509 | tmp |= (current->pending.signal.sig[i] & kset.sig[i]); | 508 | tmp |= (current->pending.signal.sig[i] & kset.sig[i]); |
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index 8c81f3cb4e2d..1d855112bac2 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -20,42 +20,42 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <asm/uaccess.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/list.h> | ||
26 | #include <linux/vmalloc.h> | ||
27 | #include <linux/elf.h> | ||
28 | #include <linux/seq_file.h> | ||
29 | #include <linux/syscalls.h> | ||
30 | #include <linux/moduleloader.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/poll.h> | 23 | #include <linux/poll.h> |
33 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
34 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
35 | #include <asm/mipsmtregs.h> | 26 | #include <asm/mipsmtregs.h> |
36 | #include <asm/cacheflush.h> | 27 | #include <asm/bitops.h> |
37 | #include <asm/atomic.h> | ||
38 | #include <asm/cpu.h> | 28 | #include <asm/cpu.h> |
39 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
40 | #include <asm/system.h> | ||
41 | #include <asm/rtlx.h> | 30 | #include <asm/rtlx.h> |
31 | #include <asm/uaccess.h> | ||
42 | 32 | ||
43 | #define RTLX_MAJOR 64 | ||
44 | #define RTLX_TARG_VPE 1 | 33 | #define RTLX_TARG_VPE 1 |
45 | 34 | ||
46 | struct rtlx_info *rtlx; | 35 | static struct rtlx_info *rtlx; |
47 | static int major; | 36 | static int major; |
48 | static char module_name[] = "rtlx"; | 37 | static char module_name[] = "rtlx"; |
49 | static inline int spacefree(int read, int write, int size); | 38 | static struct irqaction irq; |
39 | static int irq_num; | ||
40 | |||
41 | static inline int spacefree(int read, int write, int size) | ||
42 | { | ||
43 | if (read == write) { | ||
44 | /* | ||
45 | * never fill the buffer completely, so indexes are always | ||
46 | * equal if empty and only empty, or !equal if data available | ||
47 | */ | ||
48 | return size - 1; | ||
49 | } | ||
50 | |||
51 | return ((read + size - write) % size) - 1; | ||
52 | } | ||
50 | 53 | ||
51 | static struct chan_waitqueues { | 54 | static struct chan_waitqueues { |
52 | wait_queue_head_t rt_queue; | 55 | wait_queue_head_t rt_queue; |
53 | wait_queue_head_t lx_queue; | 56 | wait_queue_head_t lx_queue; |
54 | } channel_wqs[RTLX_CHANNELS]; | 57 | } channel_wqs[RTLX_CHANNELS]; |
55 | 58 | ||
56 | static struct irqaction irq; | ||
57 | static int irq_num; | ||
58 | |||
59 | extern void *vpe_get_shared(int index); | 59 | extern void *vpe_get_shared(int index); |
60 | 60 | ||
61 | static void rtlx_dispatch(struct pt_regs *regs) | 61 | static void rtlx_dispatch(struct pt_regs *regs) |
@@ -63,9 +63,8 @@ static void rtlx_dispatch(struct pt_regs *regs) | |||
63 | do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ, regs); | 63 | do_IRQ(MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ, regs); |
64 | } | 64 | } |
65 | 65 | ||
66 | irqreturn_t rtlx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 66 | static irqreturn_t rtlx_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
67 | { | 67 | { |
68 | irqreturn_t r = IRQ_HANDLED; | ||
69 | int i; | 68 | int i; |
70 | 69 | ||
71 | for (i = 0; i < RTLX_CHANNELS; i++) { | 70 | for (i = 0; i < RTLX_CHANNELS; i++) { |
@@ -75,30 +74,7 @@ irqreturn_t rtlx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
75 | wake_up_interruptible(&channel_wqs[i].lx_queue); | 74 | wake_up_interruptible(&channel_wqs[i].lx_queue); |
76 | } | 75 | } |
77 | 76 | ||
78 | return r; | 77 | return IRQ_HANDLED; |
79 | } | ||
80 | |||
81 | void dump_rtlx(void) | ||
82 | { | ||
83 | int i; | ||
84 | |||
85 | printk("id 0x%lx state %d\n", rtlx->id, rtlx->state); | ||
86 | |||
87 | for (i = 0; i < RTLX_CHANNELS; i++) { | ||
88 | struct rtlx_channel *chan = &rtlx->channel[i]; | ||
89 | |||
90 | printk(" rt_state %d lx_state %d buffer_size %d\n", | ||
91 | chan->rt_state, chan->lx_state, chan->buffer_size); | ||
92 | |||
93 | printk(" rt_read %d rt_write %d\n", | ||
94 | chan->rt_read, chan->rt_write); | ||
95 | |||
96 | printk(" lx_read %d lx_write %d\n", | ||
97 | chan->lx_read, chan->lx_write); | ||
98 | |||
99 | printk(" rt_buffer <%s>\n", chan->rt_buffer); | ||
100 | printk(" lx_buffer <%s>\n", chan->lx_buffer); | ||
101 | } | ||
102 | } | 78 | } |
103 | 79 | ||
104 | /* call when we have the address of the shared structure from the SP side. */ | 80 | /* call when we have the address of the shared structure from the SP side. */ |
@@ -108,7 +84,7 @@ static int rtlx_init(struct rtlx_info *rtlxi) | |||
108 | 84 | ||
109 | if (rtlxi->id != RTLX_ID) { | 85 | if (rtlxi->id != RTLX_ID) { |
110 | printk(KERN_WARNING "no valid RTLX id at 0x%p\n", rtlxi); | 86 | printk(KERN_WARNING "no valid RTLX id at 0x%p\n", rtlxi); |
111 | return (-ENOEXEC); | 87 | return -ENOEXEC; |
112 | } | 88 | } |
113 | 89 | ||
114 | /* initialise the wait queues */ | 90 | /* initialise the wait queues */ |
@@ -120,9 +96,8 @@ static int rtlx_init(struct rtlx_info *rtlxi) | |||
120 | /* set up for interrupt handling */ | 96 | /* set up for interrupt handling */ |
121 | memset(&irq, 0, sizeof(struct irqaction)); | 97 | memset(&irq, 0, sizeof(struct irqaction)); |
122 | 98 | ||
123 | if (cpu_has_vint) { | 99 | if (cpu_has_vint) |
124 | set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); | 100 | set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); |
125 | } | ||
126 | 101 | ||
127 | irq_num = MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ; | 102 | irq_num = MIPSCPU_INT_BASE + MIPS_CPU_RTLX_IRQ; |
128 | irq.handler = rtlx_interrupt; | 103 | irq.handler = rtlx_interrupt; |
@@ -132,7 +107,8 @@ static int rtlx_init(struct rtlx_info *rtlxi) | |||
132 | setup_irq(irq_num, &irq); | 107 | setup_irq(irq_num, &irq); |
133 | 108 | ||
134 | rtlx = rtlxi; | 109 | rtlx = rtlxi; |
135 | return (0); | 110 | |
111 | return 0; | ||
136 | } | 112 | } |
137 | 113 | ||
138 | /* only allow one open process at a time to open each channel */ | 114 | /* only allow one open process at a time to open each channel */ |
@@ -147,36 +123,36 @@ static int rtlx_open(struct inode *inode, struct file *filp) | |||
147 | if (rtlx == NULL) { | 123 | if (rtlx == NULL) { |
148 | struct rtlx_info **p; | 124 | struct rtlx_info **p; |
149 | if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) { | 125 | if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) { |
150 | printk(" vpe_get_shared is NULL. Has an SP program been loaded?\n"); | 126 | printk(KERN_ERR "vpe_get_shared is NULL. " |
151 | return (-EFAULT); | 127 | "Has an SP program been loaded?\n"); |
128 | return -EFAULT; | ||
152 | } | 129 | } |
153 | 130 | ||
154 | if (*p == NULL) { | 131 | if (*p == NULL) { |
155 | printk(" vpe_shared %p %p\n", p, *p); | 132 | printk(KERN_ERR "vpe_shared %p %p\n", p, *p); |
156 | return (-EFAULT); | 133 | return -EFAULT; |
157 | } | 134 | } |
158 | 135 | ||
159 | if ((ret = rtlx_init(*p)) < 0) | 136 | if ((ret = rtlx_init(*p)) < 0) |
160 | return (ret); | 137 | return ret; |
161 | } | 138 | } |
162 | 139 | ||
163 | chan = &rtlx->channel[minor]; | 140 | chan = &rtlx->channel[minor]; |
164 | 141 | ||
165 | /* already open? */ | 142 | if (test_and_set_bit(RTLX_STATE_OPENED, &chan->lx_state)) |
166 | if (chan->lx_state == RTLX_STATE_OPENED) | 143 | return -EBUSY; |
167 | return (-EBUSY); | ||
168 | 144 | ||
169 | chan->lx_state = RTLX_STATE_OPENED; | 145 | return 0; |
170 | return (0); | ||
171 | } | 146 | } |
172 | 147 | ||
173 | static int rtlx_release(struct inode *inode, struct file *filp) | 148 | static int rtlx_release(struct inode *inode, struct file *filp) |
174 | { | 149 | { |
175 | int minor; | 150 | int minor = MINOR(inode->i_rdev); |
176 | 151 | ||
177 | minor = MINOR(inode->i_rdev); | 152 | clear_bit(RTLX_STATE_OPENED, &rtlx->channel[minor].lx_state); |
178 | rtlx->channel[minor].lx_state = RTLX_STATE_UNUSED; | 153 | smp_mb__after_clear_bit(); |
179 | return (0); | 154 | |
155 | return 0; | ||
180 | } | 156 | } |
181 | 157 | ||
182 | static unsigned int rtlx_poll(struct file *file, poll_table * wait) | 158 | static unsigned int rtlx_poll(struct file *file, poll_table * wait) |
@@ -199,12 +175,13 @@ static unsigned int rtlx_poll(struct file *file, poll_table * wait) | |||
199 | if (spacefree(chan->rt_read, chan->rt_write, chan->buffer_size)) | 175 | if (spacefree(chan->rt_read, chan->rt_write, chan->buffer_size)) |
200 | mask |= POLLOUT | POLLWRNORM; | 176 | mask |= POLLOUT | POLLWRNORM; |
201 | 177 | ||
202 | return (mask); | 178 | return mask; |
203 | } | 179 | } |
204 | 180 | ||
205 | static ssize_t rtlx_read(struct file *file, char __user * buffer, size_t count, | 181 | static ssize_t rtlx_read(struct file *file, char __user * buffer, size_t count, |
206 | loff_t * ppos) | 182 | loff_t * ppos) |
207 | { | 183 | { |
184 | unsigned long failed; | ||
208 | size_t fl = 0L; | 185 | size_t fl = 0L; |
209 | int minor; | 186 | int minor; |
210 | struct rtlx_channel *lx; | 187 | struct rtlx_channel *lx; |
@@ -216,7 +193,7 @@ static ssize_t rtlx_read(struct file *file, char __user * buffer, size_t count, | |||
216 | /* data available? */ | 193 | /* data available? */ |
217 | if (lx->lx_write == lx->lx_read) { | 194 | if (lx->lx_write == lx->lx_read) { |
218 | if (file->f_flags & O_NONBLOCK) | 195 | if (file->f_flags & O_NONBLOCK) |
219 | return (0); // -EAGAIN makes cat whinge | 196 | return 0; /* -EAGAIN makes cat whinge */ |
220 | 197 | ||
221 | /* go to sleep */ | 198 | /* go to sleep */ |
222 | add_wait_queue(&channel_wqs[minor].lx_queue, &wait); | 199 | add_wait_queue(&channel_wqs[minor].lx_queue, &wait); |
@@ -232,39 +209,39 @@ static ssize_t rtlx_read(struct file *file, char __user * buffer, size_t count, | |||
232 | } | 209 | } |
233 | 210 | ||
234 | /* find out how much in total */ | 211 | /* find out how much in total */ |
235 | count = min( count, | 212 | count = min(count, |
236 | (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read) % lx->buffer_size); | 213 | (size_t)(lx->lx_write + lx->buffer_size - lx->lx_read) % lx->buffer_size); |
237 | 214 | ||
238 | /* then how much from the read pointer onwards */ | 215 | /* then how much from the read pointer onwards */ |
239 | fl = min( count, (size_t)lx->buffer_size - lx->lx_read); | 216 | fl = min(count, (size_t)lx->buffer_size - lx->lx_read); |
240 | 217 | ||
241 | copy_to_user (buffer, &lx->lx_buffer[lx->lx_read], fl); | 218 | failed = copy_to_user (buffer, &lx->lx_buffer[lx->lx_read], fl); |
219 | if (failed) { | ||
220 | count = fl - failed; | ||
221 | goto out; | ||
222 | } | ||
242 | 223 | ||
243 | /* and if there is anything left at the beginning of the buffer */ | 224 | /* and if there is anything left at the beginning of the buffer */ |
244 | if ( count - fl ) | 225 | if (count - fl) { |
245 | copy_to_user (buffer + fl, lx->lx_buffer, count - fl); | 226 | failed = copy_to_user (buffer + fl, lx->lx_buffer, count - fl); |
227 | if (failed) { | ||
228 | count -= failed; | ||
229 | goto out; | ||
230 | } | ||
231 | } | ||
246 | 232 | ||
233 | out: | ||
247 | /* update the index */ | 234 | /* update the index */ |
248 | lx->lx_read += count; | 235 | lx->lx_read += count; |
249 | lx->lx_read %= lx->buffer_size; | 236 | lx->lx_read %= lx->buffer_size; |
250 | 237 | ||
251 | return (count); | 238 | return count; |
252 | } | ||
253 | |||
254 | static inline int spacefree(int read, int write, int size) | ||
255 | { | ||
256 | if (read == write) { | ||
257 | /* never fill the buffer completely, so indexes are always equal if empty | ||
258 | and only empty, or !equal if data available */ | ||
259 | return (size - 1); | ||
260 | } | ||
261 | |||
262 | return ((read + size - write) % size) - 1; | ||
263 | } | 239 | } |
264 | 240 | ||
265 | static ssize_t rtlx_write(struct file *file, const char __user * buffer, | 241 | static ssize_t rtlx_write(struct file *file, const char __user * buffer, |
266 | size_t count, loff_t * ppos) | 242 | size_t count, loff_t * ppos) |
267 | { | 243 | { |
244 | unsigned long failed; | ||
268 | int minor; | 245 | int minor; |
269 | struct rtlx_channel *rt; | 246 | struct rtlx_channel *rt; |
270 | size_t fl; | 247 | size_t fl; |
@@ -277,7 +254,7 @@ static ssize_t rtlx_write(struct file *file, const char __user * buffer, | |||
277 | if (!spacefree(rt->rt_read, rt->rt_write, rt->buffer_size)) { | 254 | if (!spacefree(rt->rt_read, rt->rt_write, rt->buffer_size)) { |
278 | 255 | ||
279 | if (file->f_flags & O_NONBLOCK) | 256 | if (file->f_flags & O_NONBLOCK) |
280 | return (-EAGAIN); | 257 | return -EAGAIN; |
281 | 258 | ||
282 | add_wait_queue(&channel_wqs[minor].rt_queue, &wait); | 259 | add_wait_queue(&channel_wqs[minor].rt_queue, &wait); |
283 | set_current_state(TASK_INTERRUPTIBLE); | 260 | set_current_state(TASK_INTERRUPTIBLE); |
@@ -290,52 +267,64 @@ static ssize_t rtlx_write(struct file *file, const char __user * buffer, | |||
290 | } | 267 | } |
291 | 268 | ||
292 | /* total number of bytes to copy */ | 269 | /* total number of bytes to copy */ |
293 | count = min( count, (size_t)spacefree(rt->rt_read, rt->rt_write, rt->buffer_size) ); | 270 | count = min(count, (size_t)spacefree(rt->rt_read, rt->rt_write, rt->buffer_size) ); |
294 | 271 | ||
295 | /* first bit from write pointer to the end of the buffer, or count */ | 272 | /* first bit from write pointer to the end of the buffer, or count */ |
296 | fl = min(count, (size_t) rt->buffer_size - rt->rt_write); | 273 | fl = min(count, (size_t) rt->buffer_size - rt->rt_write); |
297 | 274 | ||
298 | copy_from_user(&rt->rt_buffer[rt->rt_write], buffer, fl); | 275 | failed = copy_from_user(&rt->rt_buffer[rt->rt_write], buffer, fl); |
276 | if (failed) { | ||
277 | count = fl - failed; | ||
278 | goto out; | ||
279 | } | ||
299 | 280 | ||
300 | /* if there's any left copy to the beginning of the buffer */ | 281 | /* if there's any left copy to the beginning of the buffer */ |
301 | if( count - fl ) | 282 | if (count - fl) { |
302 | copy_from_user(rt->rt_buffer, buffer + fl, count - fl); | 283 | failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl); |
284 | if (failed) { | ||
285 | count -= failed; | ||
286 | goto out; | ||
287 | } | ||
288 | } | ||
303 | 289 | ||
290 | out: | ||
304 | rt->rt_write += count; | 291 | rt->rt_write += count; |
305 | rt->rt_write %= rt->buffer_size; | 292 | rt->rt_write %= rt->buffer_size; |
306 | 293 | ||
307 | return(count); | 294 | return count; |
308 | } | 295 | } |
309 | 296 | ||
310 | static struct file_operations rtlx_fops = { | 297 | static struct file_operations rtlx_fops = { |
311 | .owner = THIS_MODULE, | 298 | .owner = THIS_MODULE, |
312 | .open = rtlx_open, | 299 | .open = rtlx_open, |
313 | .release = rtlx_release, | 300 | .release = rtlx_release, |
314 | .write = rtlx_write, | 301 | .write = rtlx_write, |
315 | .read = rtlx_read, | 302 | .read = rtlx_read, |
316 | .poll = rtlx_poll | 303 | .poll = rtlx_poll |
317 | }; | 304 | }; |
318 | 305 | ||
319 | static int rtlx_module_init(void) | 306 | static char register_chrdev_failed[] __initdata = |
307 | KERN_ERR "rtlx_module_init: unable to register device\n"; | ||
308 | |||
309 | static int __init rtlx_module_init(void) | ||
320 | { | 310 | { |
321 | if ((major = register_chrdev(RTLX_MAJOR, module_name, &rtlx_fops)) < 0) { | 311 | major = register_chrdev(0, module_name, &rtlx_fops); |
322 | printk("rtlx_module_init: unable to register device\n"); | 312 | if (major < 0) { |
323 | return (-EBUSY); | 313 | printk(register_chrdev_failed); |
314 | return major; | ||
324 | } | 315 | } |
325 | 316 | ||
326 | if (major == 0) | 317 | return 0; |
327 | major = RTLX_MAJOR; | ||
328 | |||
329 | return (0); | ||
330 | } | 318 | } |
331 | 319 | ||
332 | static void rtlx_module_exit(void) | 320 | static void __exit rtlx_module_exit(void) |
333 | { | 321 | { |
334 | unregister_chrdev(major, module_name); | 322 | unregister_chrdev(major, module_name); |
335 | } | 323 | } |
336 | 324 | ||
337 | module_init(rtlx_module_init); | 325 | module_init(rtlx_module_init); |
338 | module_exit(rtlx_module_exit); | 326 | module_exit(rtlx_module_exit); |
327 | |||
339 | MODULE_DESCRIPTION("MIPS RTLX"); | 328 | MODULE_DESCRIPTION("MIPS RTLX"); |
340 | MODULE_AUTHOR("Elizabeth Clarke, MIPS Technologies, Inc"); | 329 | MODULE_AUTHOR("Elizabeth Clarke, MIPS Technologies, Inc."); |
341 | MODULE_LICENSE("GPL"); | 330 | MODULE_LICENSE("GPL"); |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 9202a17db8f7..05e09eedabff 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -384,9 +384,6 @@ give_sigsegv: | |||
384 | return 0; | 384 | return 0; |
385 | } | 385 | } |
386 | 386 | ||
387 | extern void setup_rt_frame_n32(struct k_sigaction * ka, | ||
388 | struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info); | ||
389 | |||
390 | static inline int handle_signal(unsigned long sig, siginfo_t *info, | 387 | static inline int handle_signal(unsigned long sig, siginfo_t *info, |
391 | struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) | 388 | struct k_sigaction *ka, sigset_t *oldset, struct pt_regs *regs) |
392 | { | 389 | { |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index dbe821303125..e315d3f6aa6e 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -647,8 +647,8 @@ static inline void *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
647 | return (void *)((sp - frame_size) & ALMASK); | 647 | return (void *)((sp - frame_size) & ALMASK); |
648 | } | 648 | } |
649 | 649 | ||
650 | void setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | 650 | int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, |
651 | int signr, sigset_t *set) | 651 | int signr, sigset_t *set) |
652 | { | 652 | { |
653 | struct sigframe *frame; | 653 | struct sigframe *frame; |
654 | int err = 0; | 654 | int err = 0; |
@@ -694,13 +694,15 @@ void setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs, | |||
694 | current->comm, current->pid, | 694 | current->comm, current->pid, |
695 | frame, regs->cp0_epc, frame->sf_code); | 695 | frame, regs->cp0_epc, frame->sf_code); |
696 | #endif | 696 | #endif |
697 | return; | 697 | return 1; |
698 | 698 | ||
699 | give_sigsegv: | 699 | give_sigsegv: |
700 | force_sigsegv(signr, current); | 700 | force_sigsegv(signr, current); |
701 | return 0; | ||
701 | } | 702 | } |
702 | 703 | ||
703 | void setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, int signr, sigset_t *set, siginfo_t *info) | 704 | int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, |
705 | int signr, sigset_t *set, siginfo_t *info) | ||
704 | { | 706 | { |
705 | struct rt_sigframe32 *frame; | 707 | struct rt_sigframe32 *frame; |
706 | int err = 0; | 708 | int err = 0; |
@@ -763,10 +765,11 @@ void setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, int signr, | |||
763 | current->comm, current->pid, | 765 | current->comm, current->pid, |
764 | frame, regs->cp0_epc, frame->rs_code); | 766 | frame, regs->cp0_epc, frame->rs_code); |
765 | #endif | 767 | #endif |
766 | return; | 768 | return 1; |
767 | 769 | ||
768 | give_sigsegv: | 770 | give_sigsegv: |
769 | force_sigsegv(signr, current); | 771 | force_sigsegv(signr, current); |
772 | return 0; | ||
770 | } | 773 | } |
771 | 774 | ||
772 | static inline int handle_signal(unsigned long sig, siginfo_t *info, | 775 | static inline int handle_signal(unsigned long sig, siginfo_t *info, |
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 97fefcc9dbe7..06be405be399 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -58,10 +58,6 @@ | |||
58 | 58 | ||
59 | typedef void *vpe_handle; | 59 | typedef void *vpe_handle; |
60 | 60 | ||
61 | // defined here because the kernel module loader doesn't have | ||
62 | // anything to do with it. | ||
63 | #define SHN_MIPS_SCOMMON 0xff03 | ||
64 | |||
65 | #ifndef ARCH_SHF_SMALL | 61 | #ifndef ARCH_SHF_SMALL |
66 | #define ARCH_SHF_SMALL 0 | 62 | #define ARCH_SHF_SMALL 0 |
67 | #endif | 63 | #endif |
@@ -69,11 +65,8 @@ typedef void *vpe_handle; | |||
69 | /* If this is set, the section belongs in the init part of the module */ | 65 | /* If this is set, the section belongs in the init part of the module */ |
70 | #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) | 66 | #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) |
71 | 67 | ||
72 | // temp number, | ||
73 | #define VPE_MAJOR 63 | ||
74 | |||
75 | static char module_name[] = "vpe"; | 68 | static char module_name[] = "vpe"; |
76 | static int major = 0; | 69 | static int major; |
77 | 70 | ||
78 | /* grab the likely amount of memory we will need. */ | 71 | /* grab the likely amount of memory we will need. */ |
79 | #ifdef CONFIG_MIPS_VPE_LOADER_TOM | 72 | #ifdef CONFIG_MIPS_VPE_LOADER_TOM |
@@ -98,22 +91,7 @@ enum tc_state { | |||
98 | TC_STATE_DYNAMIC | 91 | TC_STATE_DYNAMIC |
99 | }; | 92 | }; |
100 | 93 | ||
101 | struct vpe; | 94 | struct vpe { |
102 | typedef struct tc { | ||
103 | enum tc_state state; | ||
104 | int index; | ||
105 | |||
106 | /* parent VPE */ | ||
107 | struct vpe *pvpe; | ||
108 | |||
109 | /* The list of TC's with this VPE */ | ||
110 | struct list_head tc; | ||
111 | |||
112 | /* The global list of tc's */ | ||
113 | struct list_head list; | ||
114 | } tc_t; | ||
115 | |||
116 | typedef struct vpe { | ||
117 | enum vpe_state state; | 95 | enum vpe_state state; |
118 | 96 | ||
119 | /* (device) minor associated with this vpe */ | 97 | /* (device) minor associated with this vpe */ |
@@ -135,7 +113,21 @@ typedef struct vpe { | |||
135 | 113 | ||
136 | /* shared symbol address */ | 114 | /* shared symbol address */ |
137 | void *shared_ptr; | 115 | void *shared_ptr; |
138 | } vpe_t; | 116 | }; |
117 | |||
118 | struct tc { | ||
119 | enum tc_state state; | ||
120 | int index; | ||
121 | |||
122 | /* parent VPE */ | ||
123 | struct vpe *pvpe; | ||
124 | |||
125 | /* The list of TC's with this VPE */ | ||
126 | struct list_head tc; | ||
127 | |||
128 | /* The global list of tc's */ | ||
129 | struct list_head list; | ||
130 | }; | ||
139 | 131 | ||
140 | struct vpecontrol_ { | 132 | struct vpecontrol_ { |
141 | /* Virtual processing elements */ | 133 | /* Virtual processing elements */ |
@@ -146,7 +138,7 @@ struct vpecontrol_ { | |||
146 | } vpecontrol; | 138 | } vpecontrol; |
147 | 139 | ||
148 | static void release_progmem(void *ptr); | 140 | static void release_progmem(void *ptr); |
149 | static void dump_vpe(vpe_t * v); | 141 | static void dump_vpe(struct vpe * v); |
150 | extern void save_gp_address(unsigned int secbase, unsigned int rel); | 142 | extern void save_gp_address(unsigned int secbase, unsigned int rel); |
151 | 143 | ||
152 | /* get the vpe associated with this minor */ | 144 | /* get the vpe associated with this minor */ |
@@ -197,13 +189,11 @@ struct vpe *alloc_vpe(int minor) | |||
197 | { | 189 | { |
198 | struct vpe *v; | 190 | struct vpe *v; |
199 | 191 | ||
200 | if ((v = kmalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) { | 192 | if ((v = kzalloc(sizeof(struct vpe), GFP_KERNEL)) == NULL) { |
201 | printk(KERN_WARNING "VPE: alloc_vpe no mem\n"); | 193 | printk(KERN_WARNING "VPE: alloc_vpe no mem\n"); |
202 | return NULL; | 194 | return NULL; |
203 | } | 195 | } |
204 | 196 | ||
205 | memset(v, 0, sizeof(struct vpe)); | ||
206 | |||
207 | INIT_LIST_HEAD(&v->tc); | 197 | INIT_LIST_HEAD(&v->tc); |
208 | list_add_tail(&v->list, &vpecontrol.vpe_list); | 198 | list_add_tail(&v->list, &vpecontrol.vpe_list); |
209 | 199 | ||
@@ -216,13 +206,11 @@ struct tc *alloc_tc(int index) | |||
216 | { | 206 | { |
217 | struct tc *t; | 207 | struct tc *t; |
218 | 208 | ||
219 | if ((t = kmalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) { | 209 | if ((t = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) { |
220 | printk(KERN_WARNING "VPE: alloc_tc no mem\n"); | 210 | printk(KERN_WARNING "VPE: alloc_tc no mem\n"); |
221 | return NULL; | 211 | return NULL; |
222 | } | 212 | } |
223 | 213 | ||
224 | memset(t, 0, sizeof(struct tc)); | ||
225 | |||
226 | INIT_LIST_HEAD(&t->tc); | 214 | INIT_LIST_HEAD(&t->tc); |
227 | list_add_tail(&t->list, &vpecontrol.tc_list); | 215 | list_add_tail(&t->list, &vpecontrol.tc_list); |
228 | 216 | ||
@@ -412,16 +400,17 @@ static int apply_r_mips_26(struct module *me, uint32_t *location, | |||
412 | return -ENOEXEC; | 400 | return -ENOEXEC; |
413 | } | 401 | } |
414 | 402 | ||
415 | /* Not desperately convinced this is a good check of an overflow condition | 403 | /* |
416 | anyway. But it gets in the way of handling undefined weak symbols which | 404 | * Not desperately convinced this is a good check of an overflow condition |
417 | we want to set to zero. | 405 | * anyway. But it gets in the way of handling undefined weak symbols which |
418 | if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { | 406 | * we want to set to zero. |
419 | printk(KERN_ERR | 407 | * if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { |
420 | "module %s: relocation overflow\n", | 408 | * printk(KERN_ERR |
421 | me->name); | 409 | * "module %s: relocation overflow\n", |
422 | return -ENOEXEC; | 410 | * me->name); |
423 | } | 411 | * return -ENOEXEC; |
424 | */ | 412 | * } |
413 | */ | ||
425 | 414 | ||
426 | *location = (*location & ~0x03ffffff) | | 415 | *location = (*location & ~0x03ffffff) | |
427 | ((*location + (v >> 2)) & 0x03ffffff); | 416 | ((*location + (v >> 2)) & 0x03ffffff); |
@@ -681,7 +670,7 @@ static void dump_tclist(void) | |||
681 | } | 670 | } |
682 | 671 | ||
683 | /* We are prepared so configure and start the VPE... */ | 672 | /* We are prepared so configure and start the VPE... */ |
684 | int vpe_run(vpe_t * v) | 673 | int vpe_run(struct vpe * v) |
685 | { | 674 | { |
686 | unsigned long val; | 675 | unsigned long val; |
687 | struct tc *t; | 676 | struct tc *t; |
@@ -772,7 +761,7 @@ int vpe_run(vpe_t * v) | |||
772 | return 0; | 761 | return 0; |
773 | } | 762 | } |
774 | 763 | ||
775 | static unsigned long find_vpe_symbols(vpe_t * v, Elf_Shdr * sechdrs, | 764 | static unsigned long find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs, |
776 | unsigned int symindex, const char *strtab, | 765 | unsigned int symindex, const char *strtab, |
777 | struct module *mod) | 766 | struct module *mod) |
778 | { | 767 | { |
@@ -792,10 +781,12 @@ static unsigned long find_vpe_symbols(vpe_t * v, Elf_Shdr * sechdrs, | |||
792 | return 0; | 781 | return 0; |
793 | } | 782 | } |
794 | 783 | ||
795 | /* Allocates a VPE with some program code space(the load address), copies the contents | 784 | /* |
796 | of the program (p)buffer performing relocatations/etc, free's it when finished. | 785 | * Allocates a VPE with some program code space(the load address), copies |
786 | * the contents of the program (p)buffer performing relocatations/etc, | ||
787 | * free's it when finished. | ||
797 | */ | 788 | */ |
798 | int vpe_elfload(vpe_t * v) | 789 | int vpe_elfload(struct vpe * v) |
799 | { | 790 | { |
800 | Elf_Ehdr *hdr; | 791 | Elf_Ehdr *hdr; |
801 | Elf_Shdr *sechdrs; | 792 | Elf_Shdr *sechdrs; |
@@ -931,7 +922,7 @@ cleanup: | |||
931 | return err; | 922 | return err; |
932 | } | 923 | } |
933 | 924 | ||
934 | static void dump_vpe(vpe_t * v) | 925 | static void dump_vpe(struct vpe * v) |
935 | { | 926 | { |
936 | struct tc *t; | 927 | struct tc *t; |
937 | 928 | ||
@@ -947,7 +938,7 @@ static void dump_vpe(vpe_t * v) | |||
947 | static int vpe_open(struct inode *inode, struct file *filp) | 938 | static int vpe_open(struct inode *inode, struct file *filp) |
948 | { | 939 | { |
949 | int minor; | 940 | int minor; |
950 | vpe_t *v; | 941 | struct vpe *v; |
951 | 942 | ||
952 | /* assume only 1 device at the mo. */ | 943 | /* assume only 1 device at the mo. */ |
953 | if ((minor = MINOR(inode->i_rdev)) != 1) { | 944 | if ((minor = MINOR(inode->i_rdev)) != 1) { |
@@ -1001,7 +992,7 @@ static int vpe_open(struct inode *inode, struct file *filp) | |||
1001 | static int vpe_release(struct inode *inode, struct file *filp) | 992 | static int vpe_release(struct inode *inode, struct file *filp) |
1002 | { | 993 | { |
1003 | int minor, ret = 0; | 994 | int minor, ret = 0; |
1004 | vpe_t *v; | 995 | struct vpe *v; |
1005 | Elf_Ehdr *hdr; | 996 | Elf_Ehdr *hdr; |
1006 | 997 | ||
1007 | minor = MINOR(inode->i_rdev); | 998 | minor = MINOR(inode->i_rdev); |
@@ -1035,7 +1026,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, | |||
1035 | { | 1026 | { |
1036 | int minor; | 1027 | int minor; |
1037 | size_t ret = count; | 1028 | size_t ret = count; |
1038 | vpe_t *v; | 1029 | struct vpe *v; |
1039 | 1030 | ||
1040 | minor = MINOR(file->f_dentry->d_inode->i_rdev); | 1031 | minor = MINOR(file->f_dentry->d_inode->i_rdev); |
1041 | if ((v = get_vpe(minor)) == NULL) | 1032 | if ((v = get_vpe(minor)) == NULL) |
@@ -1180,14 +1171,11 @@ static int __init vpe_module_init(void) | |||
1180 | return -ENODEV; | 1171 | return -ENODEV; |
1181 | } | 1172 | } |
1182 | 1173 | ||
1183 | if ((major = register_chrdev(VPE_MAJOR, module_name, &vpe_fops) < 0)) { | 1174 | if ((major = register_chrdev(0, module_name, &vpe_fops) < 0)) { |
1184 | printk("VPE loader: unable to register character device\n"); | 1175 | printk("VPE loader: unable to register character device\n"); |
1185 | return -EBUSY; | 1176 | return major; |
1186 | } | 1177 | } |
1187 | 1178 | ||
1188 | if (major == 0) | ||
1189 | major = VPE_MAJOR; | ||
1190 | |||
1191 | dmt(); | 1179 | dmt(); |
1192 | dvpe(); | 1180 | dvpe(); |
1193 | 1181 | ||
diff --git a/arch/mips/lasat/ds1603.c b/arch/mips/lasat/ds1603.c index 9d7812e03dcd..7dced67c55eb 100644 --- a/arch/mips/lasat/ds1603.c +++ b/arch/mips/lasat/ds1603.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <asm/lasat/lasat.h> | 8 | #include <asm/lasat/lasat.h> |
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | #include <asm/lasat/ds1603.h> | 10 | #include <asm/lasat/ds1603.h> |
11 | #include <asm/time.h> | ||
11 | 12 | ||
12 | #include "ds1603.h" | 13 | #include "ds1603.h" |
13 | 14 | ||
@@ -138,19 +139,27 @@ static void rtc_end_op(void) | |||
138 | unsigned long ds1603_read(void) | 139 | unsigned long ds1603_read(void) |
139 | { | 140 | { |
140 | unsigned long word; | 141 | unsigned long word; |
142 | unsigned long flags; | ||
143 | |||
144 | spin_lock_irqsave(&rtc_lock, flags); | ||
141 | rtc_init_op(); | 145 | rtc_init_op(); |
142 | rtc_write_byte(READ_TIME_CMD); | 146 | rtc_write_byte(READ_TIME_CMD); |
143 | word = rtc_read_word(); | 147 | word = rtc_read_word(); |
144 | rtc_end_op(); | 148 | rtc_end_op(); |
149 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
145 | return word; | 150 | return word; |
146 | } | 151 | } |
147 | 152 | ||
148 | int ds1603_set(unsigned long time) | 153 | int ds1603_set(unsigned long time) |
149 | { | 154 | { |
155 | unsigned long flags; | ||
156 | |||
157 | spin_lock_irqsave(&rtc_lock, flags); | ||
150 | rtc_init_op(); | 158 | rtc_init_op(); |
151 | rtc_write_byte(SET_TIME_CMD); | 159 | rtc_write_byte(SET_TIME_CMD); |
152 | rtc_write_word(time); | 160 | rtc_write_word(time); |
153 | rtc_end_op(); | 161 | rtc_end_op(); |
162 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
154 | 163 | ||
155 | return 0; | 164 | return 0; |
156 | } | 165 | } |
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c index 768bf4406452..bab192ddc185 100644 --- a/arch/mips/momentum/jaguar_atx/setup.c +++ b/arch/mips/momentum/jaguar_atx/setup.c | |||
@@ -149,7 +149,9 @@ arch_initcall(per_cpu_mappings); | |||
149 | unsigned long m48t37y_get_time(void) | 149 | unsigned long m48t37y_get_time(void) |
150 | { | 150 | { |
151 | unsigned int year, month, day, hour, min, sec; | 151 | unsigned int year, month, day, hour, min, sec; |
152 | unsigned long flags; | ||
152 | 153 | ||
154 | spin_lock_irqsave(&rtc_lock, flags); | ||
153 | /* stop the update */ | 155 | /* stop the update */ |
154 | rtc_base[0x7ff8] = 0x40; | 156 | rtc_base[0x7ff8] = 0x40; |
155 | 157 | ||
@@ -166,6 +168,7 @@ unsigned long m48t37y_get_time(void) | |||
166 | 168 | ||
167 | /* start the update */ | 169 | /* start the update */ |
168 | rtc_base[0x7ff8] = 0x00; | 170 | rtc_base[0x7ff8] = 0x00; |
171 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
169 | 172 | ||
170 | return mktime(year, month, day, hour, min, sec); | 173 | return mktime(year, month, day, hour, min, sec); |
171 | } | 174 | } |
@@ -173,11 +176,13 @@ unsigned long m48t37y_get_time(void) | |||
173 | int m48t37y_set_time(unsigned long sec) | 176 | int m48t37y_set_time(unsigned long sec) |
174 | { | 177 | { |
175 | struct rtc_time tm; | 178 | struct rtc_time tm; |
179 | unsigned long flags; | ||
176 | 180 | ||
177 | /* convert to a more useful format -- note months count from 0 */ | 181 | /* convert to a more useful format -- note months count from 0 */ |
178 | to_tm(sec, &tm); | 182 | to_tm(sec, &tm); |
179 | tm.tm_mon += 1; | 183 | tm.tm_mon += 1; |
180 | 184 | ||
185 | spin_lock_irqsave(&rtc_lock, flags); | ||
181 | /* enable writing */ | 186 | /* enable writing */ |
182 | rtc_base[0x7ff8] = 0x80; | 187 | rtc_base[0x7ff8] = 0x80; |
183 | 188 | ||
@@ -201,6 +206,7 @@ int m48t37y_set_time(unsigned long sec) | |||
201 | 206 | ||
202 | /* disable writing */ | 207 | /* disable writing */ |
203 | rtc_base[0x7ff8] = 0x00; | 208 | rtc_base[0x7ff8] = 0x00; |
209 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
204 | 210 | ||
205 | return 0; | 211 | return 0; |
206 | } | 212 | } |
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c index a7803e08f9db..c9b7ff8148ec 100644 --- a/arch/mips/momentum/ocelot_3/setup.c +++ b/arch/mips/momentum/ocelot_3/setup.c | |||
@@ -135,7 +135,9 @@ void setup_wired_tlb_entries(void) | |||
135 | unsigned long m48t37y_get_time(void) | 135 | unsigned long m48t37y_get_time(void) |
136 | { | 136 | { |
137 | unsigned int year, month, day, hour, min, sec; | 137 | unsigned int year, month, day, hour, min, sec; |
138 | unsigned long flags; | ||
138 | 139 | ||
140 | spin_lock_irqsave(&rtc_lock, flags); | ||
139 | /* stop the update */ | 141 | /* stop the update */ |
140 | rtc_base[0x7ff8] = 0x40; | 142 | rtc_base[0x7ff8] = 0x40; |
141 | 143 | ||
@@ -152,6 +154,7 @@ unsigned long m48t37y_get_time(void) | |||
152 | 154 | ||
153 | /* start the update */ | 155 | /* start the update */ |
154 | rtc_base[0x7ff8] = 0x00; | 156 | rtc_base[0x7ff8] = 0x00; |
157 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
155 | 158 | ||
156 | return mktime(year, month, day, hour, min, sec); | 159 | return mktime(year, month, day, hour, min, sec); |
157 | } | 160 | } |
@@ -159,11 +162,13 @@ unsigned long m48t37y_get_time(void) | |||
159 | int m48t37y_set_time(unsigned long sec) | 162 | int m48t37y_set_time(unsigned long sec) |
160 | { | 163 | { |
161 | struct rtc_time tm; | 164 | struct rtc_time tm; |
165 | unsigned long flags; | ||
162 | 166 | ||
163 | /* convert to a more useful format -- note months count from 0 */ | 167 | /* convert to a more useful format -- note months count from 0 */ |
164 | to_tm(sec, &tm); | 168 | to_tm(sec, &tm); |
165 | tm.tm_mon += 1; | 169 | tm.tm_mon += 1; |
166 | 170 | ||
171 | spin_lock_irqsave(&rtc_lock, flags); | ||
167 | /* enable writing */ | 172 | /* enable writing */ |
168 | rtc_base[0x7ff8] = 0x80; | 173 | rtc_base[0x7ff8] = 0x80; |
169 | 174 | ||
@@ -187,6 +192,7 @@ int m48t37y_set_time(unsigned long sec) | |||
187 | 192 | ||
188 | /* disable writing */ | 193 | /* disable writing */ |
189 | rtc_base[0x7ff8] = 0x00; | 194 | rtc_base[0x7ff8] = 0x00; |
195 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
190 | 196 | ||
191 | return 0; | 197 | return 0; |
192 | } | 198 | } |
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c index ce70fc96f160..2755c1547473 100644 --- a/arch/mips/momentum/ocelot_c/setup.c +++ b/arch/mips/momentum/ocelot_c/setup.c | |||
@@ -140,7 +140,9 @@ unsigned long m48t37y_get_time(void) | |||
140 | unsigned char* rtc_base = (unsigned char*)0xfc800000; | 140 | unsigned char* rtc_base = (unsigned char*)0xfc800000; |
141 | #endif | 141 | #endif |
142 | unsigned int year, month, day, hour, min, sec; | 142 | unsigned int year, month, day, hour, min, sec; |
143 | unsigned long flags; | ||
143 | 144 | ||
145 | spin_lock_irqsave(&rtc_lock, flags); | ||
144 | /* stop the update */ | 146 | /* stop the update */ |
145 | rtc_base[0x7ff8] = 0x40; | 147 | rtc_base[0x7ff8] = 0x40; |
146 | 148 | ||
@@ -157,6 +159,7 @@ unsigned long m48t37y_get_time(void) | |||
157 | 159 | ||
158 | /* start the update */ | 160 | /* start the update */ |
159 | rtc_base[0x7ff8] = 0x00; | 161 | rtc_base[0x7ff8] = 0x00; |
162 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
160 | 163 | ||
161 | return mktime(year, month, day, hour, min, sec); | 164 | return mktime(year, month, day, hour, min, sec); |
162 | } | 165 | } |
@@ -169,11 +172,13 @@ int m48t37y_set_time(unsigned long sec) | |||
169 | unsigned char* rtc_base = (unsigned char*)0xfc800000; | 172 | unsigned char* rtc_base = (unsigned char*)0xfc800000; |
170 | #endif | 173 | #endif |
171 | struct rtc_time tm; | 174 | struct rtc_time tm; |
175 | unsigned long flags; | ||
172 | 176 | ||
173 | /* convert to a more useful format -- note months count from 0 */ | 177 | /* convert to a more useful format -- note months count from 0 */ |
174 | to_tm(sec, &tm); | 178 | to_tm(sec, &tm); |
175 | tm.tm_mon += 1; | 179 | tm.tm_mon += 1; |
176 | 180 | ||
181 | spin_lock_irqsave(&rtc_lock, flags); | ||
177 | /* enable writing */ | 182 | /* enable writing */ |
178 | rtc_base[0x7ff8] = 0x80; | 183 | rtc_base[0x7ff8] = 0x80; |
179 | 184 | ||
@@ -197,6 +202,7 @@ int m48t37y_set_time(unsigned long sec) | |||
197 | 202 | ||
198 | /* disable writing */ | 203 | /* disable writing */ |
199 | rtc_base[0x7ff8] = 0x00; | 204 | rtc_base[0x7ff8] = 0x00; |
205 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
200 | 206 | ||
201 | return 0; | 207 | return 0; |
202 | } | 208 | } |
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c index bdc2ab55bed6..059755b5ed57 100644 --- a/arch/mips/pmc-sierra/yosemite/setup.c +++ b/arch/mips/pmc-sierra/yosemite/setup.c | |||
@@ -73,7 +73,9 @@ void __init bus_error_init(void) | |||
73 | unsigned long m48t37y_get_time(void) | 73 | unsigned long m48t37y_get_time(void) |
74 | { | 74 | { |
75 | unsigned int year, month, day, hour, min, sec; | 75 | unsigned int year, month, day, hour, min, sec; |
76 | unsigned long flags; | ||
76 | 77 | ||
78 | spin_lock_irqsave(&rtc_lock, flags); | ||
77 | /* Stop the update to the time */ | 79 | /* Stop the update to the time */ |
78 | m48t37_base->control = 0x40; | 80 | m48t37_base->control = 0x40; |
79 | 81 | ||
@@ -88,6 +90,7 @@ unsigned long m48t37y_get_time(void) | |||
88 | 90 | ||
89 | /* Start the update to the time again */ | 91 | /* Start the update to the time again */ |
90 | m48t37_base->control = 0x00; | 92 | m48t37_base->control = 0x00; |
93 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
91 | 94 | ||
92 | return mktime(year, month, day, hour, min, sec); | 95 | return mktime(year, month, day, hour, min, sec); |
93 | } | 96 | } |
@@ -95,11 +98,13 @@ unsigned long m48t37y_get_time(void) | |||
95 | int m48t37y_set_time(unsigned long sec) | 98 | int m48t37y_set_time(unsigned long sec) |
96 | { | 99 | { |
97 | struct rtc_time tm; | 100 | struct rtc_time tm; |
101 | unsigned long flags; | ||
98 | 102 | ||
99 | /* convert to a more useful format -- note months count from 0 */ | 103 | /* convert to a more useful format -- note months count from 0 */ |
100 | to_tm(sec, &tm); | 104 | to_tm(sec, &tm); |
101 | tm.tm_mon += 1; | 105 | tm.tm_mon += 1; |
102 | 106 | ||
107 | spin_lock_irqsave(&rtc_lock, flags); | ||
103 | /* enable writing */ | 108 | /* enable writing */ |
104 | m48t37_base->control = 0x80; | 109 | m48t37_base->control = 0x80; |
105 | 110 | ||
@@ -123,6 +128,7 @@ int m48t37y_set_time(unsigned long sec) | |||
123 | 128 | ||
124 | /* disable writing */ | 129 | /* disable writing */ |
125 | m48t37_base->control = 0x00; | 130 | m48t37_base->control = 0x00; |
131 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
126 | 132 | ||
127 | return 0; | 133 | return 0; |
128 | } | 134 | } |
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c index df9b5694328a..b7300cc5c5ad 100644 --- a/arch/mips/sgi-ip22/ip22-time.c +++ b/arch/mips/sgi-ip22/ip22-time.c | |||
@@ -35,7 +35,9 @@ static unsigned long indy_rtc_get_time(void) | |||
35 | { | 35 | { |
36 | unsigned int yrs, mon, day, hrs, min, sec; | 36 | unsigned int yrs, mon, day, hrs, min, sec; |
37 | unsigned int save_control; | 37 | unsigned int save_control; |
38 | unsigned long flags; | ||
38 | 39 | ||
40 | spin_lock_irqsave(&rtc_lock, flags); | ||
39 | save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff; | 41 | save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff; |
40 | hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE; | 42 | hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE; |
41 | 43 | ||
@@ -47,6 +49,7 @@ static unsigned long indy_rtc_get_time(void) | |||
47 | yrs = BCD2BIN(hpc3c0->rtcregs[RTC_YEAR] & 0xff); | 49 | yrs = BCD2BIN(hpc3c0->rtcregs[RTC_YEAR] & 0xff); |
48 | 50 | ||
49 | hpc3c0->rtcregs[RTC_CMD] = save_control; | 51 | hpc3c0->rtcregs[RTC_CMD] = save_control; |
52 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
50 | 53 | ||
51 | if (yrs < 45) | 54 | if (yrs < 45) |
52 | yrs += 30; | 55 | yrs += 30; |
@@ -60,6 +63,7 @@ static int indy_rtc_set_time(unsigned long tim) | |||
60 | { | 63 | { |
61 | struct rtc_time tm; | 64 | struct rtc_time tm; |
62 | unsigned int save_control; | 65 | unsigned int save_control; |
66 | unsigned long flags; | ||
63 | 67 | ||
64 | to_tm(tim, &tm); | 68 | to_tm(tim, &tm); |
65 | 69 | ||
@@ -68,6 +72,7 @@ static int indy_rtc_set_time(unsigned long tim) | |||
68 | if (tm.tm_year >= 100) | 72 | if (tm.tm_year >= 100) |
69 | tm.tm_year -= 100; | 73 | tm.tm_year -= 100; |
70 | 74 | ||
75 | spin_lock_irqsave(&rtc_lock, flags); | ||
71 | save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff; | 76 | save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff; |
72 | hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE; | 77 | hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE; |
73 | 78 | ||
@@ -80,6 +85,7 @@ static int indy_rtc_set_time(unsigned long tim) | |||
80 | hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0; | 85 | hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0; |
81 | 86 | ||
82 | hpc3c0->rtcregs[RTC_CMD] = save_control; | 87 | hpc3c0->rtcregs[RTC_CMD] = save_control; |
88 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
83 | 89 | ||
84 | return 0; | 90 | return 0; |
85 | } | 91 | } |
diff --git a/arch/mips/sibyte/swarm/rtc_m41t81.c b/arch/mips/sibyte/swarm/rtc_m41t81.c index 5b4fc26c1b36..c13914bdda59 100644 --- a/arch/mips/sibyte/swarm/rtc_m41t81.c +++ b/arch/mips/sibyte/swarm/rtc_m41t81.c | |||
@@ -144,6 +144,7 @@ static int m41t81_write(uint8_t addr, int b) | |||
144 | int m41t81_set_time(unsigned long t) | 144 | int m41t81_set_time(unsigned long t) |
145 | { | 145 | { |
146 | struct rtc_time tm; | 146 | struct rtc_time tm; |
147 | unsigned long flags; | ||
147 | 148 | ||
148 | to_tm(t, &tm); | 149 | to_tm(t, &tm); |
149 | 150 | ||
@@ -153,6 +154,7 @@ int m41t81_set_time(unsigned long t) | |||
153 | * believe we should finish writing min within a second. | 154 | * believe we should finish writing min within a second. |
154 | */ | 155 | */ |
155 | 156 | ||
157 | spin_lock_irqsave(&rtc_lock, flags); | ||
156 | tm.tm_sec = BIN2BCD(tm.tm_sec); | 158 | tm.tm_sec = BIN2BCD(tm.tm_sec); |
157 | m41t81_write(M41T81REG_SC, tm.tm_sec); | 159 | m41t81_write(M41T81REG_SC, tm.tm_sec); |
158 | 160 | ||
@@ -180,6 +182,7 @@ int m41t81_set_time(unsigned long t) | |||
180 | tm.tm_year %= 100; | 182 | tm.tm_year %= 100; |
181 | tm.tm_year = BIN2BCD(tm.tm_year); | 183 | tm.tm_year = BIN2BCD(tm.tm_year); |
182 | m41t81_write(M41T81REG_YR, tm.tm_year); | 184 | m41t81_write(M41T81REG_YR, tm.tm_year); |
185 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
183 | 186 | ||
184 | return 0; | 187 | return 0; |
185 | } | 188 | } |
@@ -187,19 +190,23 @@ int m41t81_set_time(unsigned long t) | |||
187 | unsigned long m41t81_get_time(void) | 190 | unsigned long m41t81_get_time(void) |
188 | { | 191 | { |
189 | unsigned int year, mon, day, hour, min, sec; | 192 | unsigned int year, mon, day, hour, min, sec; |
193 | unsigned long flags; | ||
190 | 194 | ||
191 | /* | 195 | /* |
192 | * min is valid if two reads of sec are the same. | 196 | * min is valid if two reads of sec are the same. |
193 | */ | 197 | */ |
194 | for (;;) { | 198 | for (;;) { |
199 | spin_lock_irqsave(&rtc_lock, flags); | ||
195 | sec = m41t81_read(M41T81REG_SC); | 200 | sec = m41t81_read(M41T81REG_SC); |
196 | min = m41t81_read(M41T81REG_MN); | 201 | min = m41t81_read(M41T81REG_MN); |
197 | if (sec == m41t81_read(M41T81REG_SC)) break; | 202 | if (sec == m41t81_read(M41T81REG_SC)) break; |
203 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
198 | } | 204 | } |
199 | hour = m41t81_read(M41T81REG_HR) & 0x3f; | 205 | hour = m41t81_read(M41T81REG_HR) & 0x3f; |
200 | day = m41t81_read(M41T81REG_DT); | 206 | day = m41t81_read(M41T81REG_DT); |
201 | mon = m41t81_read(M41T81REG_MO); | 207 | mon = m41t81_read(M41T81REG_MO); |
202 | year = m41t81_read(M41T81REG_YR); | 208 | year = m41t81_read(M41T81REG_YR); |
209 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
203 | 210 | ||
204 | sec = BCD2BIN(sec); | 211 | sec = BCD2BIN(sec); |
205 | min = BCD2BIN(min); | 212 | min = BCD2BIN(min); |
diff --git a/arch/mips/sibyte/swarm/rtc_xicor1241.c b/arch/mips/sibyte/swarm/rtc_xicor1241.c index d9ff9323f24e..f4a178836415 100644 --- a/arch/mips/sibyte/swarm/rtc_xicor1241.c +++ b/arch/mips/sibyte/swarm/rtc_xicor1241.c | |||
@@ -113,9 +113,11 @@ int xicor_set_time(unsigned long t) | |||
113 | { | 113 | { |
114 | struct rtc_time tm; | 114 | struct rtc_time tm; |
115 | int tmp; | 115 | int tmp; |
116 | unsigned long flags; | ||
116 | 117 | ||
117 | to_tm(t, &tm); | 118 | to_tm(t, &tm); |
118 | 119 | ||
120 | spin_lock_irqsave(&rtc_lock, flags); | ||
119 | /* unlock writes to the CCR */ | 121 | /* unlock writes to the CCR */ |
120 | xicor_write(X1241REG_SR, X1241REG_SR_WEL); | 122 | xicor_write(X1241REG_SR, X1241REG_SR_WEL); |
121 | xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL); | 123 | xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL); |
@@ -160,6 +162,7 @@ int xicor_set_time(unsigned long t) | |||
160 | xicor_write(X1241REG_HR, tmp); | 162 | xicor_write(X1241REG_HR, tmp); |
161 | 163 | ||
162 | xicor_write(X1241REG_SR, 0); | 164 | xicor_write(X1241REG_SR, 0); |
165 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
163 | 166 | ||
164 | return 0; | 167 | return 0; |
165 | } | 168 | } |
@@ -167,7 +170,9 @@ int xicor_set_time(unsigned long t) | |||
167 | unsigned long xicor_get_time(void) | 170 | unsigned long xicor_get_time(void) |
168 | { | 171 | { |
169 | unsigned int year, mon, day, hour, min, sec, y2k; | 172 | unsigned int year, mon, day, hour, min, sec, y2k; |
173 | unsigned long flags; | ||
170 | 174 | ||
175 | spin_lock_irqsave(&rtc_lock, flags); | ||
171 | sec = xicor_read(X1241REG_SC); | 176 | sec = xicor_read(X1241REG_SC); |
172 | min = xicor_read(X1241REG_MN); | 177 | min = xicor_read(X1241REG_MN); |
173 | hour = xicor_read(X1241REG_HR); | 178 | hour = xicor_read(X1241REG_HR); |
@@ -183,6 +188,7 @@ unsigned long xicor_get_time(void) | |||
183 | mon = xicor_read(X1241REG_MO); | 188 | mon = xicor_read(X1241REG_MO); |
184 | year = xicor_read(X1241REG_YR); | 189 | year = xicor_read(X1241REG_YR); |
185 | y2k = xicor_read(X1241REG_Y2K); | 190 | y2k = xicor_read(X1241REG_Y2K); |
191 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
186 | 192 | ||
187 | sec = BCD2BIN(sec); | 193 | sec = BCD2BIN(sec); |
188 | min = BCD2BIN(min); | 194 | min = BCD2BIN(min); |