:: commit dea6b930dc0f0fc65aff7d03d5427b3a88198310

mintsuki <mintsuki@protonmail.com> — 2021-10-31 18:09

parents: 12811d00bc

stivale2: Remove useless arguments to load function

diff --git a/stage23/entry.s3.c b/stage23/entry.s3.c
index d14c3520..72d5a790 100644
--- a/stage23/entry.s3.c
+++ b/stage23/entry.s3.c
@@ -165,16 +165,10 @@ void stage3_common(void) {
         panic("PROTOCOL not specified");
     }
 
-    if (!strcmp(proto, "stivale")) {
+    if (!strcmp(proto, "stivale1") || !strcmp(proto, "stivale")) {
         stivale_load(config, cmdline);
     } else if (!strcmp(proto, "stivale2")) {
-#if bios == 1
-        void *efi_system_table = NULL;
-#elif uefi == 1
-        void *efi_system_table = gST;
-#endif
-
-        stivale2_load(config, cmdline, boot_volume->pxe, efi_system_table);
+        stivale2_load(config, cmdline);
     } else if (!strcmp(proto, "linux")) {
         linux_load(config, cmdline);
     } else if (!strcmp(proto, "chainload")) {
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index a306a003..fd7b61ff 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -75,7 +75,7 @@ uint64_t stivale2_term_callback_ptr = 0;
 void stivale2_term_callback(uint64_t, uint64_t, uint64_t, uint64_t);
 #endif
 
-void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table) {
+void stivale2_load(char *config, char *cmdline) {
     struct file_handle *kernel_file;
 
     char *kernel_path = config_get_value(config, 0, "KERNEL_PATH");
@@ -577,14 +577,12 @@ have_tm_tag:;
     //////////////////////////////////////////////
     // Create PXE struct tag
     //////////////////////////////////////////////
-    if (pxe) {
+    if (boot_volume->pxe) {
         struct stivale2_struct_tag_pxe_server_info *tag = ext_mem_alloc(sizeof(struct stivale2_struct_tag_pxe_server_info));
         tag->tag.identifier = STIVALE2_STRUCT_TAG_PXE_SERVER_INFO;
         tag->server_ip = get_boot_server_info();
         append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
     }
-#else
-    (void)pxe;
 #endif
 
     //////////////////////////////////////////////
@@ -626,16 +624,16 @@ have_tm_tag:;
     //////////////////////////////////////////////
     // Create EFI system table struct tag
     //////////////////////////////////////////////
+#if uefi == 1
     {
-    if (efi_system_table != NULL) {
         struct stivale2_struct_tag_efi_system_table *tag = ext_mem_alloc(sizeof(struct stivale2_struct_tag_efi_system_table));
         tag->tag.identifier = STIVALE2_STRUCT_TAG_EFI_SYSTEM_TABLE_ID;
 
-        tag->system_table = REPORTED_ADDR((uint64_t)(uintptr_t)efi_system_table);
+        tag->system_table = REPORTED_ADDR((uint64_t)(uintptr_t)gST);
 
         append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
     }
-    }
+#endif
 
     bool unmap_null = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_UNMAP_NULL_ID) ? true : false;
 
diff --git a/stage23/protos/stivale2.h b/stage23/protos/stivale2.h
index 61fcb25e..bc1b519d 100644
--- a/stage23/protos/stivale2.h
+++ b/stage23/protos/stivale2.h
@@ -1,8 +1,6 @@
 #ifndef __PROTOS__STIVALE2_H__
 #define __PROTOS__STIVALE2_H__
 
-#include <stdbool.h>
-
-void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table);
+void stivale2_load(char *config, char *cmdline);
 
 #endif
tab: 248 wrap: offon