~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/s390/kernel/setup.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
 
103
103
#include <asm/setup.h>
104
104
 
105
 
static struct resource code_resource = {
106
 
        .name  = "Kernel code",
107
 
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
108
 
};
109
 
 
110
 
static struct resource data_resource = {
111
 
        .name = "Kernel data",
112
 
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
113
 
};
114
 
 
115
105
/*
116
106
 * condev= and conmode= setup parameter.
117
107
 */
315
305
 */
316
306
static int __init early_parse_switch_amode(char *p)
317
307
{
318
 
        if (user_mode != SECONDARY_SPACE_MODE)
319
 
                user_mode = PRIMARY_SPACE_MODE;
 
308
        user_mode = PRIMARY_SPACE_MODE;
320
309
        return 0;
321
310
}
322
311
early_param("switch_amode", early_parse_switch_amode);
325
314
{
326
315
        if (p && strcmp(p, "primary") == 0)
327
316
                user_mode = PRIMARY_SPACE_MODE;
328
 
#ifdef CONFIG_S390_EXEC_PROTECT
329
 
        else if (p && strcmp(p, "secondary") == 0)
330
 
                user_mode = SECONDARY_SPACE_MODE;
331
 
#endif
332
317
        else if (!p || strcmp(p, "home") == 0)
333
318
                user_mode = HOME_SPACE_MODE;
334
319
        else
337
322
}
338
323
early_param("user_mode", early_parse_user_mode);
339
324
 
340
 
#ifdef CONFIG_S390_EXEC_PROTECT
341
 
/*
342
 
 * Enable execute protection?
343
 
 */
344
 
static int __init early_parse_noexec(char *p)
345
 
{
346
 
        if (!strncmp(p, "off", 3))
347
 
                return 0;
348
 
        user_mode = SECONDARY_SPACE_MODE;
349
 
        return 0;
350
 
}
351
 
early_param("noexec", early_parse_noexec);
352
 
#endif /* CONFIG_S390_EXEC_PROTECT */
353
 
 
354
325
static void setup_addressing_mode(void)
355
326
{
356
 
        if (user_mode == SECONDARY_SPACE_MODE) {
357
 
                if (set_amode_and_uaccess(PSW_ASC_SECONDARY,
358
 
                                          PSW32_ASC_SECONDARY))
359
 
                        pr_info("Execute protection active, "
360
 
                                "mvcos available\n");
361
 
                else
362
 
                        pr_info("Execute protection active, "
363
 
                                "mvcos not available\n");
364
 
        } else if (user_mode == PRIMARY_SPACE_MODE) {
 
327
        if (user_mode == PRIMARY_SPACE_MODE) {
365
328
                if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY))
366
329
                        pr_info("Address spaces switched, "
367
330
                                "mvcos available\n");
436
399
        lowcore_ptr[0] = lc;
437
400
}
438
401
 
439
 
static void __init
440
 
setup_resources(void)
 
402
static struct resource code_resource = {
 
403
        .name  = "Kernel code",
 
404
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
 
405
};
 
406
 
 
407
static struct resource data_resource = {
 
408
        .name = "Kernel data",
 
409
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
 
410
};
 
411
 
 
412
static struct resource bss_resource = {
 
413
        .name = "Kernel bss",
 
414
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
 
415
};
 
416
 
 
417
static struct resource __initdata *standard_resources[] = {
 
418
        &code_resource,
 
419
        &data_resource,
 
420
        &bss_resource,
 
421
};
 
422
 
 
423
static void __init setup_resources(void)
441
424
{
442
 
        struct resource *res, *sub_res;
443
 
        int i;
 
425
        struct resource *res, *std_res, *sub_res;
 
426
        int i, j;
444
427
 
445
428
        code_resource.start = (unsigned long) &_text;
446
429
        code_resource.end = (unsigned long) &_etext - 1;
447
430
        data_resource.start = (unsigned long) &_etext;
448
431
        data_resource.end = (unsigned long) &_edata - 1;
 
432
        bss_resource.start = (unsigned long) &__bss_start;
 
433
        bss_resource.end = (unsigned long) &__bss_stop - 1;
449
434
 
450
435
        for (i = 0; i < MEMORY_CHUNKS; i++) {
451
436
                if (!memory_chunk[i].size)
452
437
                        continue;
453
 
                res = alloc_bootmem_low(sizeof(struct resource));
 
438
                res = alloc_bootmem_low(sizeof(*res));
454
439
                res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
455
440
                switch (memory_chunk[i].type) {
456
441
                case CHUNK_READ_WRITE:
464
449
                        res->name = "reserved";
465
450
                }
466
451
                res->start = memory_chunk[i].addr;
467
 
                res->end = memory_chunk[i].addr +  memory_chunk[i].size - 1;
 
452
                res->end = res->start + memory_chunk[i].size - 1;
468
453
                request_resource(&iomem_resource, res);
469
454
 
470
 
                if (code_resource.start >= res->start  &&
471
 
                        code_resource.start <= res->end &&
472
 
                        code_resource.end > res->end) {
473
 
                        sub_res = alloc_bootmem_low(sizeof(struct resource));
474
 
                        memcpy(sub_res, &code_resource,
475
 
                                sizeof(struct resource));
476
 
                        sub_res->end = res->end;
477
 
                        code_resource.start = res->end + 1;
478
 
                        request_resource(res, sub_res);
479
 
                }
480
 
 
481
 
                if (code_resource.start >= res->start &&
482
 
                        code_resource.start <= res->end &&
483
 
                        code_resource.end <= res->end)
484
 
                        request_resource(res, &code_resource);
485
 
 
486
 
                if (data_resource.start >= res->start &&
487
 
                        data_resource.start <= res->end &&
488
 
                        data_resource.end > res->end) {
489
 
                        sub_res = alloc_bootmem_low(sizeof(struct resource));
490
 
                        memcpy(sub_res, &data_resource,
491
 
                                sizeof(struct resource));
492
 
                        sub_res->end = res->end;
493
 
                        data_resource.start = res->end + 1;
494
 
                        request_resource(res, sub_res);
495
 
                }
496
 
 
497
 
                if (data_resource.start >= res->start &&
498
 
                        data_resource.start <= res->end &&
499
 
                        data_resource.end <= res->end)
500
 
                        request_resource(res, &data_resource);
 
455
                for (j = 0; j < ARRAY_SIZE(standard_resources); j++) {
 
456
                        std_res = standard_resources[j];
 
457
                        if (std_res->start < res->start ||
 
458
                            std_res->start > res->end)
 
459
                                continue;
 
460
                        if (std_res->end > res->end) {
 
461
                                sub_res = alloc_bootmem_low(sizeof(*sub_res));
 
462
                                *sub_res = *std_res;
 
463
                                sub_res->end = res->end;
 
464
                                std_res->start = res->end + 1;
 
465
                                request_resource(res, sub_res);
 
466
                        } else {
 
467
                                request_resource(res, std_res);
 
468
                        }
 
469
                }
501
470
        }
502
471
}
503
472
 
712
681
         * and 1ULL<<0 as bit 63. Bits 0-31 contain the same information
713
682
         * as stored by stfl, bits 32-xxx contain additional facilities.
714
683
         * How many facility words are stored depends on the number of
715
 
         * doublewords passed to the instruction. The additional facilites
 
684
         * doublewords passed to the instruction. The additional facilities
716
685
         * are:
717
686
         *   Bit 42: decimal floating point facility is installed
718
687
         *   Bit 44: perform floating point operation facility is installed