Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/boot: Split parsing of boot_params into the parse_boot_params() helper function

Makes setup_arch() a bit easier to comprehend.

No functional changes.

Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250214090651.3331663-4-rppt@kernel.org

authored by

Mike Rapoport (Microsoft) and committed by
Ingo Molnar
d45dd0a9 297fb82e

+41 -31
+41 -31
arch/x86/kernel/setup.c
··· 429 429 } 430 430 } 431 431 432 + /* 433 + * Translate the fields of 'struct boot_param' into global variables 434 + * representing these parameters. 435 + */ 436 + static void __init parse_boot_params(void) 437 + { 438 + ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); 439 + screen_info = boot_params.screen_info; 440 + edid_info = boot_params.edid_info; 441 + #ifdef CONFIG_X86_32 442 + apm_info.bios = boot_params.apm_bios_info; 443 + ist_info = boot_params.ist_info; 444 + #endif 445 + saved_video_mode = boot_params.hdr.vid_mode; 446 + bootloader_type = boot_params.hdr.type_of_loader; 447 + if ((bootloader_type >> 4) == 0xe) { 448 + bootloader_type &= 0xf; 449 + bootloader_type |= (boot_params.hdr.ext_loader_type+0x10) << 4; 450 + } 451 + bootloader_version = bootloader_type & 0xf; 452 + bootloader_version |= boot_params.hdr.ext_loader_ver << 4; 453 + 454 + #ifdef CONFIG_BLK_DEV_RAM 455 + rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; 456 + #endif 457 + #ifdef CONFIG_EFI 458 + if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 459 + EFI32_LOADER_SIGNATURE, 4)) { 460 + set_bit(EFI_BOOT, &efi.flags); 461 + } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 462 + EFI64_LOADER_SIGNATURE, 4)) { 463 + set_bit(EFI_BOOT, &efi.flags); 464 + set_bit(EFI_64BIT, &efi.flags); 465 + } 466 + #endif 467 + 468 + if (!boot_params.hdr.root_flags) 469 + root_mountflags &= ~MS_RDONLY; 470 + } 471 + 432 472 static void __init memblock_x86_reserve_range_setup_data(void) 433 473 { 434 474 struct setup_indirect *indirect; ··· 846 806 847 807 setup_olpc_ofw_pgd(); 848 808 849 - ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); 850 - screen_info = boot_params.screen_info; 851 - edid_info = boot_params.edid_info; 852 - #ifdef CONFIG_X86_32 853 - apm_info.bios = boot_params.apm_bios_info; 854 - ist_info = boot_params.ist_info; 855 - #endif 856 - saved_video_mode = boot_params.hdr.vid_mode; 857 - bootloader_type = boot_params.hdr.type_of_loader; 858 - if ((bootloader_type >> 4) == 0xe) { 859 - bootloader_type &= 0xf; 860 - bootloader_type |= (boot_params.hdr.ext_loader_type+0x10) << 4; 861 - } 862 - bootloader_version = bootloader_type & 0xf; 863 - bootloader_version |= boot_params.hdr.ext_loader_ver << 4; 864 - 865 - #ifdef CONFIG_BLK_DEV_RAM 866 - rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; 867 - #endif 868 - #ifdef CONFIG_EFI 869 - if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 870 - EFI32_LOADER_SIGNATURE, 4)) { 871 - set_bit(EFI_BOOT, &efi.flags); 872 - } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 873 - EFI64_LOADER_SIGNATURE, 4)) { 874 - set_bit(EFI_BOOT, &efi.flags); 875 - set_bit(EFI_64BIT, &efi.flags); 876 - } 877 - #endif 809 + parse_boot_params(); 878 810 879 811 x86_init.oem.arch_setup(); 880 812 ··· 870 858 871 859 copy_edd(); 872 860 873 - if (!boot_params.hdr.root_flags) 874 - root_mountflags &= ~MS_RDONLY; 875 861 setup_initial_init_mm(_text, _etext, _edata, (void *)_brk_end); 876 862 877 863 /*