use RT instead of RS

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-02-16 15:00:20 +03:00
parent d836611308
commit 60b6eb5c33
9 changed files with 74 additions and 55 deletions

View File

@ -352,7 +352,7 @@ BdsLibVariableToOption (
@retval EFI_SUCCESS The boot#### or driver#### have been successfully
registered.
@retval EFI_STATUS Return the status of gRS->SetVariable ().
@retval EFI_STATUS Return the status of gRT->SetVariable ().
**/
EFI_STATUS

View File

@ -138,43 +138,43 @@ LogDataHub(IN EFI_GUID *TypeGuid,
}
// SetVariablesForOSX
/** Installs our runtime services overrides. */
/** Original runtime services. */
EFI_RUNTIME_SERVICES gOrgRS;
EFI_STATUS EFIAPI
OvrSetVariable(
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
)
{
EFI_STATUS Status;
UINTN i;
for (i = 0; i < RtVariablesNum; i++) {
if (!CompareGuid(&RtVariables[i].VarGuid, VendorGuid)) {
continue;
}
if (!RtVariables[i].Name || RtVariables[i].Name[0] == L'*' || StrCmp(VariableName, RtVariables[i].Name) == 0) {
return EFI_SUCCESS;
}
}
Status = gOrgRS.SetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
return Status;
}
EFI_STATUS EFIAPI
OvrRuntimeServices(EFI_RUNTIME_SERVICES *RS)
{
EFI_STATUS Status;
CopyMem(&gOrgRS, RS, sizeof(EFI_RUNTIME_SERVICES));
RS->SetVariable = OvrSetVariable;
RS->Hdr.CRC32 = 0;
Status = gBS->CalculateCrc32(RS, RS->Hdr.HeaderSize, &RS->Hdr.CRC32);
return Status;
/** Installs our runtime services overrides. */
/** Original runtime services. */
EFI_RUNTIME_SERVICES gOrgRS;
EFI_STATUS EFIAPI
OvrSetVariable(
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
)
{
EFI_STATUS Status;
UINTN i;
for (i = 0; i < RtVariablesNum; i++) {
if (!CompareGuid(&RtVariables[i].VarGuid, VendorGuid)) {
continue;
}
if (!RtVariables[i].Name || RtVariables[i].Name[0] == L'*' || StrCmp(VariableName, RtVariables[i].Name) == 0) {
return EFI_SUCCESS;
}
}
Status = gOrgRS.SetVariable(VariableName, VendorGuid, Attributes, DataSize, Data);
return Status;
}
EFI_STATUS EFIAPI
OvrRuntimeServices(EFI_RUNTIME_SERVICES *RS)
{
EFI_STATUS Status;
CopyMem(&gOrgRS, RS, sizeof(EFI_RUNTIME_SERVICES));
RS->SetVariable = OvrSetVariable;
RS->Hdr.CRC32 = 0;
Status = gBS->CalculateCrc32(RS, RS->Hdr.HeaderSize, &RS->Hdr.CRC32);
return Status;
}
/// Sets the volatile and non-volatile variables used by OS X
@ -198,8 +198,8 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
//
// firmware Variables
//
if (RtVariablesNum > 0) {
OvrRuntimeServices(gRS);
if (RtVariablesNum > 0) {
OvrRuntimeServices(gRT);
}
// As found on a real Mac, the system-id variable solely has the BS flag

View File

@ -701,7 +701,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE*)(UINTN)(FadtPointer->FirmwareCtrl);
Facs->FirmwareWakingVector = 0x7F00;
gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
/*
@ -731,7 +731,7 @@ if (FadtPointer == NULL) {
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE*)(UINTN)(FadtPointer->FirmwareCtrl);
Facs->FirmwareWakingVector = 0x7F00;
gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
*/
#define EFI_CPU_EFLAGS_IF 0x200

View File

@ -1063,7 +1063,7 @@ PutNvramPlistToRtVars ()
}
// set RT var: all vars visible in nvram.plist are gEfiAppleBootGuid
/* Status = gRS->SetVariable (
/* Status = gRT->SetVariable (
KeyBuf,
VendorGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,

View File

@ -230,7 +230,7 @@ VOID UpdatePointer()
INTN ScreenRelX;
INTN ScreenRelY;
// Now = gRS->GetTime(&Now, NULL);
// Now = gRT->GetTime(&Now, NULL);
Now = AsmReadTsc();
Status = gPointer.SimplePointerProtocol->GetState(gPointer.SimplePointerProtocol, &tmpState);
if (!EFI_ERROR(Status)) {

View File

@ -76,7 +76,7 @@
extern EFI_HANDLE gImageHandle;
extern EFI_SYSTEM_TABLE* gST;
extern EFI_BOOT_SERVICES* gBS;
extern EFI_RUNTIME_SERVICES* gRS;
extern EFI_RUNTIME_SERVICES* gRT;
#define TAG_ABOUT (1)
#define TAG_RESET (2)

View File

@ -86,7 +86,7 @@ BOOLEAN APFSSupport = FALSE;
//extern EFI_SYSTEM_TABLE* gST;
//extern EFI_BOOT_SERVICES* gBS;
//extern EFI_DXE_SERVICES* gDS;
EFI_RUNTIME_SERVICES* gRS;
//EFI_RUNTIME_SERVICES* gRS;
DRIVERS_FLAGS gDriversFlags; //the initializer is not needed for global variables
@ -121,7 +121,9 @@ extern HDA_OUTPUTS AudioList[20];
extern CHAR8 *AudioOutputNames[];
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
#ifdef __cplusplus
}
#endif
static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
IN CHAR16 *ImageTitle,
@ -1774,9 +1776,9 @@ VOID ResetNvram ()
}
// Attempt warm reboot
// gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
// gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
// Warm reboot may not be supported attempt cold reboot
// gRS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
// gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
// Terminate the screen and just exit
// TerminateScreen();
}
@ -2071,13 +2073,13 @@ RefitMain (IN EFI_HANDLE ImageHandle,
gST = SystemTable;
gImageHandle = ImageHandle;
gBS = SystemTable->BootServices;
gRS = SystemTable->RuntimeServices;
gRT = SystemTable->RuntimeServices;
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
ConsoleInHandle = SystemTable->ConsoleInHandle;
gRS->GetTime(&Now, NULL);
gRT->GetTime(&Now, NULL);
// firmware detection
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
@ -2782,9 +2784,9 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
// }
}
// Attempt warm reboot
gRS->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL);
// Warm reboot may not be supported attempt cold reboot
gRS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
// Terminate the screen and just exit
TerminateScreen();
MainLoopRunning = FALSE;
@ -2794,7 +2796,7 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
case TAG_SHUTDOWN: // It is not Shut Down, it is Exit from Clover
TerminateScreen();
// gRS->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
// gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
MainLoopRunning = FALSE; // just in case we get this far
ReinitDesktop = FALSE;
AfterTool = TRUE;
@ -2983,7 +2985,7 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
// If we end up here, things have gone wrong. Try to reboot, and if that
// fails, go into an endless loop.
//Slice - NO!!! Return to EFI GUI
// gRS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
// gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
// EndlessIdleLoop();
#ifdef ENABLE_SECURE_BOOT
@ -2997,3 +2999,5 @@ destruct_globals_objects(NULL); // That should be done just before quitting clov
}
return EFI_SUCCESS;
}

View File

@ -37,6 +37,16 @@
//#include "Platform.h"
#include "libegint.h" //this includes platform.h
//#include "../include/scroll_images.h"
//#include "../Platform/Platform.h"
#include "../cpp_util/XStringW.h"
#include "../cpp_util/globals_ctor.h"
#include "../cpp_util/globals_dtor.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "Version.h"
//#include "colors.h"
@ -5704,3 +5714,8 @@ UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN INTN DefaultSelection, OUT RE
}
return MenuExit;
}
#ifdef __cplusplus
}
#endif

View File

@ -39,7 +39,7 @@
refit/icns.c
refit/lib.c
refit/lib.h
refit/menu.c
refit/menu.cpp
refit/screen.c
refit/IO.c
refit/IO.h