diff options
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci.c | 127 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_psycho.c | 34 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 36 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_schizo.c | 48 | ||||
-rw-r--r-- | arch/sparc64/kernel/process.c | 5 | ||||
-rw-r--r-- | arch/sparc64/kernel/sparc64_ksyms.c | 14 | ||||
-rw-r--r-- | arch/sparc64/lib/Makefile | 3 | ||||
-rw-r--r-- | arch/sparc64/lib/debuglocks.c | 366 | ||||
-rw-r--r-- | arch/sparc64/lib/mb.S | 73 | ||||
-rw-r--r-- | arch/sparc64/solaris/ioctl.c | 15 | ||||
-rw-r--r-- | arch/sparc64/solaris/timod.c | 29 |
12 files changed, 97 insertions, 654 deletions
diff --git a/arch/sparc64/kernel/asm-offsets.c b/arch/sparc64/kernel/asm-offsets.c new file mode 100644 index 000000000000..9e263112a6e2 --- /dev/null +++ b/arch/sparc64/kernel/asm-offsets.c | |||
@@ -0,0 +1 @@ | |||
/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */ | |||
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index ec8bf4012c0c..2ff7c32ab0ce 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c | |||
@@ -359,134 +359,17 @@ void pcibios_fixup_bus(struct pci_bus *pbus) | |||
359 | pbus->resource[1] = &pbm->mem_space; | 359 | pbus->resource[1] = &pbm->mem_space; |
360 | } | 360 | } |
361 | 361 | ||
362 | int pci_claim_resource(struct pci_dev *pdev, int resource) | 362 | struct resource *pcibios_select_root(struct pci_dev *pdev, struct resource *r) |
363 | { | 363 | { |
364 | struct pci_pbm_info *pbm = pdev->bus->sysdata; | 364 | struct pci_pbm_info *pbm = pdev->bus->sysdata; |
365 | struct resource *res = &pdev->resource[resource]; | 365 | struct resource *root = NULL; |
366 | struct resource *root; | ||
367 | |||
368 | if (!pbm) | ||
369 | return -EINVAL; | ||
370 | 366 | ||
371 | if (res->flags & IORESOURCE_IO) | 367 | if (r->flags & IORESOURCE_IO) |
372 | root = &pbm->io_space; | 368 | root = &pbm->io_space; |
373 | else | 369 | if (r->flags & IORESOURCE_MEM) |
374 | root = &pbm->mem_space; | 370 | root = &pbm->mem_space; |
375 | 371 | ||
376 | pbm->parent->resource_adjust(pdev, res, root); | 372 | return root; |
377 | |||
378 | return request_resource(root, res); | ||
379 | } | ||
380 | |||
381 | /* | ||
382 | * Given the PCI bus a device resides on, try to | ||
383 | * find an acceptable resource allocation for a | ||
384 | * specific device resource.. | ||
385 | */ | ||
386 | static int pci_assign_bus_resource(const struct pci_bus *bus, | ||
387 | struct pci_dev *dev, | ||
388 | struct resource *res, | ||
389 | unsigned long size, | ||
390 | unsigned long min, | ||
391 | int resno) | ||
392 | { | ||
393 | unsigned int type_mask; | ||
394 | int i; | ||
395 | |||
396 | type_mask = IORESOURCE_IO | IORESOURCE_MEM; | ||
397 | for (i = 0 ; i < 4; i++) { | ||
398 | struct resource *r = bus->resource[i]; | ||
399 | if (!r) | ||
400 | continue; | ||
401 | |||
402 | /* type_mask must match */ | ||
403 | if ((res->flags ^ r->flags) & type_mask) | ||
404 | continue; | ||
405 | |||
406 | /* Ok, try it out.. */ | ||
407 | if (allocate_resource(r, res, size, min, -1, size, NULL, NULL) < 0) | ||
408 | continue; | ||
409 | |||
410 | /* PCI config space updated by caller. */ | ||
411 | return 0; | ||
412 | } | ||
413 | return -EBUSY; | ||
414 | } | ||
415 | |||
416 | int pci_assign_resource(struct pci_dev *pdev, int resource) | ||
417 | { | ||
418 | struct pcidev_cookie *pcp = pdev->sysdata; | ||
419 | struct pci_pbm_info *pbm = pcp->pbm; | ||
420 | struct resource *res = &pdev->resource[resource]; | ||
421 | unsigned long min, size; | ||
422 | int err; | ||
423 | |||
424 | if (res->flags & IORESOURCE_IO) | ||
425 | min = pbm->io_space.start + 0x400UL; | ||
426 | else | ||
427 | min = pbm->mem_space.start; | ||
428 | |||
429 | size = res->end - res->start + 1; | ||
430 | |||
431 | err = pci_assign_bus_resource(pdev->bus, pdev, res, size, min, resource); | ||
432 | |||
433 | if (err < 0) { | ||
434 | printk("PCI: Failed to allocate resource %d for %s\n", | ||
435 | resource, pci_name(pdev)); | ||
436 | } else { | ||
437 | /* Update PCI config space. */ | ||
438 | pbm->parent->base_address_update(pdev, resource); | ||
439 | } | ||
440 | |||
441 | return err; | ||
442 | } | ||
443 | |||
444 | /* Sort resources by alignment */ | ||
445 | void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | ||
446 | { | ||
447 | int i; | ||
448 | |||
449 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
450 | struct resource *r; | ||
451 | struct resource_list *list, *tmp; | ||
452 | unsigned long r_align; | ||
453 | |||
454 | r = &dev->resource[i]; | ||
455 | r_align = r->end - r->start; | ||
456 | |||
457 | if (!(r->flags) || r->parent) | ||
458 | continue; | ||
459 | if (!r_align) { | ||
460 | printk(KERN_WARNING "PCI: Ignore bogus resource %d " | ||
461 | "[%lx:%lx] of %s\n", | ||
462 | i, r->start, r->end, pci_name(dev)); | ||
463 | continue; | ||
464 | } | ||
465 | r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start; | ||
466 | for (list = head; ; list = list->next) { | ||
467 | unsigned long align = 0; | ||
468 | struct resource_list *ln = list->next; | ||
469 | int idx; | ||
470 | |||
471 | if (ln) { | ||
472 | idx = ln->res - &ln->dev->resource[0]; | ||
473 | align = (idx < PCI_BRIDGE_RESOURCES) ? | ||
474 | ln->res->end - ln->res->start + 1 : | ||
475 | ln->res->start; | ||
476 | } | ||
477 | if (r_align > align) { | ||
478 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
479 | if (!tmp) | ||
480 | panic("pdev_sort_resources(): " | ||
481 | "kmalloc() failed!\n"); | ||
482 | tmp->next = ln; | ||
483 | tmp->res = r; | ||
484 | tmp->dev = dev; | ||
485 | list->next = tmp; | ||
486 | break; | ||
487 | } | ||
488 | } | ||
489 | } | ||
490 | } | 373 | } |
491 | 374 | ||
492 | void pcibios_update_irq(struct pci_dev *pdev, int irq) | 375 | void pcibios_update_irq(struct pci_dev *pdev, int irq) |
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c index 91ab466d6c66..6ed1ef25e0ac 100644 --- a/arch/sparc64/kernel/pci_psycho.c +++ b/arch/sparc64/kernel/pci_psycho.c | |||
@@ -307,7 +307,7 @@ static unsigned char psycho_pil_table[] = { | |||
307 | /*0x32*/15, /* Power Management */ | 307 | /*0x32*/15, /* Power Management */ |
308 | }; | 308 | }; |
309 | 309 | ||
310 | static int __init psycho_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | 310 | static int psycho_ino_to_pil(struct pci_dev *pdev, unsigned int ino) |
311 | { | 311 | { |
312 | int ret; | 312 | int ret; |
313 | 313 | ||
@@ -344,9 +344,9 @@ static int __init psycho_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | |||
344 | return ret; | 344 | return ret; |
345 | } | 345 | } |
346 | 346 | ||
347 | static unsigned int __init psycho_irq_build(struct pci_pbm_info *pbm, | 347 | static unsigned int psycho_irq_build(struct pci_pbm_info *pbm, |
348 | struct pci_dev *pdev, | 348 | struct pci_dev *pdev, |
349 | unsigned int ino) | 349 | unsigned int ino) |
350 | { | 350 | { |
351 | struct ino_bucket *bucket; | 351 | struct ino_bucket *bucket; |
352 | unsigned long imap, iclr; | 352 | unsigned long imap, iclr; |
@@ -1024,7 +1024,7 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id, struct pt_regs *reg | |||
1024 | #define PSYCHO_CE_INO 0x2f | 1024 | #define PSYCHO_CE_INO 0x2f |
1025 | #define PSYCHO_PCIERR_A_INO 0x30 | 1025 | #define PSYCHO_PCIERR_A_INO 0x30 |
1026 | #define PSYCHO_PCIERR_B_INO 0x31 | 1026 | #define PSYCHO_PCIERR_B_INO 0x31 |
1027 | static void __init psycho_register_error_handlers(struct pci_controller_info *p) | 1027 | static void psycho_register_error_handlers(struct pci_controller_info *p) |
1028 | { | 1028 | { |
1029 | struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ | 1029 | struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ |
1030 | unsigned long base = p->pbm_A.controller_regs; | 1030 | unsigned long base = p->pbm_A.controller_regs; |
@@ -1091,15 +1091,15 @@ static void __init psycho_register_error_handlers(struct pci_controller_info *p) | |||
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | /* PSYCHO boot time probing and initialization. */ | 1093 | /* PSYCHO boot time probing and initialization. */ |
1094 | static void __init psycho_resource_adjust(struct pci_dev *pdev, | 1094 | static void psycho_resource_adjust(struct pci_dev *pdev, |
1095 | struct resource *res, | 1095 | struct resource *res, |
1096 | struct resource *root) | 1096 | struct resource *root) |
1097 | { | 1097 | { |
1098 | res->start += root->start; | 1098 | res->start += root->start; |
1099 | res->end += root->start; | 1099 | res->end += root->start; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | static void __init psycho_base_address_update(struct pci_dev *pdev, int resource) | 1102 | static void psycho_base_address_update(struct pci_dev *pdev, int resource) |
1103 | { | 1103 | { |
1104 | struct pcidev_cookie *pcp = pdev->sysdata; | 1104 | struct pcidev_cookie *pcp = pdev->sysdata; |
1105 | struct pci_pbm_info *pbm = pcp->pbm; | 1105 | struct pci_pbm_info *pbm = pcp->pbm; |
@@ -1144,7 +1144,7 @@ static void __init psycho_base_address_update(struct pci_dev *pdev, int resource | |||
1144 | pci_write_config_dword(pdev, where + 4, 0); | 1144 | pci_write_config_dword(pdev, where + 4, 0); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | static void __init pbm_config_busmastering(struct pci_pbm_info *pbm) | 1147 | static void pbm_config_busmastering(struct pci_pbm_info *pbm) |
1148 | { | 1148 | { |
1149 | u8 *addr; | 1149 | u8 *addr; |
1150 | 1150 | ||
@@ -1161,8 +1161,8 @@ static void __init pbm_config_busmastering(struct pci_pbm_info *pbm) | |||
1161 | pci_config_write8(addr, 64); | 1161 | pci_config_write8(addr, 64); |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | static void __init pbm_scan_bus(struct pci_controller_info *p, | 1164 | static void pbm_scan_bus(struct pci_controller_info *p, |
1165 | struct pci_pbm_info *pbm) | 1165 | struct pci_pbm_info *pbm) |
1166 | { | 1166 | { |
1167 | struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); | 1167 | struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); |
1168 | 1168 | ||
@@ -1189,7 +1189,7 @@ static void __init pbm_scan_bus(struct pci_controller_info *p, | |||
1189 | pci_setup_busmastering(pbm, pbm->pci_bus); | 1189 | pci_setup_busmastering(pbm, pbm->pci_bus); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | static void __init psycho_scan_bus(struct pci_controller_info *p) | 1192 | static void psycho_scan_bus(struct pci_controller_info *p) |
1193 | { | 1193 | { |
1194 | pbm_config_busmastering(&p->pbm_B); | 1194 | pbm_config_busmastering(&p->pbm_B); |
1195 | p->pbm_B.is_66mhz_capable = 0; | 1195 | p->pbm_B.is_66mhz_capable = 0; |
@@ -1204,7 +1204,7 @@ static void __init psycho_scan_bus(struct pci_controller_info *p) | |||
1204 | psycho_register_error_handlers(p); | 1204 | psycho_register_error_handlers(p); |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | static void __init psycho_iommu_init(struct pci_controller_info *p) | 1207 | static void psycho_iommu_init(struct pci_controller_info *p) |
1208 | { | 1208 | { |
1209 | struct pci_iommu *iommu = p->pbm_A.iommu; | 1209 | struct pci_iommu *iommu = p->pbm_A.iommu; |
1210 | unsigned long tsbbase, i; | 1210 | unsigned long tsbbase, i; |
@@ -1327,8 +1327,8 @@ static void psycho_controller_hwinit(struct pci_controller_info *p) | |||
1327 | psycho_write(p->pbm_A.controller_regs + PSYCHO_PCIB_DIAG, tmp); | 1327 | psycho_write(p->pbm_A.controller_regs + PSYCHO_PCIB_DIAG, tmp); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, | 1330 | static void pbm_register_toplevel_resources(struct pci_controller_info *p, |
1331 | struct pci_pbm_info *pbm) | 1331 | struct pci_pbm_info *pbm) |
1332 | { | 1332 | { |
1333 | char *name = pbm->name; | 1333 | char *name = pbm->name; |
1334 | 1334 | ||
@@ -1481,7 +1481,7 @@ static void psycho_pbm_init(struct pci_controller_info *p, | |||
1481 | 1481 | ||
1482 | #define PSYCHO_CONFIGSPACE 0x001000000UL | 1482 | #define PSYCHO_CONFIGSPACE 0x001000000UL |
1483 | 1483 | ||
1484 | void __init psycho_init(int node, char *model_name) | 1484 | void psycho_init(int node, char *model_name) |
1485 | { | 1485 | { |
1486 | struct linux_prom64_registers pr_regs[3]; | 1486 | struct linux_prom64_registers pr_regs[3]; |
1487 | struct pci_controller_info *p; | 1487 | struct pci_controller_info *p; |
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index 52bf3431a422..0ee6bd5b9ac6 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -554,7 +554,7 @@ static unsigned char sabre_pil_table[] = { | |||
554 | /*0x32*/15, /* Power Management */ | 554 | /*0x32*/15, /* Power Management */ |
555 | }; | 555 | }; |
556 | 556 | ||
557 | static int __init sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | 557 | static int sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino) |
558 | { | 558 | { |
559 | int ret; | 559 | int ret; |
560 | 560 | ||
@@ -612,9 +612,9 @@ static void sabre_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_a | |||
612 | sabre_read(sync_reg); | 612 | sabre_read(sync_reg); |
613 | } | 613 | } |
614 | 614 | ||
615 | static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, | 615 | static unsigned int sabre_irq_build(struct pci_pbm_info *pbm, |
616 | struct pci_dev *pdev, | 616 | struct pci_dev *pdev, |
617 | unsigned int ino) | 617 | unsigned int ino) |
618 | { | 618 | { |
619 | struct ino_bucket *bucket; | 619 | struct ino_bucket *bucket; |
620 | unsigned long imap, iclr; | 620 | unsigned long imap, iclr; |
@@ -1009,7 +1009,7 @@ static irqreturn_t sabre_pcierr_intr(int irq, void *dev_id, struct pt_regs *regs | |||
1009 | #define SABRE_UE_INO 0x2e | 1009 | #define SABRE_UE_INO 0x2e |
1010 | #define SABRE_CE_INO 0x2f | 1010 | #define SABRE_CE_INO 0x2f |
1011 | #define SABRE_PCIERR_INO 0x30 | 1011 | #define SABRE_PCIERR_INO 0x30 |
1012 | static void __init sabre_register_error_handlers(struct pci_controller_info *p) | 1012 | static void sabre_register_error_handlers(struct pci_controller_info *p) |
1013 | { | 1013 | { |
1014 | struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ | 1014 | struct pci_pbm_info *pbm = &p->pbm_A; /* arbitrary */ |
1015 | unsigned long base = pbm->controller_regs; | 1015 | unsigned long base = pbm->controller_regs; |
@@ -1056,9 +1056,9 @@ static void __init sabre_register_error_handlers(struct pci_controller_info *p) | |||
1056 | sabre_write(base + SABRE_PCICTRL, tmp); | 1056 | sabre_write(base + SABRE_PCICTRL, tmp); |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | static void __init sabre_resource_adjust(struct pci_dev *pdev, | 1059 | static void sabre_resource_adjust(struct pci_dev *pdev, |
1060 | struct resource *res, | 1060 | struct resource *res, |
1061 | struct resource *root) | 1061 | struct resource *root) |
1062 | { | 1062 | { |
1063 | struct pci_pbm_info *pbm = pdev->bus->sysdata; | 1063 | struct pci_pbm_info *pbm = pdev->bus->sysdata; |
1064 | unsigned long base; | 1064 | unsigned long base; |
@@ -1072,7 +1072,7 @@ static void __init sabre_resource_adjust(struct pci_dev *pdev, | |||
1072 | res->end += base; | 1072 | res->end += base; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) | 1075 | static void sabre_base_address_update(struct pci_dev *pdev, int resource) |
1076 | { | 1076 | { |
1077 | struct pcidev_cookie *pcp = pdev->sysdata; | 1077 | struct pcidev_cookie *pcp = pdev->sysdata; |
1078 | struct pci_pbm_info *pbm = pcp->pbm; | 1078 | struct pci_pbm_info *pbm = pcp->pbm; |
@@ -1118,7 +1118,7 @@ static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) | |||
1118 | pci_write_config_dword(pdev, where + 4, 0); | 1118 | pci_write_config_dword(pdev, where + 4, 0); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) | 1121 | static void apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) |
1122 | { | 1122 | { |
1123 | struct pci_dev *pdev; | 1123 | struct pci_dev *pdev; |
1124 | 1124 | ||
@@ -1181,7 +1181,7 @@ static struct pcidev_cookie *alloc_bridge_cookie(struct pci_pbm_info *pbm) | |||
1181 | return cookie; | 1181 | return cookie; |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | static void __init sabre_scan_bus(struct pci_controller_info *p) | 1184 | static void sabre_scan_bus(struct pci_controller_info *p) |
1185 | { | 1185 | { |
1186 | static int once; | 1186 | static int once; |
1187 | struct pci_bus *sabre_bus, *pbus; | 1187 | struct pci_bus *sabre_bus, *pbus; |
@@ -1262,9 +1262,9 @@ static void __init sabre_scan_bus(struct pci_controller_info *p) | |||
1262 | sabre_register_error_handlers(p); | 1262 | sabre_register_error_handlers(p); |
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | static void __init sabre_iommu_init(struct pci_controller_info *p, | 1265 | static void sabre_iommu_init(struct pci_controller_info *p, |
1266 | int tsbsize, unsigned long dvma_offset, | 1266 | int tsbsize, unsigned long dvma_offset, |
1267 | u32 dma_mask) | 1267 | u32 dma_mask) |
1268 | { | 1268 | { |
1269 | struct pci_iommu *iommu = p->pbm_A.iommu; | 1269 | struct pci_iommu *iommu = p->pbm_A.iommu; |
1270 | unsigned long tsbbase, i, order; | 1270 | unsigned long tsbbase, i, order; |
@@ -1345,8 +1345,8 @@ static void __init sabre_iommu_init(struct pci_controller_info *p, | |||
1345 | } | 1345 | } |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, | 1348 | static void pbm_register_toplevel_resources(struct pci_controller_info *p, |
1349 | struct pci_pbm_info *pbm) | 1349 | struct pci_pbm_info *pbm) |
1350 | { | 1350 | { |
1351 | char *name = pbm->name; | 1351 | char *name = pbm->name; |
1352 | unsigned long ibase = p->pbm_A.controller_regs + SABRE_IOSPACE; | 1352 | unsigned long ibase = p->pbm_A.controller_regs + SABRE_IOSPACE; |
@@ -1415,7 +1415,7 @@ static void __init pbm_register_toplevel_resources(struct pci_controller_info *p | |||
1415 | &pbm->mem_space); | 1415 | &pbm->mem_space); |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) | 1418 | static void sabre_pbm_init(struct pci_controller_info *p, int sabre_node, u32 dma_begin) |
1419 | { | 1419 | { |
1420 | struct pci_pbm_info *pbm; | 1420 | struct pci_pbm_info *pbm; |
1421 | char namebuf[128]; | 1421 | char namebuf[128]; |
@@ -1552,7 +1552,7 @@ static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node, | |||
1552 | } | 1552 | } |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | void __init sabre_init(int pnode, char *model_name) | 1555 | void sabre_init(int pnode, char *model_name) |
1556 | { | 1556 | { |
1557 | struct linux_prom64_registers pr_regs[2]; | 1557 | struct linux_prom64_registers pr_regs[2]; |
1558 | struct pci_controller_info *p; | 1558 | struct pci_controller_info *p; |
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c index 6a182bb66281..331382e1a75d 100644 --- a/arch/sparc64/kernel/pci_schizo.c +++ b/arch/sparc64/kernel/pci_schizo.c | |||
@@ -285,7 +285,7 @@ static unsigned char schizo_pil_table[] = { | |||
285 | /*0x3f*/0, /* Reserved for NewLink */ | 285 | /*0x3f*/0, /* Reserved for NewLink */ |
286 | }; | 286 | }; |
287 | 287 | ||
288 | static int __init schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino) | 288 | static int schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino) |
289 | { | 289 | { |
290 | int ret; | 290 | int ret; |
291 | 291 | ||
@@ -1221,7 +1221,7 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs * | |||
1221 | * PCI bus units of the same Tomatillo. I still have not really | 1221 | * PCI bus units of the same Tomatillo. I still have not really |
1222 | * figured this out... | 1222 | * figured this out... |
1223 | */ | 1223 | */ |
1224 | static void __init tomatillo_register_error_handlers(struct pci_controller_info *p) | 1224 | static void tomatillo_register_error_handlers(struct pci_controller_info *p) |
1225 | { | 1225 | { |
1226 | struct pci_pbm_info *pbm; | 1226 | struct pci_pbm_info *pbm; |
1227 | unsigned int irq; | 1227 | unsigned int irq; |
@@ -1359,7 +1359,7 @@ static void __init tomatillo_register_error_handlers(struct pci_controller_info | |||
1359 | (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP))); | 1359 | (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP))); |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | static void __init schizo_register_error_handlers(struct pci_controller_info *p) | 1362 | static void schizo_register_error_handlers(struct pci_controller_info *p) |
1363 | { | 1363 | { |
1364 | struct pci_pbm_info *pbm; | 1364 | struct pci_pbm_info *pbm; |
1365 | unsigned int irq; | 1365 | unsigned int irq; |
@@ -1505,7 +1505,7 @@ static void __init schizo_register_error_handlers(struct pci_controller_info *p) | |||
1505 | (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP))); | 1505 | (SCHIZO_SAFIRQCTRL_EN | (BUS_ERROR_UNMAP))); |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | static void __init pbm_config_busmastering(struct pci_pbm_info *pbm) | 1508 | static void pbm_config_busmastering(struct pci_pbm_info *pbm) |
1509 | { | 1509 | { |
1510 | u8 *addr; | 1510 | u8 *addr; |
1511 | 1511 | ||
@@ -1522,8 +1522,8 @@ static void __init pbm_config_busmastering(struct pci_pbm_info *pbm) | |||
1522 | pci_config_write8(addr, 64); | 1522 | pci_config_write8(addr, 64); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | static void __init pbm_scan_bus(struct pci_controller_info *p, | 1525 | static void pbm_scan_bus(struct pci_controller_info *p, |
1526 | struct pci_pbm_info *pbm) | 1526 | struct pci_pbm_info *pbm) |
1527 | { | 1527 | { |
1528 | struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); | 1528 | struct pcidev_cookie *cookie = kmalloc(sizeof(*cookie), GFP_KERNEL); |
1529 | 1529 | ||
@@ -1550,8 +1550,8 @@ static void __init pbm_scan_bus(struct pci_controller_info *p, | |||
1550 | pci_setup_busmastering(pbm, pbm->pci_bus); | 1550 | pci_setup_busmastering(pbm, pbm->pci_bus); |
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | static void __init __schizo_scan_bus(struct pci_controller_info *p, | 1553 | static void __schizo_scan_bus(struct pci_controller_info *p, |
1554 | int chip_type) | 1554 | int chip_type) |
1555 | { | 1555 | { |
1556 | if (!p->pbm_B.prom_node || !p->pbm_A.prom_node) { | 1556 | if (!p->pbm_B.prom_node || !p->pbm_A.prom_node) { |
1557 | printk("PCI: Only one PCI bus module of controller found.\n"); | 1557 | printk("PCI: Only one PCI bus module of controller found.\n"); |
@@ -1577,17 +1577,17 @@ static void __init __schizo_scan_bus(struct pci_controller_info *p, | |||
1577 | schizo_register_error_handlers(p); | 1577 | schizo_register_error_handlers(p); |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | static void __init schizo_scan_bus(struct pci_controller_info *p) | 1580 | static void schizo_scan_bus(struct pci_controller_info *p) |
1581 | { | 1581 | { |
1582 | __schizo_scan_bus(p, PBM_CHIP_TYPE_SCHIZO); | 1582 | __schizo_scan_bus(p, PBM_CHIP_TYPE_SCHIZO); |
1583 | } | 1583 | } |
1584 | 1584 | ||
1585 | static void __init tomatillo_scan_bus(struct pci_controller_info *p) | 1585 | static void tomatillo_scan_bus(struct pci_controller_info *p) |
1586 | { | 1586 | { |
1587 | __schizo_scan_bus(p, PBM_CHIP_TYPE_TOMATILLO); | 1587 | __schizo_scan_bus(p, PBM_CHIP_TYPE_TOMATILLO); |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | static void __init schizo_base_address_update(struct pci_dev *pdev, int resource) | 1590 | static void schizo_base_address_update(struct pci_dev *pdev, int resource) |
1591 | { | 1591 | { |
1592 | struct pcidev_cookie *pcp = pdev->sysdata; | 1592 | struct pcidev_cookie *pcp = pdev->sysdata; |
1593 | struct pci_pbm_info *pbm = pcp->pbm; | 1593 | struct pci_pbm_info *pbm = pcp->pbm; |
@@ -1632,9 +1632,9 @@ static void __init schizo_base_address_update(struct pci_dev *pdev, int resource | |||
1632 | pci_write_config_dword(pdev, where + 4, 0); | 1632 | pci_write_config_dword(pdev, where + 4, 0); |
1633 | } | 1633 | } |
1634 | 1634 | ||
1635 | static void __init schizo_resource_adjust(struct pci_dev *pdev, | 1635 | static void schizo_resource_adjust(struct pci_dev *pdev, |
1636 | struct resource *res, | 1636 | struct resource *res, |
1637 | struct resource *root) | 1637 | struct resource *root) |
1638 | { | 1638 | { |
1639 | res->start += root->start; | 1639 | res->start += root->start; |
1640 | res->end += root->start; | 1640 | res->end += root->start; |
@@ -1702,8 +1702,8 @@ static void schizo_determine_mem_io_space(struct pci_pbm_info *pbm) | |||
1702 | pbm->mem_space.start); | 1702 | pbm->mem_space.start); |
1703 | } | 1703 | } |
1704 | 1704 | ||
1705 | static void __init pbm_register_toplevel_resources(struct pci_controller_info *p, | 1705 | static void pbm_register_toplevel_resources(struct pci_controller_info *p, |
1706 | struct pci_pbm_info *pbm) | 1706 | struct pci_pbm_info *pbm) |
1707 | { | 1707 | { |
1708 | pbm->io_space.name = pbm->mem_space.name = pbm->name; | 1708 | pbm->io_space.name = pbm->mem_space.name = pbm->name; |
1709 | 1709 | ||
@@ -1932,7 +1932,7 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm) | |||
1932 | #define TOMATILLO_PCI_IOC_TDIAG (0x2250UL) | 1932 | #define TOMATILLO_PCI_IOC_TDIAG (0x2250UL) |
1933 | #define TOMATILLO_PCI_IOC_DDIAG (0x2290UL) | 1933 | #define TOMATILLO_PCI_IOC_DDIAG (0x2290UL) |
1934 | 1934 | ||
1935 | static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm) | 1935 | static void schizo_pbm_hw_init(struct pci_pbm_info *pbm) |
1936 | { | 1936 | { |
1937 | u64 tmp; | 1937 | u64 tmp; |
1938 | 1938 | ||
@@ -1986,9 +1986,9 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm) | |||
1986 | } | 1986 | } |
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | static void __init schizo_pbm_init(struct pci_controller_info *p, | 1989 | static void schizo_pbm_init(struct pci_controller_info *p, |
1990 | int prom_node, u32 portid, | 1990 | int prom_node, u32 portid, |
1991 | int chip_type) | 1991 | int chip_type) |
1992 | { | 1992 | { |
1993 | struct linux_prom64_registers pr_regs[4]; | 1993 | struct linux_prom64_registers pr_regs[4]; |
1994 | unsigned int busrange[2]; | 1994 | unsigned int busrange[2]; |
@@ -2145,7 +2145,7 @@ static inline int portid_compare(u32 x, u32 y, int chip_type) | |||
2145 | return (x == y); | 2145 | return (x == y); |
2146 | } | 2146 | } |
2147 | 2147 | ||
2148 | static void __init __schizo_init(int node, char *model_name, int chip_type) | 2148 | static void __schizo_init(int node, char *model_name, int chip_type) |
2149 | { | 2149 | { |
2150 | struct pci_controller_info *p; | 2150 | struct pci_controller_info *p; |
2151 | struct pci_iommu *iommu; | 2151 | struct pci_iommu *iommu; |
@@ -2213,17 +2213,17 @@ static void __init __schizo_init(int node, char *model_name, int chip_type) | |||
2213 | schizo_pbm_init(p, node, portid, chip_type); | 2213 | schizo_pbm_init(p, node, portid, chip_type); |
2214 | } | 2214 | } |
2215 | 2215 | ||
2216 | void __init schizo_init(int node, char *model_name) | 2216 | void schizo_init(int node, char *model_name) |
2217 | { | 2217 | { |
2218 | __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO); | 2218 | __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO); |
2219 | } | 2219 | } |
2220 | 2220 | ||
2221 | void __init schizo_plus_init(int node, char *model_name) | 2221 | void schizo_plus_init(int node, char *model_name) |
2222 | { | 2222 | { |
2223 | __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO_PLUS); | 2223 | __schizo_init(node, model_name, PBM_CHIP_TYPE_SCHIZO_PLUS); |
2224 | } | 2224 | } |
2225 | 2225 | ||
2226 | void __init tomatillo_init(int node, char *model_name) | 2226 | void tomatillo_init(int node, char *model_name) |
2227 | { | 2227 | { |
2228 | __schizo_init(node, model_name, PBM_CHIP_TYPE_TOMATILLO); | 2228 | __schizo_init(node, model_name, PBM_CHIP_TYPE_TOMATILLO); |
2229 | } | 2229 | } |
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 66255434128a..7d10b0397091 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c | |||
@@ -607,11 +607,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, | |||
607 | struct thread_info *t = p->thread_info; | 607 | struct thread_info *t = p->thread_info; |
608 | char *child_trap_frame; | 608 | char *child_trap_frame; |
609 | 609 | ||
610 | #ifdef CONFIG_DEBUG_SPINLOCK | ||
611 | p->thread.smp_lock_count = 0; | ||
612 | p->thread.smp_lock_pc = 0; | ||
613 | #endif | ||
614 | |||
615 | /* Calculate offset to stack_frame & pt_regs */ | 610 | /* Calculate offset to stack_frame & pt_regs */ |
616 | child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); | 611 | child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); |
617 | memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); | 612 | memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); |
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index d89fc24808d3..cbb5e59824e5 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c | |||
@@ -115,17 +115,12 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data); | |||
115 | 115 | ||
116 | /* used by various drivers */ | 116 | /* used by various drivers */ |
117 | #ifdef CONFIG_SMP | 117 | #ifdef CONFIG_SMP |
118 | #ifndef CONFIG_DEBUG_SPINLOCK | ||
119 | /* Out of line rw-locking implementation. */ | 118 | /* Out of line rw-locking implementation. */ |
120 | EXPORT_SYMBOL(__read_lock); | 119 | EXPORT_SYMBOL(__read_lock); |
121 | EXPORT_SYMBOL(__read_unlock); | 120 | EXPORT_SYMBOL(__read_unlock); |
122 | EXPORT_SYMBOL(__write_lock); | 121 | EXPORT_SYMBOL(__write_lock); |
123 | EXPORT_SYMBOL(__write_unlock); | 122 | EXPORT_SYMBOL(__write_unlock); |
124 | EXPORT_SYMBOL(__write_trylock); | 123 | EXPORT_SYMBOL(__write_trylock); |
125 | /* Out of line spin-locking implementation. */ | ||
126 | EXPORT_SYMBOL(_raw_spin_lock); | ||
127 | EXPORT_SYMBOL(_raw_spin_lock_flags); | ||
128 | #endif | ||
129 | 124 | ||
130 | /* Hard IRQ locking */ | 125 | /* Hard IRQ locking */ |
131 | EXPORT_SYMBOL(synchronize_irq); | 126 | EXPORT_SYMBOL(synchronize_irq); |
@@ -403,12 +398,3 @@ EXPORT_SYMBOL(xor_vis_4); | |||
403 | EXPORT_SYMBOL(xor_vis_5); | 398 | EXPORT_SYMBOL(xor_vis_5); |
404 | 399 | ||
405 | EXPORT_SYMBOL(prom_palette); | 400 | EXPORT_SYMBOL(prom_palette); |
406 | |||
407 | /* memory barriers */ | ||
408 | EXPORT_SYMBOL(mb); | ||
409 | EXPORT_SYMBOL(rmb); | ||
410 | EXPORT_SYMBOL(wmb); | ||
411 | EXPORT_SYMBOL(membar_storeload); | ||
412 | EXPORT_SYMBOL(membar_storeload_storestore); | ||
413 | EXPORT_SYMBOL(membar_storeload_loadload); | ||
414 | EXPORT_SYMBOL(membar_storestore_loadstore); | ||
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile index 6201f1040982..d968aebe83b2 100644 --- a/arch/sparc64/lib/Makefile +++ b/arch/sparc64/lib/Makefile | |||
@@ -12,9 +12,8 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \ | |||
12 | U1memcpy.o U1copy_from_user.o U1copy_to_user.o \ | 12 | U1memcpy.o U1copy_from_user.o U1copy_to_user.o \ |
13 | U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ | 13 | U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ |
14 | copy_in_user.o user_fixup.o memmove.o \ | 14 | copy_in_user.o user_fixup.o memmove.o \ |
15 | mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o mb.o | 15 | mcount.o ipcsum.o rwsem.o xor.o find_bit.o delay.o |
16 | 16 | ||
17 | lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o | ||
18 | lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o | 17 | lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o |
19 | 18 | ||
20 | obj-y += iomap.o | 19 | obj-y += iomap.o |
diff --git a/arch/sparc64/lib/debuglocks.c b/arch/sparc64/lib/debuglocks.c deleted file mode 100644 index f5f0b5586f01..000000000000 --- a/arch/sparc64/lib/debuglocks.c +++ /dev/null | |||
@@ -1,366 +0,0 @@ | |||
1 | /* $Id: debuglocks.c,v 1.9 2001/11/17 00:10:48 davem Exp $ | ||
2 | * debuglocks.c: Debugging versions of SMP locking primitives. | ||
3 | * | ||
4 | * Copyright (C) 1998 David S. Miller (davem@redhat.com) | ||
5 | */ | ||
6 | |||
7 | #include <linux/config.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/spinlock.h> | ||
11 | #include <asm/system.h> | ||
12 | |||
13 | #ifdef CONFIG_SMP | ||
14 | |||
15 | static inline void show (char *str, spinlock_t *lock, unsigned long caller) | ||
16 | { | ||
17 | int cpu = smp_processor_id(); | ||
18 | |||
19 | printk("%s(%p) CPU#%d stuck at %08x, owner PC(%08x):CPU(%x)\n", | ||
20 | str, lock, cpu, (unsigned int) caller, | ||
21 | lock->owner_pc, lock->owner_cpu); | ||
22 | } | ||
23 | |||
24 | static inline void show_read (char *str, rwlock_t *lock, unsigned long caller) | ||
25 | { | ||
26 | int cpu = smp_processor_id(); | ||
27 | |||
28 | printk("%s(%p) CPU#%d stuck at %08x, writer PC(%08x):CPU(%x)\n", | ||
29 | str, lock, cpu, (unsigned int) caller, | ||
30 | lock->writer_pc, lock->writer_cpu); | ||
31 | } | ||
32 | |||
33 | static inline void show_write (char *str, rwlock_t *lock, unsigned long caller) | ||
34 | { | ||
35 | int cpu = smp_processor_id(); | ||
36 | int i; | ||
37 | |||
38 | printk("%s(%p) CPU#%d stuck at %08x\n", | ||
39 | str, lock, cpu, (unsigned int) caller); | ||
40 | printk("Writer: PC(%08x):CPU(%x)\n", | ||
41 | lock->writer_pc, lock->writer_cpu); | ||
42 | printk("Readers:"); | ||
43 | for (i = 0; i < NR_CPUS; i++) | ||
44 | if (lock->reader_pc[i]) | ||
45 | printk(" %d[%08x]", i, lock->reader_pc[i]); | ||
46 | printk("\n"); | ||
47 | } | ||
48 | |||
49 | #undef INIT_STUCK | ||
50 | #define INIT_STUCK 100000000 | ||
51 | |||
52 | void _do_spin_lock(spinlock_t *lock, char *str, unsigned long caller) | ||
53 | { | ||
54 | unsigned long val; | ||
55 | int stuck = INIT_STUCK; | ||
56 | int cpu = get_cpu(); | ||
57 | int shown = 0; | ||
58 | |||
59 | again: | ||
60 | __asm__ __volatile__("ldstub [%1], %0" | ||
61 | : "=r" (val) | ||
62 | : "r" (&(lock->lock)) | ||
63 | : "memory"); | ||
64 | membar_storeload_storestore(); | ||
65 | if (val) { | ||
66 | while (lock->lock) { | ||
67 | if (!--stuck) { | ||
68 | if (shown++ <= 2) | ||
69 | show(str, lock, caller); | ||
70 | stuck = INIT_STUCK; | ||
71 | } | ||
72 | rmb(); | ||
73 | } | ||
74 | goto again; | ||
75 | } | ||
76 | lock->owner_pc = ((unsigned int)caller); | ||
77 | lock->owner_cpu = cpu; | ||
78 | current->thread.smp_lock_count++; | ||
79 | current->thread.smp_lock_pc = ((unsigned int)caller); | ||
80 | |||
81 | put_cpu(); | ||
82 | } | ||
83 | |||
84 | int _do_spin_trylock(spinlock_t *lock, unsigned long caller) | ||
85 | { | ||
86 | unsigned long val; | ||
87 | int cpu = get_cpu(); | ||
88 | |||
89 | __asm__ __volatile__("ldstub [%1], %0" | ||
90 | : "=r" (val) | ||
91 | : "r" (&(lock->lock)) | ||
92 | : "memory"); | ||
93 | membar_storeload_storestore(); | ||
94 | if (!val) { | ||
95 | lock->owner_pc = ((unsigned int)caller); | ||
96 | lock->owner_cpu = cpu; | ||
97 | current->thread.smp_lock_count++; | ||
98 | current->thread.smp_lock_pc = ((unsigned int)caller); | ||
99 | } | ||
100 | |||
101 | put_cpu(); | ||
102 | |||
103 | return val == 0; | ||
104 | } | ||
105 | |||
106 | void _do_spin_unlock(spinlock_t *lock) | ||
107 | { | ||
108 | lock->owner_pc = 0; | ||
109 | lock->owner_cpu = NO_PROC_ID; | ||
110 | membar_storestore_loadstore(); | ||
111 | lock->lock = 0; | ||
112 | current->thread.smp_lock_count--; | ||
113 | } | ||
114 | |||
115 | /* Keep INIT_STUCK the same... */ | ||
116 | |||
117 | void _do_read_lock(rwlock_t *rw, char *str, unsigned long caller) | ||
118 | { | ||
119 | unsigned long val; | ||
120 | int stuck = INIT_STUCK; | ||
121 | int cpu = get_cpu(); | ||
122 | int shown = 0; | ||
123 | |||
124 | wlock_again: | ||
125 | /* Wait for any writer to go away. */ | ||
126 | while (((long)(rw->lock)) < 0) { | ||
127 | if (!--stuck) { | ||
128 | if (shown++ <= 2) | ||
129 | show_read(str, rw, caller); | ||
130 | stuck = INIT_STUCK; | ||
131 | } | ||
132 | rmb(); | ||
133 | } | ||
134 | /* Try once to increment the counter. */ | ||
135 | __asm__ __volatile__( | ||
136 | " ldx [%0], %%g1\n" | ||
137 | " brlz,a,pn %%g1, 2f\n" | ||
138 | " mov 1, %0\n" | ||
139 | " add %%g1, 1, %%g7\n" | ||
140 | " casx [%0], %%g1, %%g7\n" | ||
141 | " sub %%g1, %%g7, %0\n" | ||
142 | "2:" : "=r" (val) | ||
143 | : "0" (&(rw->lock)) | ||
144 | : "g1", "g7", "memory"); | ||
145 | membar_storeload_storestore(); | ||
146 | if (val) | ||
147 | goto wlock_again; | ||
148 | rw->reader_pc[cpu] = ((unsigned int)caller); | ||
149 | current->thread.smp_lock_count++; | ||
150 | current->thread.smp_lock_pc = ((unsigned int)caller); | ||
151 | |||
152 | put_cpu(); | ||
153 | } | ||
154 | |||
155 | void _do_read_unlock(rwlock_t *rw, char *str, unsigned long caller) | ||
156 | { | ||
157 | unsigned long val; | ||
158 | int stuck = INIT_STUCK; | ||
159 | int cpu = get_cpu(); | ||
160 | int shown = 0; | ||
161 | |||
162 | /* Drop our identity _first_. */ | ||
163 | rw->reader_pc[cpu] = 0; | ||
164 | current->thread.smp_lock_count--; | ||
165 | runlock_again: | ||
166 | /* Spin trying to decrement the counter using casx. */ | ||
167 | __asm__ __volatile__( | ||
168 | " membar #StoreLoad | #LoadLoad\n" | ||
169 | " ldx [%0], %%g1\n" | ||
170 | " sub %%g1, 1, %%g7\n" | ||
171 | " casx [%0], %%g1, %%g7\n" | ||
172 | " membar #StoreLoad | #StoreStore\n" | ||
173 | " sub %%g1, %%g7, %0\n" | ||
174 | : "=r" (val) | ||
175 | : "0" (&(rw->lock)) | ||
176 | : "g1", "g7", "memory"); | ||
177 | if (val) { | ||
178 | if (!--stuck) { | ||
179 | if (shown++ <= 2) | ||
180 | show_read(str, rw, caller); | ||
181 | stuck = INIT_STUCK; | ||
182 | } | ||
183 | goto runlock_again; | ||
184 | } | ||
185 | |||
186 | put_cpu(); | ||
187 | } | ||
188 | |||
189 | void _do_write_lock(rwlock_t *rw, char *str, unsigned long caller) | ||
190 | { | ||
191 | unsigned long val; | ||
192 | int stuck = INIT_STUCK; | ||
193 | int cpu = get_cpu(); | ||
194 | int shown = 0; | ||
195 | |||
196 | wlock_again: | ||
197 | /* Spin while there is another writer. */ | ||
198 | while (((long)rw->lock) < 0) { | ||
199 | if (!--stuck) { | ||
200 | if (shown++ <= 2) | ||
201 | show_write(str, rw, caller); | ||
202 | stuck = INIT_STUCK; | ||
203 | } | ||
204 | rmb(); | ||
205 | } | ||
206 | |||
207 | /* Try to acuire the write bit. */ | ||
208 | __asm__ __volatile__( | ||
209 | " mov 1, %%g3\n" | ||
210 | " sllx %%g3, 63, %%g3\n" | ||
211 | " ldx [%0], %%g1\n" | ||
212 | " brlz,pn %%g1, 1f\n" | ||
213 | " or %%g1, %%g3, %%g7\n" | ||
214 | " casx [%0], %%g1, %%g7\n" | ||
215 | " membar #StoreLoad | #StoreStore\n" | ||
216 | " ba,pt %%xcc, 2f\n" | ||
217 | " sub %%g1, %%g7, %0\n" | ||
218 | "1: mov 1, %0\n" | ||
219 | "2:" : "=r" (val) | ||
220 | : "0" (&(rw->lock)) | ||
221 | : "g3", "g1", "g7", "memory"); | ||
222 | if (val) { | ||
223 | /* We couldn't get the write bit. */ | ||
224 | if (!--stuck) { | ||
225 | if (shown++ <= 2) | ||
226 | show_write(str, rw, caller); | ||
227 | stuck = INIT_STUCK; | ||
228 | } | ||
229 | goto wlock_again; | ||
230 | } | ||
231 | if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) { | ||
232 | /* Readers still around, drop the write | ||
233 | * lock, spin, and try again. | ||
234 | */ | ||
235 | if (!--stuck) { | ||
236 | if (shown++ <= 2) | ||
237 | show_write(str, rw, caller); | ||
238 | stuck = INIT_STUCK; | ||
239 | } | ||
240 | __asm__ __volatile__( | ||
241 | " mov 1, %%g3\n" | ||
242 | " sllx %%g3, 63, %%g3\n" | ||
243 | "1: ldx [%0], %%g1\n" | ||
244 | " andn %%g1, %%g3, %%g7\n" | ||
245 | " casx [%0], %%g1, %%g7\n" | ||
246 | " cmp %%g1, %%g7\n" | ||
247 | " membar #StoreLoad | #StoreStore\n" | ||
248 | " bne,pn %%xcc, 1b\n" | ||
249 | " nop" | ||
250 | : /* no outputs */ | ||
251 | : "r" (&(rw->lock)) | ||
252 | : "g3", "g1", "g7", "cc", "memory"); | ||
253 | while(rw->lock != 0) { | ||
254 | if (!--stuck) { | ||
255 | if (shown++ <= 2) | ||
256 | show_write(str, rw, caller); | ||
257 | stuck = INIT_STUCK; | ||
258 | } | ||
259 | rmb(); | ||
260 | } | ||
261 | goto wlock_again; | ||
262 | } | ||
263 | |||
264 | /* We have it, say who we are. */ | ||
265 | rw->writer_pc = ((unsigned int)caller); | ||
266 | rw->writer_cpu = cpu; | ||
267 | current->thread.smp_lock_count++; | ||
268 | current->thread.smp_lock_pc = ((unsigned int)caller); | ||
269 | |||
270 | put_cpu(); | ||
271 | } | ||
272 | |||
273 | void _do_write_unlock(rwlock_t *rw, unsigned long caller) | ||
274 | { | ||
275 | unsigned long val; | ||
276 | int stuck = INIT_STUCK; | ||
277 | int shown = 0; | ||
278 | |||
279 | /* Drop our identity _first_ */ | ||
280 | rw->writer_pc = 0; | ||
281 | rw->writer_cpu = NO_PROC_ID; | ||
282 | current->thread.smp_lock_count--; | ||
283 | wlock_again: | ||
284 | __asm__ __volatile__( | ||
285 | " membar #StoreLoad | #LoadLoad\n" | ||
286 | " mov 1, %%g3\n" | ||
287 | " sllx %%g3, 63, %%g3\n" | ||
288 | " ldx [%0], %%g1\n" | ||
289 | " andn %%g1, %%g3, %%g7\n" | ||
290 | " casx [%0], %%g1, %%g7\n" | ||
291 | " membar #StoreLoad | #StoreStore\n" | ||
292 | " sub %%g1, %%g7, %0\n" | ||
293 | : "=r" (val) | ||
294 | : "0" (&(rw->lock)) | ||
295 | : "g3", "g1", "g7", "memory"); | ||
296 | if (val) { | ||
297 | if (!--stuck) { | ||
298 | if (shown++ <= 2) | ||
299 | show_write("write_unlock", rw, caller); | ||
300 | stuck = INIT_STUCK; | ||
301 | } | ||
302 | goto wlock_again; | ||
303 | } | ||
304 | } | ||
305 | |||
306 | int _do_write_trylock(rwlock_t *rw, char *str, unsigned long caller) | ||
307 | { | ||
308 | unsigned long val; | ||
309 | int cpu = get_cpu(); | ||
310 | |||
311 | /* Try to acuire the write bit. */ | ||
312 | __asm__ __volatile__( | ||
313 | " mov 1, %%g3\n" | ||
314 | " sllx %%g3, 63, %%g3\n" | ||
315 | " ldx [%0], %%g1\n" | ||
316 | " brlz,pn %%g1, 1f\n" | ||
317 | " or %%g1, %%g3, %%g7\n" | ||
318 | " casx [%0], %%g1, %%g7\n" | ||
319 | " membar #StoreLoad | #StoreStore\n" | ||
320 | " ba,pt %%xcc, 2f\n" | ||
321 | " sub %%g1, %%g7, %0\n" | ||
322 | "1: mov 1, %0\n" | ||
323 | "2:" : "=r" (val) | ||
324 | : "0" (&(rw->lock)) | ||
325 | : "g3", "g1", "g7", "memory"); | ||
326 | |||
327 | if (val) { | ||
328 | put_cpu(); | ||
329 | return 0; | ||
330 | } | ||
331 | |||
332 | if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) { | ||
333 | /* Readers still around, drop the write | ||
334 | * lock, return failure. | ||
335 | */ | ||
336 | __asm__ __volatile__( | ||
337 | " mov 1, %%g3\n" | ||
338 | " sllx %%g3, 63, %%g3\n" | ||
339 | "1: ldx [%0], %%g1\n" | ||
340 | " andn %%g1, %%g3, %%g7\n" | ||
341 | " casx [%0], %%g1, %%g7\n" | ||
342 | " cmp %%g1, %%g7\n" | ||
343 | " membar #StoreLoad | #StoreStore\n" | ||
344 | " bne,pn %%xcc, 1b\n" | ||
345 | " nop" | ||
346 | : /* no outputs */ | ||
347 | : "r" (&(rw->lock)) | ||
348 | : "g3", "g1", "g7", "cc", "memory"); | ||
349 | |||
350 | put_cpu(); | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | /* We have it, say who we are. */ | ||
356 | rw->writer_pc = ((unsigned int)caller); | ||
357 | rw->writer_cpu = cpu; | ||
358 | current->thread.smp_lock_count++; | ||
359 | current->thread.smp_lock_pc = ((unsigned int)caller); | ||
360 | |||
361 | put_cpu(); | ||
362 | |||
363 | return 1; | ||
364 | } | ||
365 | |||
366 | #endif /* CONFIG_SMP */ | ||
diff --git a/arch/sparc64/lib/mb.S b/arch/sparc64/lib/mb.S deleted file mode 100644 index 4004f748619f..000000000000 --- a/arch/sparc64/lib/mb.S +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* mb.S: Out of line memory barriers. | ||
2 | * | ||
3 | * Copyright (C) 2005 David S. Miller (davem@davemloft.net) | ||
4 | */ | ||
5 | |||
6 | /* These are here in an effort to more fully work around | ||
7 | * Spitfire Errata #51. Essentially, if a memory barrier | ||
8 | * occurs soon after a mispredicted branch, the chip can stop | ||
9 | * executing instructions until a trap occurs. Therefore, if | ||
10 | * interrupts are disabled, the chip can hang forever. | ||
11 | * | ||
12 | * It used to be believed that the memory barrier had to be | ||
13 | * right in the delay slot, but a case has been traced | ||
14 | * recently wherein the memory barrier was one instruction | ||
15 | * after the branch delay slot and the chip still hung. The | ||
16 | * offending sequence was the following in sym_wakeup_done() | ||
17 | * of the sym53c8xx_2 driver: | ||
18 | * | ||
19 | * call sym_ccb_from_dsa, 0 | ||
20 | * movge %icc, 0, %l0 | ||
21 | * brz,pn %o0, .LL1303 | ||
22 | * mov %o0, %l2 | ||
23 | * membar #LoadLoad | ||
24 | * | ||
25 | * The branch has to be mispredicted for the bug to occur. | ||
26 | * Therefore, we put the memory barrier explicitly into a | ||
27 | * "branch always, predicted taken" delay slot to avoid the | ||
28 | * problem case. | ||
29 | */ | ||
30 | |||
31 | .text | ||
32 | |||
33 | 99: retl | ||
34 | nop | ||
35 | |||
36 | .globl mb | ||
37 | mb: ba,pt %xcc, 99b | ||
38 | membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad | ||
39 | .size mb, .-mb | ||
40 | |||
41 | .globl rmb | ||
42 | rmb: ba,pt %xcc, 99b | ||
43 | membar #LoadLoad | ||
44 | .size rmb, .-rmb | ||
45 | |||
46 | .globl wmb | ||
47 | wmb: ba,pt %xcc, 99b | ||
48 | membar #StoreStore | ||
49 | .size wmb, .-wmb | ||
50 | |||
51 | .globl membar_storeload | ||
52 | membar_storeload: | ||
53 | ba,pt %xcc, 99b | ||
54 | membar #StoreLoad | ||
55 | .size membar_storeload, .-membar_storeload | ||
56 | |||
57 | .globl membar_storeload_storestore | ||
58 | membar_storeload_storestore: | ||
59 | ba,pt %xcc, 99b | ||
60 | membar #StoreLoad | #StoreStore | ||
61 | .size membar_storeload_storestore, .-membar_storeload_storestore | ||
62 | |||
63 | .globl membar_storeload_loadload | ||
64 | membar_storeload_loadload: | ||
65 | ba,pt %xcc, 99b | ||
66 | membar #StoreLoad | #LoadLoad | ||
67 | .size membar_storeload_loadload, .-membar_storeload_loadload | ||
68 | |||
69 | .globl membar_storestore_loadstore | ||
70 | membar_storestore_loadstore: | ||
71 | ba,pt %xcc, 99b | ||
72 | membar #StoreStore | #LoadStore | ||
73 | .size membar_storestore_loadstore, .-membar_storestore_loadstore | ||
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c index cac0a1cf0050..be0a054e3ed6 100644 --- a/arch/sparc64/solaris/ioctl.c +++ b/arch/sparc64/solaris/ioctl.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
25 | #include <linux/mtio.h> | 25 | #include <linux/mtio.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/rcupdate.h> | ||
27 | #include <linux/compat.h> | 28 | #include <linux/compat.h> |
28 | 29 | ||
29 | #include <net/sock.h> | 30 | #include <net/sock.h> |
@@ -293,16 +294,18 @@ static struct module_info { | |||
293 | static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) | 294 | static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) |
294 | { | 295 | { |
295 | struct inode *ino; | 296 | struct inode *ino; |
297 | struct fdtable *fdt; | ||
296 | /* I wonder which of these tests are superfluous... --patrik */ | 298 | /* I wonder which of these tests are superfluous... --patrik */ |
297 | spin_lock(¤t->files->file_lock); | 299 | rcu_read_lock(); |
298 | if (! current->files->fd[fd] || | 300 | fdt = files_fdtable(current->files); |
299 | ! current->files->fd[fd]->f_dentry || | 301 | if (! fdt->fd[fd] || |
300 | ! (ino = current->files->fd[fd]->f_dentry->d_inode) || | 302 | ! fdt->fd[fd]->f_dentry || |
303 | ! (ino = fdt->fd[fd]->f_dentry->d_inode) || | ||
301 | ! S_ISSOCK(ino->i_mode)) { | 304 | ! S_ISSOCK(ino->i_mode)) { |
302 | spin_unlock(¤t->files->file_lock); | 305 | rcu_read_unlock(); |
303 | return TBADF; | 306 | return TBADF; |
304 | } | 307 | } |
305 | spin_unlock(¤t->files->file_lock); | 308 | rcu_read_unlock(); |
306 | 309 | ||
307 | switch (cmd & 0xff) { | 310 | switch (cmd & 0xff) { |
308 | case 109: /* SI_SOCKPARAMS */ | 311 | case 109: /* SI_SOCKPARAMS */ |
diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c index 022c80f43392..aaad29c35c83 100644 --- a/arch/sparc64/solaris/timod.c +++ b/arch/sparc64/solaris/timod.c | |||
@@ -143,9 +143,11 @@ static struct T_primsg *timod_mkctl(int size) | |||
143 | static void timod_wake_socket(unsigned int fd) | 143 | static void timod_wake_socket(unsigned int fd) |
144 | { | 144 | { |
145 | struct socket *sock; | 145 | struct socket *sock; |
146 | struct fdtable *fdt; | ||
146 | 147 | ||
147 | SOLD("wakeing socket"); | 148 | SOLD("wakeing socket"); |
148 | sock = SOCKET_I(current->files->fd[fd]->f_dentry->d_inode); | 149 | fdt = files_fdtable(current->files); |
150 | sock = SOCKET_I(fdt->fd[fd]->f_dentry->d_inode); | ||
149 | wake_up_interruptible(&sock->wait); | 151 | wake_up_interruptible(&sock->wait); |
150 | read_lock(&sock->sk->sk_callback_lock); | 152 | read_lock(&sock->sk->sk_callback_lock); |
151 | if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) | 153 | if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) |
@@ -157,9 +159,11 @@ static void timod_wake_socket(unsigned int fd) | |||
157 | static void timod_queue(unsigned int fd, struct T_primsg *it) | 159 | static void timod_queue(unsigned int fd, struct T_primsg *it) |
158 | { | 160 | { |
159 | struct sol_socket_struct *sock; | 161 | struct sol_socket_struct *sock; |
162 | struct fdtable *fdt; | ||
160 | 163 | ||
161 | SOLD("queuing primsg"); | 164 | SOLD("queuing primsg"); |
162 | sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; | 165 | fdt = files_fdtable(current->files); |
166 | sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data; | ||
163 | it->next = sock->pfirst; | 167 | it->next = sock->pfirst; |
164 | sock->pfirst = it; | 168 | sock->pfirst = it; |
165 | if (!sock->plast) | 169 | if (!sock->plast) |
@@ -171,9 +175,11 @@ static void timod_queue(unsigned int fd, struct T_primsg *it) | |||
171 | static void timod_queue_end(unsigned int fd, struct T_primsg *it) | 175 | static void timod_queue_end(unsigned int fd, struct T_primsg *it) |
172 | { | 176 | { |
173 | struct sol_socket_struct *sock; | 177 | struct sol_socket_struct *sock; |
178 | struct fdtable *fdt; | ||
174 | 179 | ||
175 | SOLD("queuing primsg at end"); | 180 | SOLD("queuing primsg at end"); |
176 | sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; | 181 | fdt = files_fdtable(current->files); |
182 | sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data; | ||
177 | it->next = NULL; | 183 | it->next = NULL; |
178 | if (sock->plast) | 184 | if (sock->plast) |
179 | sock->plast->next = it; | 185 | sock->plast->next = it; |
@@ -344,6 +350,7 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len, | |||
344 | char *buf; | 350 | char *buf; |
345 | struct file *filp; | 351 | struct file *filp; |
346 | struct inode *ino; | 352 | struct inode *ino; |
353 | struct fdtable *fdt; | ||
347 | struct sol_socket_struct *sock; | 354 | struct sol_socket_struct *sock; |
348 | mm_segment_t old_fs = get_fs(); | 355 | mm_segment_t old_fs = get_fs(); |
349 | long args[6]; | 356 | long args[6]; |
@@ -351,7 +358,9 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len, | |||
351 | (int (*)(int, unsigned long __user *))SYS(socketcall); | 358 | (int (*)(int, unsigned long __user *))SYS(socketcall); |
352 | int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) = | 359 | int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) = |
353 | (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto); | 360 | (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto); |
354 | filp = current->files->fd[fd]; | 361 | |
362 | fdt = files_fdtable(current->files); | ||
363 | filp = fdt->fd[fd]; | ||
355 | ino = filp->f_dentry->d_inode; | 364 | ino = filp->f_dentry->d_inode; |
356 | sock = (struct sol_socket_struct *)filp->private_data; | 365 | sock = (struct sol_socket_struct *)filp->private_data; |
357 | SOLD("entry"); | 366 | SOLD("entry"); |
@@ -620,6 +629,7 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us | |||
620 | int oldflags; | 629 | int oldflags; |
621 | struct file *filp; | 630 | struct file *filp; |
622 | struct inode *ino; | 631 | struct inode *ino; |
632 | struct fdtable *fdt; | ||
623 | struct sol_socket_struct *sock; | 633 | struct sol_socket_struct *sock; |
624 | struct T_unitdata_ind udi; | 634 | struct T_unitdata_ind udi; |
625 | mm_segment_t old_fs = get_fs(); | 635 | mm_segment_t old_fs = get_fs(); |
@@ -632,7 +642,8 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us | |||
632 | 642 | ||
633 | SOLD("entry"); | 643 | SOLD("entry"); |
634 | SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); | 644 | SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); |
635 | filp = current->files->fd[fd]; | 645 | fdt = files_fdtable(current->files); |
646 | filp = fdt->fd[fd]; | ||
636 | ino = filp->f_dentry->d_inode; | 647 | ino = filp->f_dentry->d_inode; |
637 | sock = (struct sol_socket_struct *)filp->private_data; | 648 | sock = (struct sol_socket_struct *)filp->private_data; |
638 | SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL)); | 649 | SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL)); |
@@ -844,12 +855,14 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) | |||
844 | int __user *flgptr; | 855 | int __user *flgptr; |
845 | int flags; | 856 | int flags; |
846 | int error = -EBADF; | 857 | int error = -EBADF; |
858 | struct fdtable *fdt; | ||
847 | 859 | ||
848 | SOLD("entry"); | 860 | SOLD("entry"); |
849 | lock_kernel(); | 861 | lock_kernel(); |
850 | if(fd >= NR_OPEN) goto out; | 862 | if(fd >= NR_OPEN) goto out; |
851 | 863 | ||
852 | filp = current->files->fd[fd]; | 864 | fdt = files_fdtable(current->files); |
865 | filp = fdt->fd[fd]; | ||
853 | if(!filp) goto out; | 866 | if(!filp) goto out; |
854 | 867 | ||
855 | ino = filp->f_dentry->d_inode; | 868 | ino = filp->f_dentry->d_inode; |
@@ -910,12 +923,14 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) | |||
910 | struct strbuf ctl, dat; | 923 | struct strbuf ctl, dat; |
911 | int flags = (int) arg3; | 924 | int flags = (int) arg3; |
912 | int error = -EBADF; | 925 | int error = -EBADF; |
926 | struct fdtable *fdt; | ||
913 | 927 | ||
914 | SOLD("entry"); | 928 | SOLD("entry"); |
915 | lock_kernel(); | 929 | lock_kernel(); |
916 | if(fd >= NR_OPEN) goto out; | 930 | if(fd >= NR_OPEN) goto out; |
917 | 931 | ||
918 | filp = current->files->fd[fd]; | 932 | fdt = files_fdtable(current->files); |
933 | filp = fdt->fd[fd]; | ||
919 | if(!filp) goto out; | 934 | if(!filp) goto out; |
920 | 935 | ||
921 | ino = filp->f_dentry->d_inode; | 936 | ino = filp->f_dentry->d_inode; |