~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to arch/sparc/kernel/ds.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include <linux/reboot.h>
16
16
#include <linux/cpu.h>
17
17
 
 
18
#include <asm/hypervisor.h>
18
19
#include <asm/ldc.h>
19
20
#include <asm/vio.h>
20
21
#include <asm/mdesc.h>
21
22
#include <asm/head.h>
22
23
#include <asm/irq.h>
23
24
 
 
25
#include "kernel.h"
 
26
 
24
27
#define DRV_MODULE_NAME         "ds"
25
28
#define PFX DRV_MODULE_NAME     ": "
26
29
#define DRV_MODULE_VERSION      "1.0"
497
500
        tag->num_records = ncpus;
498
501
 
499
502
        i = 0;
500
 
        for_each_cpu_mask(cpu, *mask) {
 
503
        for_each_cpu(cpu, mask) {
501
504
                ent[i].cpu = cpu;
502
505
                ent[i].result = DR_CPU_RES_OK;
503
506
                ent[i].stat = default_stat;
534
537
        int resp_len, ncpus, cpu;
535
538
        unsigned long flags;
536
539
 
537
 
        ncpus = cpus_weight(*mask);
 
540
        ncpus = cpumask_weight(mask);
538
541
        resp_len = dr_cpu_size_response(ncpus);
539
542
        resp = kzalloc(resp_len, GFP_KERNEL);
540
543
        if (!resp)
547
550
        mdesc_populate_present_mask(mask);
548
551
        mdesc_fill_in_cpu_data(mask);
549
552
 
550
 
        for_each_cpu_mask(cpu, *mask) {
 
553
        for_each_cpu(cpu, mask) {
551
554
                int err;
552
555
 
553
556
                printk(KERN_INFO "ds-%llu: Starting cpu %d...\n",
593
596
        int resp_len, ncpus, cpu;
594
597
        unsigned long flags;
595
598
 
596
 
        ncpus = cpus_weight(*mask);
 
599
        ncpus = cpumask_weight(mask);
597
600
        resp_len = dr_cpu_size_response(ncpus);
598
601
        resp = kzalloc(resp_len, GFP_KERNEL);
599
602
        if (!resp)
603
606
                             resp_len, ncpus, mask,
604
607
                             DR_CPU_STAT_UNCONFIGURED);
605
608
 
606
 
        for_each_cpu_mask(cpu, *mask) {
 
609
        for_each_cpu(cpu, mask) {
607
610
                int err;
608
611
 
609
612
                printk(KERN_INFO "ds-%llu: Shutting down cpu %d...\n",
649
652
 
650
653
        purge_dups(cpu_list, tag->num_records);
651
654
 
652
 
        cpus_clear(mask);
 
655
        cpumask_clear(&mask);
653
656
        for (i = 0; i < tag->num_records; i++) {
654
657
                if (cpu_list[i] == CPU_SENTINEL)
655
658
                        continue;
656
659
 
657
660
                if (cpu_list[i] < nr_cpu_ids)
658
 
                        cpu_set(cpu_list[i], mask);
 
661
                        cpumask_set_cpu(cpu_list[i], &mask);
659
662
        }
660
663
 
661
664
        if (tag->type == DR_CPU_CONFIGURE)
828
831
        }
829
832
}
830
833
 
 
834
static char full_boot_str[256] __attribute__((aligned(32)));
 
835
static int reboot_data_supported;
 
836
 
831
837
void ldom_reboot(const char *boot_command)
832
838
{
833
839
        /* Don't bother with any of this if the boot_command
834
840
         * is empty.
835
841
         */
836
842
        if (boot_command && strlen(boot_command)) {
837
 
                char full_boot_str[256];
 
843
                unsigned long len;
838
844
 
839
845
                strcpy(full_boot_str, "boot ");
840
846
                strcpy(full_boot_str + strlen("boot "), boot_command);
841
 
 
842
 
                ldom_set_var("reboot-command", full_boot_str);
 
847
                len = strlen(full_boot_str);
 
848
 
 
849
                if (reboot_data_supported) {
 
850
                        unsigned long ra = kimage_addr_to_ra(full_boot_str);
 
851
                        unsigned long hv_ret;
 
852
 
 
853
                        hv_ret = sun4v_reboot_data_set(ra, len);
 
854
                        if (hv_ret != HV_EOK)
 
855
                                pr_err("SUN4V: Unable to set reboot data "
 
856
                                       "hv_ret=%lu\n", hv_ret);
 
857
                } else {
 
858
                        ldom_set_var("reboot-command", full_boot_str);
 
859
                }
843
860
        }
844
861
        sun4v_mach_sir();
845
862
}
1237
1254
 
1238
1255
static int __init ds_init(void)
1239
1256
{
 
1257
        unsigned long hv_ret, major, minor;
 
1258
 
 
1259
        if (tlb_type == hypervisor) {
 
1260
                hv_ret = sun4v_get_version(HV_GRP_REBOOT_DATA, &major, &minor);
 
1261
                if (hv_ret == HV_EOK) {
 
1262
                        pr_info("SUN4V: Reboot data supported (maj=%lu,min=%lu).\n",
 
1263
                                major, minor);
 
1264
                        reboot_data_supported = 1;
 
1265
                }
 
1266
        }
1240
1267
        kthread_run(ds_thread, NULL, "kldomd");
1241
1268
 
1242
1269
        return vio_register_driver(&ds_driver);