Updated diff below now that the first bits got committed.

gopi can be used safely instead of an extra info struct, so munge it.

Declaring the gop and gopi strucutures globally makes things easier in
preparation for the next commit.

Both changes also improve consistency with regard to other structures
like ei, di and conout as well.

---
 sys/arch/amd64/stand/efiboot/efiboot.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c 
b/sys/arch/amd64/stand/efiboot/efiboot.c
index 2774dfb0ca1..283f9ab356e 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -60,7 +60,7 @@ static void    efi_memprobe_internal(void);
 static void     efi_video_init(void);
 static void     efi_video_reset(void);
 static EFI_STATUS
-                efi_gop_setmode(EFI_GRAPHICS_OUTPUT *gop, int mode);
+                efi_gop_setmode(int mode);
 EFI_STATUS      efi_main(EFI_HANDLE, EFI_SYSTEM_TABLE *);
 
 void (*run_i386)(u_long, u_long, int, int, int, int, int, int, int, int)
@@ -703,13 +703,16 @@ efi_com_putc(dev_t dev, int c)
  * {EFI_,}_ACPI_20_TABLE_GUID or EFI_ACPI_TABLE_GUID means
  * ACPI 2.0 or above.
  */
-static EFI_GUID acpi_guid = ACPI_20_TABLE_GUID;
-static EFI_GUID smbios_guid = SMBIOS_TABLE_GUID;
+static EFI_GUID                         acpi_guid = ACPI_20_TABLE_GUID;
+static EFI_GUID                         smbios_guid = SMBIOS_TABLE_GUID;
+static EFI_GRAPHICS_OUTPUT     *gop;
+static EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
+                               *gopi;
 
 #define        efi_guidcmp(_a, _b)     memcmp((_a), (_b), sizeof(EFI_GUID))
 
 static EFI_STATUS
-efi_gop_setmode(EFI_GRAPHICS_OUTPUT *gop, int mode)
+efi_gop_setmode(int mode)
 {
        EFI_STATUS      status;
 
@@ -725,14 +728,9 @@ efi_makebootargs(void)
 {
        int                      i;
        EFI_STATUS               status;
-       EFI_GRAPHICS_OUTPUT     *gop;
-       EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
-                               *gopi;
        bios_efiinfo_t           ei;
        int                      curmode, bestmode = -1;
        UINTN                    sz, gopsiz, bestsiz = 0;
-       EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
-                               *info;
 
        memset(&ei, 0, sizeof(ei));
        /*
@@ -756,11 +754,11 @@ efi_makebootargs(void)
            (void **)&gop);
        if (!EFI_ERROR(status)) {
                for (i = 0; i < gop->Mode->MaxMode; i++) {
-                       status = EFI_CALL(gop->QueryMode, gop, i, &sz, &info);
+                       status = EFI_CALL(gop->QueryMode, gop, i, &sz, &gopi);
                        if (EFI_ERROR(status))
                                continue;
-                       gopsiz = info->HorizontalResolution *
-                           info->VerticalResolution;
+                       gopsiz = gopi->HorizontalResolution *
+                           gopi->VerticalResolution;
                        if (gopsiz > bestsiz) {
                                bestmode = i;
                                bestsiz = gopsiz;
@@ -768,8 +766,8 @@ efi_makebootargs(void)
                }
                if (bestmode >= 0) {
                        curmode = gop->Mode->Mode;
-                       if (efi_gop_setmode(gop, bestmode) != EFI_SUCCESS)
-                               (void)efi_gop_setmode(gop, curmode);
+                       if (efi_gop_setmode(bestmode) != EFI_SUCCESS)
+                               (void)efi_gop_setmode(curmode);
                }
 
                gopi = gop->Mode->Info;
-- 
2.14.2


Reply via email to