boot.c (17a5bbb44df9a4a79166332bc26e2d8ca6bd8fa8) | boot.c (4cbca7d9b4de5ecf6a8447b2eba89d591717f6c4) |
---|---|
1/* 2 * ARM kernel loader. 3 * 4 * Copyright (c) 2006-2007 CodeSourcery. 5 * Written by Paul Brook 6 * 7 * This code is licensed under the GPL. 8 */ --- 371 unchanged lines hidden (view full) --- 380 s = info->kernel_cmdline; 381 if (s) { 382 cpu_physical_memory_write(p, s, strlen(s) + 1); 383 } else { 384 WRITE_WORD(p, 0); 385 } 386} 387 | 1/* 2 * ARM kernel loader. 3 * 4 * Copyright (c) 2006-2007 CodeSourcery. 5 * Written by Paul Brook 6 * 7 * This code is licensed under the GPL. 8 */ --- 371 unchanged lines hidden (view full) --- 380 s = info->kernel_cmdline; 381 if (s) { 382 cpu_physical_memory_write(p, s, strlen(s) + 1); 383 } else { 384 WRITE_WORD(p, 0); 385 } 386} 387 |
388static void fdt_add_psci_node(void *fdt) 389{ 390 uint32_t cpu_suspend_fn; 391 uint32_t cpu_off_fn; 392 uint32_t cpu_on_fn; 393 uint32_t migrate_fn; 394 ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); 395 const char *psci_method; 396 int64_t psci_conduit; 397 398 psci_conduit = object_property_get_int(OBJECT(armcpu), 399 "psci-conduit", 400 &error_abort); 401 switch (psci_conduit) { 402 case QEMU_PSCI_CONDUIT_DISABLED: 403 return; 404 case QEMU_PSCI_CONDUIT_HVC: 405 psci_method = "hvc"; 406 break; 407 case QEMU_PSCI_CONDUIT_SMC: 408 psci_method = "smc"; 409 break; 410 default: 411 g_assert_not_reached(); 412 } 413 414 qemu_fdt_add_subnode(fdt, "/psci"); 415 if (armcpu->psci_version == 2) { 416 const char comp[] = "arm,psci-0.2\0arm,psci"; 417 qemu_fdt_setprop(fdt, "/psci", "compatible", comp, sizeof(comp)); 418 419 cpu_off_fn = QEMU_PSCI_0_2_FN_CPU_OFF; 420 if (arm_feature(&armcpu->env, ARM_FEATURE_AARCH64)) { 421 cpu_suspend_fn = QEMU_PSCI_0_2_FN64_CPU_SUSPEND; 422 cpu_on_fn = QEMU_PSCI_0_2_FN64_CPU_ON; 423 migrate_fn = QEMU_PSCI_0_2_FN64_MIGRATE; 424 } else { 425 cpu_suspend_fn = QEMU_PSCI_0_2_FN_CPU_SUSPEND; 426 cpu_on_fn = QEMU_PSCI_0_2_FN_CPU_ON; 427 migrate_fn = QEMU_PSCI_0_2_FN_MIGRATE; 428 } 429 } else { 430 qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci"); 431 432 cpu_suspend_fn = QEMU_PSCI_0_1_FN_CPU_SUSPEND; 433 cpu_off_fn = QEMU_PSCI_0_1_FN_CPU_OFF; 434 cpu_on_fn = QEMU_PSCI_0_1_FN_CPU_ON; 435 migrate_fn = QEMU_PSCI_0_1_FN_MIGRATE; 436 } 437 438 /* We adopt the PSCI spec's nomenclature, and use 'conduit' to refer 439 * to the instruction that should be used to invoke PSCI functions. 440 * However, the device tree binding uses 'method' instead, so that is 441 * what we should use here. 442 */ 443 qemu_fdt_setprop_string(fdt, "/psci", "method", psci_method); 444 445 qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend", cpu_suspend_fn); 446 qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", cpu_off_fn); 447 qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", cpu_on_fn); 448 qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn); 449} 450 |
|
388/** 389 * load_dtb() - load a device tree binary image into memory 390 * @addr: the address to load the image at 391 * @binfo: struct describing the boot environment 392 * @addr_limit: upper limit of the available memory area at @addr 393 * 394 * Load a device tree supplied by the machine or by the user with the 395 * '-dtb' command line option, and put it at offset @addr in target --- 140 unchanged lines hidden (view full) --- 536 rc = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", 537 binfo->initrd_start + binfo->initrd_size); 538 if (rc < 0) { 539 fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n"); 540 goto fail; 541 } 542 } 543 | 451/** 452 * load_dtb() - load a device tree binary image into memory 453 * @addr: the address to load the image at 454 * @binfo: struct describing the boot environment 455 * @addr_limit: upper limit of the available memory area at @addr 456 * 457 * Load a device tree supplied by the machine or by the user with the 458 * '-dtb' command line option, and put it at offset @addr in target --- 140 unchanged lines hidden (view full) --- 599 rc = qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", 600 binfo->initrd_start + binfo->initrd_size); 601 if (rc < 0) { 602 fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n"); 603 goto fail; 604 } 605 } 606 |
607 fdt_add_psci_node(fdt); 608 |
|
544 if (binfo->modify_dtb) { 545 binfo->modify_dtb(binfo, fdt); 546 } 547 548 qemu_fdt_dumpdtb(fdt, size); 549 550 /* Put the DTB into the memory map as a ROM image: this will ensure 551 * the DTB is copied again upon reset, even if addr points into RAM. --- 533 unchanged lines hidden --- | 609 if (binfo->modify_dtb) { 610 binfo->modify_dtb(binfo, fdt); 611 } 612 613 qemu_fdt_dumpdtb(fdt, size); 614 615 /* Put the DTB into the memory map as a ROM image: this will ensure 616 * the DTB is copied again upon reset, even if addr points into RAM. --- 533 unchanged lines hidden --- |