diff options
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r-- | arch/mips/kernel/vpe.c | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 458fccf87c54..9aca871a307f 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/device.h> | ||
32 | #include <linux/module.h> | 33 | #include <linux/module.h> |
33 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
34 | #include <linux/init.h> | 35 | #include <linux/init.h> |
@@ -48,6 +49,7 @@ | |||
48 | #include <asm/cacheflush.h> | 49 | #include <asm/cacheflush.h> |
49 | #include <asm/atomic.h> | 50 | #include <asm/atomic.h> |
50 | #include <asm/cpu.h> | 51 | #include <asm/cpu.h> |
52 | #include <asm/mips_mt.h> | ||
51 | #include <asm/processor.h> | 53 | #include <asm/processor.h> |
52 | #include <asm/system.h> | 54 | #include <asm/system.h> |
53 | #include <asm/vpe.h> | 55 | #include <asm/vpe.h> |
@@ -64,6 +66,7 @@ typedef void *vpe_handle; | |||
64 | 66 | ||
65 | static char module_name[] = "vpe"; | 67 | static char module_name[] = "vpe"; |
66 | static int major; | 68 | static int major; |
69 | static const int minor = 1; /* fixed for now */ | ||
67 | 70 | ||
68 | #ifdef CONFIG_MIPS_APSP_KSPD | 71 | #ifdef CONFIG_MIPS_APSP_KSPD |
69 | static struct kspd_notifications kspd_events; | 72 | static struct kspd_notifications kspd_events; |
@@ -522,7 +525,7 @@ static int (*reloc_handlers[]) (struct module *me, uint32_t *location, | |||
522 | }; | 525 | }; |
523 | 526 | ||
524 | static char *rstrs[] = { | 527 | static char *rstrs[] = { |
525 | [R_MIPS_NONE] = "MIPS_NONE", | 528 | [R_MIPS_NONE] = "MIPS_NONE", |
526 | [R_MIPS_32] = "MIPS_32", | 529 | [R_MIPS_32] = "MIPS_32", |
527 | [R_MIPS_26] = "MIPS_26", | 530 | [R_MIPS_26] = "MIPS_26", |
528 | [R_MIPS_HI16] = "MIPS_HI16", | 531 | [R_MIPS_HI16] = "MIPS_HI16", |
@@ -695,7 +698,7 @@ static void dump_tclist(void) | |||
695 | } | 698 | } |
696 | 699 | ||
697 | /* We are prepared so configure and start the VPE... */ | 700 | /* We are prepared so configure and start the VPE... */ |
698 | int vpe_run(struct vpe * v) | 701 | static int vpe_run(struct vpe * v) |
699 | { | 702 | { |
700 | struct vpe_notifications *n; | 703 | struct vpe_notifications *n; |
701 | unsigned long val, dmt_flag; | 704 | unsigned long val, dmt_flag; |
@@ -713,16 +716,16 @@ int vpe_run(struct vpe * v) | |||
713 | dvpe(); | 716 | dvpe(); |
714 | 717 | ||
715 | if (!list_empty(&v->tc)) { | 718 | if (!list_empty(&v->tc)) { |
716 | if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) { | 719 | if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) { |
717 | printk(KERN_WARNING "VPE loader: TC %d is already in use.\n", | 720 | printk(KERN_WARNING "VPE loader: TC %d is already in use.\n", |
718 | t->index); | 721 | t->index); |
719 | return -ENOEXEC; | 722 | return -ENOEXEC; |
720 | } | 723 | } |
721 | } else { | 724 | } else { |
722 | printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n", | 725 | printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n", |
723 | v->minor); | 726 | v->minor); |
724 | return -ENOEXEC; | 727 | return -ENOEXEC; |
725 | } | 728 | } |
726 | 729 | ||
727 | /* Put MVPE's into 'configuration state' */ | 730 | /* Put MVPE's into 'configuration state' */ |
728 | set_c0_mvpcontrol(MVPCONTROL_VPC); | 731 | set_c0_mvpcontrol(MVPCONTROL_VPC); |
@@ -775,14 +778,14 @@ int vpe_run(struct vpe * v) | |||
775 | 778 | ||
776 | back_to_back_c0_hazard(); | 779 | back_to_back_c0_hazard(); |
777 | 780 | ||
778 | /* Set up the XTC bit in vpeconf0 to point at our tc */ | 781 | /* Set up the XTC bit in vpeconf0 to point at our tc */ |
779 | write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC)) | 782 | write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC)) |
780 | | (t->index << VPECONF0_XTC_SHIFT)); | 783 | | (t->index << VPECONF0_XTC_SHIFT)); |
781 | 784 | ||
782 | back_to_back_c0_hazard(); | 785 | back_to_back_c0_hazard(); |
783 | 786 | ||
784 | /* enable this VPE */ | 787 | /* enable this VPE */ |
785 | write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA); | 788 | write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() | VPECONF0_VPA); |
786 | 789 | ||
787 | /* clear out any left overs from a previous program */ | 790 | /* clear out any left overs from a previous program */ |
788 | write_vpe_c0_status(0); | 791 | write_vpe_c0_status(0); |
@@ -832,7 +835,7 @@ static int find_vpe_symbols(struct vpe * v, Elf_Shdr * sechdrs, | |||
832 | * contents of the program (p)buffer performing relocatations/etc, free's it | 835 | * contents of the program (p)buffer performing relocatations/etc, free's it |
833 | * when finished. | 836 | * when finished. |
834 | */ | 837 | */ |
835 | int vpe_elfload(struct vpe * v) | 838 | static int vpe_elfload(struct vpe * v) |
836 | { | 839 | { |
837 | Elf_Ehdr *hdr; | 840 | Elf_Ehdr *hdr; |
838 | Elf_Shdr *sechdrs; | 841 | Elf_Shdr *sechdrs; |
@@ -1205,7 +1208,7 @@ static ssize_t vpe_write(struct file *file, const char __user * buffer, | |||
1205 | return ret; | 1208 | return ret; |
1206 | } | 1209 | } |
1207 | 1210 | ||
1208 | static struct file_operations vpe_fops = { | 1211 | static const struct file_operations vpe_fops = { |
1209 | .owner = THIS_MODULE, | 1212 | .owner = THIS_MODULE, |
1210 | .open = vpe_open, | 1213 | .open = vpe_open, |
1211 | .release = vpe_release, | 1214 | .release = vpe_release, |
@@ -1365,12 +1368,15 @@ static void kspd_sp_exit( int sp_id) | |||
1365 | } | 1368 | } |
1366 | #endif | 1369 | #endif |
1367 | 1370 | ||
1371 | static struct device *vpe_dev; | ||
1372 | |||
1368 | static int __init vpe_module_init(void) | 1373 | static int __init vpe_module_init(void) |
1369 | { | 1374 | { |
1370 | struct vpe *v = NULL; | 1375 | struct vpe *v = NULL; |
1376 | struct device *dev; | ||
1371 | struct tc *t; | 1377 | struct tc *t; |
1372 | unsigned long val; | 1378 | unsigned long val; |
1373 | int i; | 1379 | int i, err; |
1374 | 1380 | ||
1375 | if (!cpu_has_mipsmt) { | 1381 | if (!cpu_has_mipsmt) { |
1376 | printk("VPE loader: not a MIPS MT capable processor\n"); | 1382 | printk("VPE loader: not a MIPS MT capable processor\n"); |
@@ -1383,6 +1389,14 @@ static int __init vpe_module_init(void) | |||
1383 | return major; | 1389 | return major; |
1384 | } | 1390 | } |
1385 | 1391 | ||
1392 | dev = device_create(mt_class, NULL, MKDEV(major, minor), | ||
1393 | "tc%d", minor); | ||
1394 | if (IS_ERR(dev)) { | ||
1395 | err = PTR_ERR(dev); | ||
1396 | goto out_chrdev; | ||
1397 | } | ||
1398 | vpe_dev = dev; | ||
1399 | |||
1386 | dmt(); | 1400 | dmt(); |
1387 | dvpe(); | 1401 | dvpe(); |
1388 | 1402 | ||
@@ -1478,6 +1492,11 @@ static int __init vpe_module_init(void) | |||
1478 | kspd_events.kspd_sp_exit = kspd_sp_exit; | 1492 | kspd_events.kspd_sp_exit = kspd_sp_exit; |
1479 | #endif | 1493 | #endif |
1480 | return 0; | 1494 | return 0; |
1495 | |||
1496 | out_chrdev: | ||
1497 | unregister_chrdev(major, module_name); | ||
1498 | |||
1499 | return err; | ||
1481 | } | 1500 | } |
1482 | 1501 | ||
1483 | static void __exit vpe_module_exit(void) | 1502 | static void __exit vpe_module_exit(void) |
@@ -1490,6 +1509,7 @@ static void __exit vpe_module_exit(void) | |||
1490 | } | 1509 | } |
1491 | } | 1510 | } |
1492 | 1511 | ||
1512 | device_destroy(mt_class, MKDEV(major, minor)); | ||
1493 | unregister_chrdev(major, module_name); | 1513 | unregister_chrdev(major, module_name); |
1494 | } | 1514 | } |
1495 | 1515 | ||