aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/sparc64/kernel/irq.c7
-rw-r--r--arch/sparc64/kernel/of_device.c29
-rw-r--r--arch/sparc64/kernel/pci.c2
-rw-r--r--arch/sparc64/kernel/pci_psycho.c14
-rw-r--r--arch/sparc64/kernel/prom.c104
-rw-r--r--arch/sparc64/kernel/ptrace.c8
-rw-r--r--arch/sparc64/kernel/smp.c14
-rw-r--r--arch/sparc64/kernel/traps.c3
-rw-r--r--arch/sparc64/mm/init.c32
10 files changed, 74 insertions, 140 deletions
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 923a98959fa..36b4b7ab9cf 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -231,6 +231,7 @@ endmenu
231 231
232config NUMA 232config NUMA
233 bool "NUMA support" 233 bool "NUMA support"
234 depends on SMP
234 235
235config NODES_SHIFT 236config NODES_SHIFT
236 int 237 int
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 9b6689d9d57..7495bc77468 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/linkage.h>
10#include <linux/ptrace.h> 11#include <linux/ptrace.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
12#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
@@ -792,6 +793,8 @@ void fixup_irqs(void)
792 } 793 }
793 spin_unlock_irqrestore(&irq_desc[irq].lock, flags); 794 spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
794 } 795 }
796
797 tick_ops->disable_irq();
795} 798}
796#endif 799#endif
797 800
@@ -864,7 +867,7 @@ static void kill_prom_timer(void)
864 : "g1", "g2"); 867 : "g1", "g2");
865} 868}
866 869
867void init_irqwork_curcpu(void) 870void notrace init_irqwork_curcpu(void)
868{ 871{
869 int cpu = hard_smp_processor_id(); 872 int cpu = hard_smp_processor_id();
870 873
@@ -895,7 +898,7 @@ static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type
895 } 898 }
896} 899}
897 900
898void __cpuinit sun4v_register_mondo_queues(int this_cpu) 901void __cpuinit notrace sun4v_register_mondo_queues(int this_cpu)
899{ 902{
900 struct trap_per_cpu *tb = &trap_block[this_cpu]; 903 struct trap_per_cpu *tb = &trap_block[this_cpu];
901 904
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f8b50cbf4bf..100ebd52749 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -96,7 +96,7 @@ struct of_bus {
96 int *addrc, int *sizec); 96 int *addrc, int *sizec);
97 int (*map)(u32 *addr, const u32 *range, 97 int (*map)(u32 *addr, const u32 *range,
98 int na, int ns, int pna); 98 int na, int ns, int pna);
99 unsigned int (*get_flags)(const u32 *addr); 99 unsigned long (*get_flags)(const u32 *addr, unsigned long);
100}; 100};
101 101
102/* 102/*
@@ -156,8 +156,10 @@ static int of_bus_default_map(u32 *addr, const u32 *range,
156 return 0; 156 return 0;
157} 157}
158 158
159static unsigned int of_bus_default_get_flags(const u32 *addr) 159static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long flags)
160{ 160{
161 if (flags)
162 return flags;
161 return IORESOURCE_MEM; 163 return IORESOURCE_MEM;
162} 164}
163 165
@@ -167,7 +169,7 @@ static unsigned int of_bus_default_get_flags(const u32 *addr)
167 169
168static int of_bus_pci_match(struct device_node *np) 170static int of_bus_pci_match(struct device_node *np)
169{ 171{
170 if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 172 if (!strcmp(np->name, "pci")) {
171 const char *model = of_get_property(np, "model", NULL); 173 const char *model = of_get_property(np, "model", NULL);
172 174
173 if (model && !strcmp(model, "SUNW,simba")) 175 if (model && !strcmp(model, "SUNW,simba"))
@@ -198,7 +200,7 @@ static int of_bus_simba_match(struct device_node *np)
198 /* Treat PCI busses lacking ranges property just like 200 /* Treat PCI busses lacking ranges property just like
199 * simba. 201 * simba.
200 */ 202 */
201 if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 203 if (!strcmp(np->name, "pci")) {
202 if (!of_find_property(np, "ranges", NULL)) 204 if (!of_find_property(np, "ranges", NULL))
203 return 1; 205 return 1;
204 } 206 }
@@ -249,17 +251,21 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
249 return 0; 251 return 0;
250} 252}
251 253
252static unsigned int of_bus_pci_get_flags(const u32 *addr) 254static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
253{ 255{
254 unsigned int flags = 0;
255 u32 w = addr[0]; 256 u32 w = addr[0];
256 257
258 /* For PCI, we override whatever child busses may have used. */
259 flags = 0;
257 switch((w >> 24) & 0x03) { 260 switch((w >> 24) & 0x03) {
258 case 0x01: 261 case 0x01:
259 flags |= IORESOURCE_IO; 262 flags |= IORESOURCE_IO;
263 break;
264
260 case 0x02: /* 32 bits */ 265 case 0x02: /* 32 bits */
261 case 0x03: /* 64 bits */ 266 case 0x03: /* 64 bits */
262 flags |= IORESOURCE_MEM; 267 flags |= IORESOURCE_MEM;
268 break;
263 } 269 }
264 if (w & 0x40000000) 270 if (w & 0x40000000)
265 flags |= IORESOURCE_PREFETCH; 271 flags |= IORESOURCE_PREFETCH;
@@ -423,7 +429,7 @@ static int __init use_1to1_mapping(struct device_node *pp)
423 * it lacks a ranges property, and this will include 429 * it lacks a ranges property, and this will include
424 * cases like Simba. 430 * cases like Simba.
425 */ 431 */
426 if (!strcmp(pp->type, "pci") || !strcmp(pp->type, "pciex")) 432 if (!strcmp(pp->name, "pci"))
427 return 0; 433 return 0;
428 434
429 return 1; 435 return 1;
@@ -478,10 +484,10 @@ static void __init build_device_resources(struct of_device *op,
478 int pna, pns; 484 int pna, pns;
479 485
480 size = of_read_addr(reg + na, ns); 486 size = of_read_addr(reg + na, ns);
481 flags = bus->get_flags(reg);
482
483 memcpy(addr, reg, na * 4); 487 memcpy(addr, reg, na * 4);
484 488
489 flags = bus->get_flags(addr, 0);
490
485 if (use_1to1_mapping(pp)) { 491 if (use_1to1_mapping(pp)) {
486 result = of_read_addr(addr, na); 492 result = of_read_addr(addr, na);
487 goto build_res; 493 goto build_res;
@@ -506,6 +512,8 @@ static void __init build_device_resources(struct of_device *op,
506 dna, dns, pna)) 512 dna, dns, pna))
507 break; 513 break;
508 514
515 flags = pbus->get_flags(addr, flags);
516
509 dna = pna; 517 dna = pna;
510 dns = pns; 518 dns = pns;
511 dbus = pbus; 519 dbus = pbus;
@@ -706,8 +714,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
706 break; 714 break;
707 } 715 }
708 } else { 716 } else {
709 if (!strcmp(pp->type, "pci") || 717 if (!strcmp(pp->name, "pci")) {
710 !strcmp(pp->type, "pciex")) {
711 unsigned int this_orig_irq = irq; 718 unsigned int this_orig_irq = irq;
712 719
713 irq = pci_irq_swizzle(dp, pp, irq); 720 irq = pci_irq_swizzle(dp, pp, irq);
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 55096195458..80dad76f8b8 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -425,7 +425,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
425 dev->current_state = 4; /* unknown power state */ 425 dev->current_state = 4; /* unknown power state */
426 dev->error_state = pci_channel_io_normal; 426 dev->error_state = pci_channel_io_normal;
427 427
428 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 428 if (!strcmp(node->name, "pci")) {
429 /* a PCI-PCI bridge */ 429 /* a PCI-PCI bridge */
430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
431 dev->rom_base_reg = PCI_ROM_ADDRESS1; 431 dev->rom_base_reg = PCI_ROM_ADDRESS1;
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index ef5fe29202c..f85b6bebb0b 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -575,7 +575,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
575{ 575{
576 unsigned long csr_reg, csr, csr_error_bits; 576 unsigned long csr_reg, csr, csr_error_bits;
577 irqreturn_t ret = IRQ_NONE; 577 irqreturn_t ret = IRQ_NONE;
578 u16 stat; 578 u16 stat, *addr;
579 579
580 if (is_pbm_a) { 580 if (is_pbm_a) {
581 csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL; 581 csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL;
@@ -597,7 +597,9 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
597 printk("%s: PCI SERR signal asserted.\n", pbm->name); 597 printk("%s: PCI SERR signal asserted.\n", pbm->name);
598 ret = IRQ_HANDLED; 598 ret = IRQ_HANDLED;
599 } 599 }
600 pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); 600 addr = psycho_pci_config_mkaddr(pbm, pbm->pci_first_busno,
601 0, PCI_STATUS);
602 pci_config_read16(addr, &stat);
601 if (stat & (PCI_STATUS_PARITY | 603 if (stat & (PCI_STATUS_PARITY |
602 PCI_STATUS_SIG_TARGET_ABORT | 604 PCI_STATUS_SIG_TARGET_ABORT |
603 PCI_STATUS_REC_TARGET_ABORT | 605 PCI_STATUS_REC_TARGET_ABORT |
@@ -605,7 +607,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
605 PCI_STATUS_SIG_SYSTEM_ERROR)) { 607 PCI_STATUS_SIG_SYSTEM_ERROR)) {
606 printk("%s: PCI bus error, PCI_STATUS[%04x]\n", 608 printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
607 pbm->name, stat); 609 pbm->name, stat);
608 pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); 610 pci_config_write16(addr, 0xffff);
609 ret = IRQ_HANDLED; 611 ret = IRQ_HANDLED;
610 } 612 }
611 return ret; 613 return ret;
@@ -744,16 +746,16 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
744 * the second will just error out since we do not pass in 746 * the second will just error out since we do not pass in
745 * IRQF_SHARED. 747 * IRQF_SHARED.
746 */ 748 */
747 err = request_irq(op->irqs[1], psycho_ue_intr, 0, 749 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED,
748 "PSYCHO_UE", pbm); 750 "PSYCHO_UE", pbm);
749 err = request_irq(op->irqs[2], psycho_ce_intr, 0, 751 err = request_irq(op->irqs[2], psycho_ce_intr, IRQF_SHARED,
750 "PSYCHO_CE", pbm); 752 "PSYCHO_CE", pbm);
751 753
752 /* This one, however, ought not to fail. We can just warn 754 /* This one, however, ought not to fail. We can just warn
753 * about it since the system can still operate properly even 755 * about it since the system can still operate properly even
754 * if this fails. 756 * if this fails.
755 */ 757 */
756 err = request_irq(op->irqs[0], psycho_pcierr_intr, 0, 758 err = request_irq(op->irqs[0], psycho_pcierr_intr, IRQF_SHARED,
757 "PSYCHO_PCIERR", pbm); 759 "PSYCHO_PCIERR", pbm);
758 if (err) 760 if (err)
759 printk(KERN_WARNING "%s: Could not register PCIERR, " 761 printk(KERN_WARNING "%s: Could not register PCIERR, "
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 3c048ac4e63..7151513f156 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -156,55 +156,11 @@ static unsigned long psycho_pcislot_imap_offset(unsigned long ino)
156 return PSYCHO_IMAP_B_SLOT0 + (slot * 8); 156 return PSYCHO_IMAP_B_SLOT0 + (slot * 8);
157} 157}
158 158
159#define PSYCHO_IMAP_SCSI 0x1000UL 159#define PSYCHO_OBIO_IMAP_BASE 0x1000UL
160#define PSYCHO_IMAP_ETH 0x1008UL 160
161#define PSYCHO_IMAP_BPP 0x1010UL
162#define PSYCHO_IMAP_AU_REC 0x1018UL
163#define PSYCHO_IMAP_AU_PLAY 0x1020UL
164#define PSYCHO_IMAP_PFAIL 0x1028UL
165#define PSYCHO_IMAP_KMS 0x1030UL
166#define PSYCHO_IMAP_FLPY 0x1038UL
167#define PSYCHO_IMAP_SHW 0x1040UL
168#define PSYCHO_IMAP_KBD 0x1048UL
169#define PSYCHO_IMAP_MS 0x1050UL
170#define PSYCHO_IMAP_SER 0x1058UL
171#define PSYCHO_IMAP_TIM0 0x1060UL
172#define PSYCHO_IMAP_TIM1 0x1068UL
173#define PSYCHO_IMAP_UE 0x1070UL
174#define PSYCHO_IMAP_CE 0x1078UL
175#define PSYCHO_IMAP_A_ERR 0x1080UL
176#define PSYCHO_IMAP_B_ERR 0x1088UL
177#define PSYCHO_IMAP_PMGMT 0x1090UL
178#define PSYCHO_IMAP_GFX 0x1098UL
179#define PSYCHO_IMAP_EUPA 0x10a0UL
180
181static unsigned long __psycho_onboard_imap_off[] = {
182/*0x20*/ PSYCHO_IMAP_SCSI,
183/*0x21*/ PSYCHO_IMAP_ETH,
184/*0x22*/ PSYCHO_IMAP_BPP,
185/*0x23*/ PSYCHO_IMAP_AU_REC,
186/*0x24*/ PSYCHO_IMAP_AU_PLAY,
187/*0x25*/ PSYCHO_IMAP_PFAIL,
188/*0x26*/ PSYCHO_IMAP_KMS,
189/*0x27*/ PSYCHO_IMAP_FLPY,
190/*0x28*/ PSYCHO_IMAP_SHW,
191/*0x29*/ PSYCHO_IMAP_KBD,
192/*0x2a*/ PSYCHO_IMAP_MS,
193/*0x2b*/ PSYCHO_IMAP_SER,
194/*0x2c*/ PSYCHO_IMAP_TIM0,
195/*0x2d*/ PSYCHO_IMAP_TIM1,
196/*0x2e*/ PSYCHO_IMAP_UE,
197/*0x2f*/ PSYCHO_IMAP_CE,
198/*0x30*/ PSYCHO_IMAP_A_ERR,
199/*0x31*/ PSYCHO_IMAP_B_ERR,
200/*0x32*/ PSYCHO_IMAP_PMGMT,
201/*0x33*/ PSYCHO_IMAP_GFX,
202/*0x34*/ PSYCHO_IMAP_EUPA,
203};
204#define PSYCHO_ONBOARD_IRQ_BASE 0x20 161#define PSYCHO_ONBOARD_IRQ_BASE 0x20
205#define PSYCHO_ONBOARD_IRQ_LAST 0x34
206#define psycho_onboard_imap_offset(__ino) \ 162#define psycho_onboard_imap_offset(__ino) \
207 __psycho_onboard_imap_off[(__ino) - PSYCHO_ONBOARD_IRQ_BASE] 163 (PSYCHO_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3))
208 164
209#define PSYCHO_ICLR_A_SLOT0 0x1400UL 165#define PSYCHO_ICLR_A_SLOT0 0x1400UL
210#define PSYCHO_ICLR_SCSI 0x1800UL 166#define PSYCHO_ICLR_SCSI 0x1800UL
@@ -228,10 +184,6 @@ static unsigned int psycho_irq_build(struct device_node *dp,
228 imap_off = psycho_pcislot_imap_offset(ino); 184 imap_off = psycho_pcislot_imap_offset(ino);
229 } else { 185 } else {
230 /* Onboard device */ 186 /* Onboard device */
231 if (ino > PSYCHO_ONBOARD_IRQ_LAST) {
232 prom_printf("psycho_irq_build: Wacky INO [%x]\n", ino);
233 prom_halt();
234 }
235 imap_off = psycho_onboard_imap_offset(ino); 187 imap_off = psycho_onboard_imap_offset(ino);
236 } 188 }
237 189
@@ -318,23 +270,6 @@ static void sabre_wsync_handler(unsigned int ino, void *_arg1, void *_arg2)
318 270
319#define SABRE_IMAP_A_SLOT0 0x0c00UL 271#define SABRE_IMAP_A_SLOT0 0x0c00UL
320#define SABRE_IMAP_B_SLOT0 0x0c20UL 272#define SABRE_IMAP_B_SLOT0 0x0c20UL
321#define SABRE_IMAP_SCSI 0x1000UL
322#define SABRE_IMAP_ETH 0x1008UL
323#define SABRE_IMAP_BPP 0x1010UL
324#define SABRE_IMAP_AU_REC 0x1018UL
325#define SABRE_IMAP_AU_PLAY 0x1020UL
326#define SABRE_IMAP_PFAIL 0x1028UL
327#define SABRE_IMAP_KMS 0x1030UL
328#define SABRE_IMAP_FLPY 0x1038UL
329#define SABRE_IMAP_SHW 0x1040UL
330#define SABRE_IMAP_KBD 0x1048UL
331#define SABRE_IMAP_MS 0x1050UL
332#define SABRE_IMAP_SER 0x1058UL
333#define SABRE_IMAP_UE 0x1070UL
334#define SABRE_IMAP_CE 0x1078UL
335#define SABRE_IMAP_PCIERR 0x1080UL
336#define SABRE_IMAP_GFX 0x1098UL
337#define SABRE_IMAP_EUPA 0x10a0UL
338#define SABRE_ICLR_A_SLOT0 0x1400UL 273#define SABRE_ICLR_A_SLOT0 0x1400UL
339#define SABRE_ICLR_B_SLOT0 0x1480UL 274#define SABRE_ICLR_B_SLOT0 0x1480UL
340#define SABRE_ICLR_SCSI 0x1800UL 275#define SABRE_ICLR_SCSI 0x1800UL
@@ -364,33 +299,10 @@ static unsigned long sabre_pcislot_imap_offset(unsigned long ino)
364 return SABRE_IMAP_B_SLOT0 + (slot * 8); 299 return SABRE_IMAP_B_SLOT0 + (slot * 8);
365} 300}
366 301
367static unsigned long __sabre_onboard_imap_off[] = { 302#define SABRE_OBIO_IMAP_BASE 0x1000UL
368/*0x20*/ SABRE_IMAP_SCSI, 303#define SABRE_ONBOARD_IRQ_BASE 0x20
369/*0x21*/ SABRE_IMAP_ETH,
370/*0x22*/ SABRE_IMAP_BPP,
371/*0x23*/ SABRE_IMAP_AU_REC,
372/*0x24*/ SABRE_IMAP_AU_PLAY,
373/*0x25*/ SABRE_IMAP_PFAIL,
374/*0x26*/ SABRE_IMAP_KMS,
375/*0x27*/ SABRE_IMAP_FLPY,
376/*0x28*/ SABRE_IMAP_SHW,
377/*0x29*/ SABRE_IMAP_KBD,
378/*0x2a*/ SABRE_IMAP_MS,
379/*0x2b*/ SABRE_IMAP_SER,
380/*0x2c*/ 0 /* reserved */,
381/*0x2d*/ 0 /* reserved */,
382/*0x2e*/ SABRE_IMAP_UE,
383/*0x2f*/ SABRE_IMAP_CE,
384/*0x30*/ SABRE_IMAP_PCIERR,
385/*0x31*/ 0 /* reserved */,
386/*0x32*/ 0 /* reserved */,
387/*0x33*/ SABRE_IMAP_GFX,
388/*0x34*/ SABRE_IMAP_EUPA,
389};
390#define SABRE_ONBOARD_IRQ_BASE 0x20
391#define SABRE_ONBOARD_IRQ_LAST 0x30
392#define sabre_onboard_imap_offset(__ino) \ 304#define sabre_onboard_imap_offset(__ino) \
393 __sabre_onboard_imap_off[(__ino) - SABRE_ONBOARD_IRQ_BASE] 305 (SABRE_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3))
394 306
395#define sabre_iclr_offset(ino) \ 307#define sabre_iclr_offset(ino) \
396 ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ 308 ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \
@@ -453,10 +365,6 @@ static unsigned int sabre_irq_build(struct device_node *dp,
453 imap_off = sabre_pcislot_imap_offset(ino); 365 imap_off = sabre_pcislot_imap_offset(ino);
454 } else { 366 } else {
455 /* onboard device */ 367 /* onboard device */
456 if (ino > SABRE_ONBOARD_IRQ_LAST) {
457 prom_printf("sabre_irq_build: Wacky INO [%x]\n", ino);
458 prom_halt();
459 }
460 imap_off = sabre_onboard_imap_offset(ino); 368 imap_off = sabre_onboard_imap_offset(ino);
461 } 369 }
462 370
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index bd578cc4856..10306e476e3 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -443,7 +443,7 @@ static const struct user_regset sparc64_regsets[] = {
443 */ 443 */
444 [REGSET_GENERAL] = { 444 [REGSET_GENERAL] = {
445 .core_note_type = NT_PRSTATUS, 445 .core_note_type = NT_PRSTATUS,
446 .n = 36 * sizeof(u64), 446 .n = 36,
447 .size = sizeof(u64), .align = sizeof(u64), 447 .size = sizeof(u64), .align = sizeof(u64),
448 .get = genregs64_get, .set = genregs64_set 448 .get = genregs64_get, .set = genregs64_set
449 }, 449 },
@@ -455,7 +455,7 @@ static const struct user_regset sparc64_regsets[] = {
455 */ 455 */
456 [REGSET_FP] = { 456 [REGSET_FP] = {
457 .core_note_type = NT_PRFPREG, 457 .core_note_type = NT_PRFPREG,
458 .n = 35 * sizeof(u64), 458 .n = 35,
459 .size = sizeof(u64), .align = sizeof(u64), 459 .size = sizeof(u64), .align = sizeof(u64),
460 .get = fpregs64_get, .set = fpregs64_set 460 .get = fpregs64_get, .set = fpregs64_set
461 }, 461 },
@@ -801,7 +801,7 @@ static const struct user_regset sparc32_regsets[] = {
801 */ 801 */
802 [REGSET_GENERAL] = { 802 [REGSET_GENERAL] = {
803 .core_note_type = NT_PRSTATUS, 803 .core_note_type = NT_PRSTATUS,
804 .n = 38 * sizeof(u32), 804 .n = 38,
805 .size = sizeof(u32), .align = sizeof(u32), 805 .size = sizeof(u32), .align = sizeof(u32),
806 .get = genregs32_get, .set = genregs32_set 806 .get = genregs32_get, .set = genregs32_set
807 }, 807 },
@@ -817,7 +817,7 @@ static const struct user_regset sparc32_regsets[] = {
817 */ 817 */
818 [REGSET_FP] = { 818 [REGSET_FP] = {
819 .core_note_type = NT_PRFPREG, 819 .core_note_type = NT_PRFPREG,
820 .n = 99 * sizeof(u32), 820 .n = 99,
821 .size = sizeof(u32), .align = sizeof(u32), 821 .size = sizeof(u32), .align = sizeof(u32),
822 .get = fpregs32_get, .set = fpregs32_set 822 .get = fpregs32_get, .set = fpregs32_set
823 }, 823 },
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 743ccad61c6..2be166c544c 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -80,8 +80,6 @@ void smp_bogo(struct seq_file *m)
80 i, cpu_data(i).clock_tick); 80 i, cpu_data(i).clock_tick);
81} 81}
82 82
83static __cacheline_aligned_in_smp DEFINE_SPINLOCK(call_lock);
84
85extern void setup_sparc64_timer(void); 83extern void setup_sparc64_timer(void);
86 84
87static volatile unsigned long callin_flag = 0; 85static volatile unsigned long callin_flag = 0;
@@ -120,9 +118,9 @@ void __cpuinit smp_callin(void)
120 while (!cpu_isset(cpuid, smp_commenced_mask)) 118 while (!cpu_isset(cpuid, smp_commenced_mask))
121 rmb(); 119 rmb();
122 120
123 spin_lock(&call_lock); 121 ipi_call_lock();
124 cpu_set(cpuid, cpu_online_map); 122 cpu_set(cpuid, cpu_online_map);
125 spin_unlock(&call_lock); 123 ipi_call_unlock();
126 124
127 /* idle thread is expected to have preempt disabled */ 125 /* idle thread is expected to have preempt disabled */
128 preempt_disable(); 126 preempt_disable();
@@ -1305,10 +1303,6 @@ int __cpu_disable(void)
1305 c->core_id = 0; 1303 c->core_id = 0;
1306 c->proc_id = -1; 1304 c->proc_id = -1;
1307 1305
1308 spin_lock(&call_lock);
1309 cpu_clear(cpu, cpu_online_map);
1310 spin_unlock(&call_lock);
1311
1312 smp_wmb(); 1306 smp_wmb();
1313 1307
1314 /* Make sure no interrupts point to this cpu. */ 1308 /* Make sure no interrupts point to this cpu. */
@@ -1318,6 +1312,10 @@ int __cpu_disable(void)
1318 mdelay(1); 1312 mdelay(1);
1319 local_irq_disable(); 1313 local_irq_disable();
1320 1314
1315 ipi_call_lock();
1316 cpu_clear(cpu, cpu_online_map);
1317 ipi_call_unlock();
1318
1321 return 0; 1319 return 0;
1322} 1320}
1323 1321
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 3d924121c79..c824df13f58 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/linkage.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/signal.h> 15#include <linux/signal.h>
15#include <linux/smp.h> 16#include <linux/smp.h>
@@ -2453,7 +2454,7 @@ struct trap_per_cpu trap_block[NR_CPUS];
2453/* This can get invoked before sched_init() so play it super safe 2454/* This can get invoked before sched_init() so play it super safe
2454 * and use hard_smp_processor_id(). 2455 * and use hard_smp_processor_id().
2455 */ 2456 */
2456void init_cur_cpu_trap(struct thread_info *t) 2457void notrace init_cur_cpu_trap(struct thread_info *t)
2457{ 2458{
2458 int cpu = hard_smp_processor_id(); 2459 int cpu = hard_smp_processor_id();
2459 struct trap_per_cpu *p = &trap_block[cpu]; 2460 struct trap_per_cpu *p = &trap_block[cpu];
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 217de3ea29e..a41df7bef03 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -796,6 +796,9 @@ static unsigned long nid_range(unsigned long start, unsigned long end,
796 start += PAGE_SIZE; 796 start += PAGE_SIZE;
797 } 797 }
798 798
799 if (start > end)
800 start = end;
801
799 return start; 802 return start;
800} 803}
801#else 804#else
@@ -1723,8 +1726,7 @@ void __init paging_init(void)
1723 1726
1724 find_ramdisk(phys_base); 1727 find_ramdisk(phys_base);
1725 1728
1726 if (cmdline_memory_size) 1729 lmb_enforce_memory_limit(cmdline_memory_size);
1727 lmb_enforce_memory_limit(phys_base + cmdline_memory_size);
1728 1730
1729 lmb_analyze(); 1731 lmb_analyze();
1730 lmb_dump_all(); 1732 lmb_dump_all();
@@ -1841,7 +1843,7 @@ static int pavail_rescan_ents __initdata;
1841 * memory list again, and make sure it provides at least as much 1843 * memory list again, and make sure it provides at least as much
1842 * memory as 'pavail' does. 1844 * memory as 'pavail' does.
1843 */ 1845 */
1844static void setup_valid_addr_bitmap_from_pavail(void) 1846static void __init setup_valid_addr_bitmap_from_pavail(void)
1845{ 1847{
1846 int i; 1848 int i;
1847 1849
@@ -1961,6 +1963,15 @@ void __init mem_init(void)
1961void free_initmem(void) 1963void free_initmem(void)
1962{ 1964{
1963 unsigned long addr, initend; 1965 unsigned long addr, initend;
1966 int do_free = 1;
1967
1968 /* If the physical memory maps were trimmed by kernel command
1969 * line options, don't even try freeing this initmem stuff up.
1970 * The kernel image could have been in the trimmed out region
1971 * and if so the freeing below will free invalid page structs.
1972 */
1973 if (cmdline_memory_size)
1974 do_free = 0;
1964 1975
1965 /* 1976 /*
1966 * The init section is aligned to 8k in vmlinux.lds. Page align for >8k pagesizes. 1977 * The init section is aligned to 8k in vmlinux.lds. Page align for >8k pagesizes.
@@ -1975,13 +1986,16 @@ void free_initmem(void)
1975 ((unsigned long) __va(kern_base)) - 1986 ((unsigned long) __va(kern_base)) -
1976 ((unsigned long) KERNBASE)); 1987 ((unsigned long) KERNBASE));
1977 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); 1988 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
1978 p = virt_to_page(page);
1979 1989
1980 ClearPageReserved(p); 1990 if (do_free) {
1981 init_page_count(p); 1991 p = virt_to_page(page);
1982 __free_page(p); 1992
1983 num_physpages++; 1993 ClearPageReserved(p);
1984 totalram_pages++; 1994 init_page_count(p);
1995 __free_page(p);
1996 num_physpages++;
1997 totalram_pages++;
1998 }
1985 } 1999 }
1986} 2000}
1987 2001