mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
x86/boot changes for v7.3:
- Misc simplifications and cleanups (Thorsten Blum) Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqC314RHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1iIAw//TIQZjw3mST7UIjJiS3YDZEZlYkjyejVi 0FnkZhWomySzIzkJIQlIgWPjgVHI+5mZD7ZDjte0aCc4gRGPnqsxV6os/0QZVdr3 VlDOKdYK0Z31ynE16ceOXV1pHRNyqpD2sDu4sGuszK/oG2EdsBS7RTNkTtIRtnTd uLo3JfYgDs5QgLr6W3Lex8jKvyJCDMCLiHv7BLINnIPZq6G4UdlVufNQONq0qwzs 0hIonKW2WA3/wbG1ffLE/XdJE22K+yY+wdUgzj07CeEve94jX8yY/SS4FYJ+uIWN 5oeup/lIEF/j1JVrH/nAY2aqO0JgIurlkPqYlnrBXIE5hQu5tthNpvu9CFc37Atc FEwcHoSk491vw9JRNucakUs3/b05ujsD0Hi42z8t/3ZpBrfV1oNedcqa5ugdJABR 5IQtAGJz3MlD0GhkkKhSGpfwPCZQeY0BzeZjVLMpA2SK6sDYQMEODK7hUkWRIQ9b Rd2VBRwEw+bOVYSHe7m1LOMToPgdvjulHz+5t6VTm1D1gCiGmv5O6YA2gcw+nPQU vyBsYmUvny7FuF0Gpt3nQRgPZxgzuTs1Kcd2ZdIX57X59rCplOu+N/KKRiAbqC0m BPn+IMT1kUmhwvYvR21n1aEJZGLrf/xsz0cZXAeU8keOgMHy9iCHedu5rV3e6pfu RyYDZA4cwwE= =OiK3 -----END PGP SIGNATURE----- Merge tag 'x86-boot-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 boot updates from Ingo Molnar: - Misc simplifications and cleanups (Thorsten Blum) * tag 'x86-boot-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/boot: Use bool and IS_ENABLED() to simplify query_edd() x86/boot: Use IS_ENABLED() to simplify built-in-or-module checks x86/purgatory: Return bool from verify_sha256_digest()
This commit is contained in:
commit
09d639f1f1
|
|
@ -15,7 +15,7 @@
|
|||
#include <linux/edd.h>
|
||||
#include "string.h"
|
||||
|
||||
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
|
||||
#if IS_ENABLED(CONFIG_EDD)
|
||||
|
||||
/*
|
||||
* Read the MBR (first sector) from a specific device.
|
||||
|
|
@ -120,26 +120,22 @@ static int get_edd_info(u8 devno, struct edd_info *ei)
|
|||
void query_edd(void)
|
||||
{
|
||||
char eddarg[8];
|
||||
int do_mbr = 1;
|
||||
#ifdef CONFIG_EDD_OFF
|
||||
int do_edd = 0;
|
||||
#else
|
||||
int do_edd = 1;
|
||||
#endif
|
||||
int be_quiet;
|
||||
bool do_mbr = true;
|
||||
bool do_edd = !IS_ENABLED(CONFIG_EDD_OFF);
|
||||
bool be_quiet;
|
||||
int devno;
|
||||
struct edd_info ei, *edp;
|
||||
u32 *mbrptr;
|
||||
|
||||
if (cmdline_find_option("edd", eddarg, sizeof(eddarg)) > 0) {
|
||||
if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) {
|
||||
do_edd = 1;
|
||||
do_mbr = 0;
|
||||
do_edd = true;
|
||||
do_mbr = false;
|
||||
}
|
||||
else if (!strcmp(eddarg, "off"))
|
||||
do_edd = 0;
|
||||
do_edd = false;
|
||||
else if (!strcmp(eddarg, "on"))
|
||||
do_edd = 1;
|
||||
do_edd = true;
|
||||
}
|
||||
|
||||
be_quiet = cmdline_find_option_bool("quiet");
|
||||
|
|
|
|||
|
|
@ -164,14 +164,12 @@ void main(void)
|
|||
query_ist();
|
||||
|
||||
/* Query APM information */
|
||||
#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
|
||||
query_apm_bios();
|
||||
#endif
|
||||
if (IS_ENABLED(CONFIG_APM))
|
||||
query_apm_bios();
|
||||
|
||||
/* Query EDD information */
|
||||
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
|
||||
query_edd();
|
||||
#endif
|
||||
if (IS_ENABLED(CONFIG_EDD))
|
||||
query_edd();
|
||||
|
||||
/* Set the video mode */
|
||||
set_video();
|
||||
|
|
|
|||
|
|
@ -120,8 +120,7 @@ struct cpuinfo_x86 new_cpu_data;
|
|||
struct apm_info apm_info;
|
||||
EXPORT_SYMBOL(apm_info);
|
||||
|
||||
#if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
|
||||
defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
|
||||
#if IS_ENABLED(CONFIG_X86_SPEEDSTEP_SMI)
|
||||
struct ist_info ist_info;
|
||||
EXPORT_SYMBOL(ist_info);
|
||||
#else
|
||||
|
|
@ -230,7 +229,7 @@ char builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
|
|||
bool builtin_cmdline_added __ro_after_init;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
|
||||
#if IS_ENABLED(CONFIG_EDD)
|
||||
struct edd edd;
|
||||
#ifdef CONFIG_EDD_MODULE
|
||||
EXPORT_SYMBOL(edd);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ u8 purgatory_sha256_digest[SHA256_DIGEST_SIZE] __section(".kexec-purgatory");
|
|||
|
||||
struct kexec_sha_region purgatory_sha_regions[KEXEC_SEGMENT_MAX] __section(".kexec-purgatory");
|
||||
|
||||
static int verify_sha256_digest(void)
|
||||
static bool verify_sha256_digest(void)
|
||||
{
|
||||
struct kexec_sha_region *ptr, *end;
|
||||
u8 digest[SHA256_DIGEST_SIZE];
|
||||
|
|
@ -31,22 +31,16 @@ static int verify_sha256_digest(void)
|
|||
end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
|
||||
|
||||
for (ptr = purgatory_sha_regions; ptr < end; ptr++)
|
||||
sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len);
|
||||
sha256_update(&sctx, (const u8 *)(ptr->start), ptr->len);
|
||||
|
||||
sha256_final(&sctx, digest);
|
||||
|
||||
if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return !memcmp(digest, purgatory_sha256_digest, sizeof(digest));
|
||||
}
|
||||
|
||||
void purgatory(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = verify_sha256_digest();
|
||||
if (ret) {
|
||||
if (!verify_sha256_digest()) {
|
||||
/* loop forever */
|
||||
for (;;)
|
||||
;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user