move OcQuirks.plist into config.plist and into GUI menu

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-07-15 20:29:27 +03:00
parent 0a5b4bd8bf
commit cd23181296
73 changed files with 754 additions and 553 deletions

View File

@ -1077,5 +1077,46 @@
<key>InjectKexts</key>
<string>Detect</string>
</dict>
<key>Quirks</key>
<dict>
<key>AvoidRuntimeDefrag</key>
<true/>
<key>DevirtualiseMmio</key>
<false/>
<key>DisableSingleUser</key>
<false/>
<key>DisableVariableWrite</key>
<false/>
<key>DiscardHibernateMap</key>
<false/>
<key>EnableSafeModeSlide</key>
<true/>
<key>EnableWriteUnprotector</key>
<true/>
<key>ForceExitBootServices</key>
<false/>
<key>MmioWhitelist</key>
<array/>
<key>ProtectMemoryRegions</key>
<false/>
<key>ProtectSecureBoot</key>
<false/>
<key>ProtectUefiServices</key>
<false/>
<key>ProvideConsoleGopEnable</key>
<true/>
<key>ProvideCustomSlide</key>
<false/>
<key>ProvideMaxSlide</key>
<integer>0</integer>
<key>RebuildAppleMemoryMap</key>
<false/>
<key>SetupVirtualMap</key>
<true/>
<key>SignalAppleOS</key>
<false/>
<key>SyncRuntimePermissions</key>
<true/>
</dict>
</dict>
</plist>

View File

@ -94,7 +94,7 @@ msgstr "В основе лежит EDK2 с учетом последних об
#. type: Content of: <html><body><p><a>
#: Resources/templates/Description.html:23
msgid "https://github.com/CloverHackyColor/CloverBootloader"
msgstr ""
msgstr "https://github.com/CloverHackyColor/CloverBootloader"
#. type: Content of: <html><body><p><b>
#: Resources/templates/Description.html:25
@ -716,7 +716,7 @@ msgstr "Поддержка протокола AppleGraphicsConfig."
#: Resources/templates/Localizable.strings:144
#, no-wrap
msgid "A drop in replacement EFI driver for Clover that replaces AptioMemoryFix and all OsxAptioFix variants. Installs OpenRuntime.efi as dependency"
msgstr ""
msgstr "Драйвер, заменяющий AptioMemoryFix с выбором набора фиксов. Также необходим OpenRuntime.efi для работы в паре."
#. type: "AudioDxe.UEFI_description"
#: Resources/templates/Localizable.strings:145
@ -828,7 +828,7 @@ msgstr "Драйвер 64bit для мыши PS/2."
#: Resources/templates/Localizable.strings:167
#, no-wrap
msgid "Keyboard driver for boot UI support"
msgstr "Драйвер клавиатуры USB поддержкой протокла шифрования, нужен для FileVault2, если у вас USB клавиатура."
msgstr "Драйвер клавиатуры USB поддержкой протокола шифрования, нужен для FileVault2, если у вас USB клавиатура."
#. type: "UsbMouseDxe.UEFI_description"
#: Resources/templates/Localizable.strings:168

View File

@ -127,9 +127,9 @@
gOcReadOnlyVariableGuid = {0xE09B9297, 0x7928, 0x4440, {0x9A, 0xAB, 0xD1, 0xF8, 0x53, 0x6F, 0xBF, 0x0A}}
gOcWriteOnlyVariableGuid = {0xF0B9AF8F, 0x2222, 0x4840, {0x8A, 0x37, 0xEC, 0xF7, 0xCC, 0x8C, 0x12, 0xE1}}
## OcSupport package token space guid
gOpenCorePkgTokenSpaceGuid = { 0x38D40CB0, 0x7E37, 0x4CAA, { 0x91, 0xD3, 0x00, 0x47, 0x70, 0xA8, 0x73, 0x77 }}
gOpenCorePkgTokenSpaceGuid = {0x38D40CB0, 0x7E37, 0x4CAA, {0x91, 0xD3, 0x00, 0x47, 0x70, 0xA8, 0x73, 0x77}}
## Include/Microsoft/Guid/MicrosoftVariable.h
gMicrosoftVariableGuid = {0x77FA9ABD, 0x0359, 0x4D32, {0xBD, 0x60, 0x28, 0xF4, 0xE7, 0x8F, 0x78, 0x4B}}
@ -181,7 +181,7 @@
gAmiEfiKeycodeProtocolGuid = {0x0ADFB62D, 0xFF74, 0x484C, {0x89, 0x44, 0xF8, 0x5C, 0x4B, 0xEA, 0x87, 0xA8}}
gOcFirmwareRuntimeProtocolGuid = {0x570332E4, 0xFC50, 0x4B21, {0xAB, 0xE8, 0xAE, 0x72, 0xF0, 0x5B, 0x4F, 0xF7}}
gOcAfterBootCompatProtocolGuid = {0xC7CBA84E, 0xCC77, 0x461D, {0x9E, 0x3C, 0x6B, 0xE0, 0xCB, 0x79, 0xA7, 0xC1}}
gOcQuirksProtocolGuid = {0x511CE020, 0x0020, 0x0714, {0x20, 0x12, 0x17, 0x38, 0x05, 0x01, 0x02, 0x04}}
## Include/Protocol/AppleBootPolicy.h
gAppleBootPolicyProtocolGuid = {0x62257758, 0x350C, 0x4D0A, {0xB0, 0xBD, 0xF6, 0xBE, 0x2E, 0x1E, 0x27, 0x2C}}

View File

@ -126,6 +126,11 @@ typedef struct OC_ABC_SETTINGS_ {
/// List of handler contexts for ExitBootServicesHandlers.
///
VOID **ExitBootServicesHandlerContexts; //null
//
// labels for GUI for future
//
CHAR8 **MmioWhitelistLabels; //null
BOOLEAN *MmioWhitelistEnabled; //null
} OC_ABC_SETTINGS;
/**

View File

@ -132,7 +132,7 @@ OcSetConsoleMode (
Ensure installed GOP protocol on ConOut handle.
**/
VOID
OcProvideConsoleGop (
OcProvideConsoleGop(
IN BOOLEAN Route
);

View File

@ -1 +0,0 @@
#define OCQUIRKS_PROTOCOL_REVISION 23

View File

@ -271,7 +271,7 @@ ShouldUseCustomSlideOffset (
&AllocatedMapPages
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCABC: Failed to obtain memory map for KASLR - %r\n", Status));
return FALSE;
}
@ -443,7 +443,7 @@ GetVariableCsrActiveConfig (
// Otherwise call the original function.
//
Status = GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCABC: GetVariable csr-active-config - %r\n", Status));
*Config = 0;
@ -514,7 +514,7 @@ GetVariableBootArgs (
&StoredBootArgsSize,
SlideSupport->BootArgs
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
SlideSupport->BootArgs[0] = '\0';
}
@ -592,9 +592,9 @@ HideSlideFromOs (
//
DTInit ((VOID *)(UINTN) (*BootArgs->DeviceTreeP), BootArgs->DeviceTreeLength);
Status = DTLookupEntry (NULL, "/chosen", &Chosen);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = DTGetProperty (Chosen, "boot-args", (VOID **)&ArgsStr, &ArgsSize);
if (!EFI_ERROR (Status) && ArgsSize > 0) {
if (!EFI_ERROR(Status) && ArgsSize > 0) {
OcRemoveArgumentFromCmd (ArgsStr, "slide=");
}
}

View File

@ -225,7 +225,7 @@ PerformRtMemoryVirtualMapping (
Desc->NumberOfPages,
Desc->PhysicalStart
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
RUNTIME_DEBUG ((DEBUG_ERROR, "OCABC: RT mapping failure - %r\n", Status));
return EFI_OUT_OF_RESOURCES;
}
@ -358,9 +358,9 @@ AppleMapPrepareForBooting (
//
DTInit ((VOID *)(UINTN) *BA.DeviceTreeP, BA.DeviceTreeLength);
Status = DTLookupEntry (NULL, "/chosen", &Chosen);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = DTGetProperty (Chosen, "boot-args", (VOID **) &ArgsStr, &ArgsSize);
if (!EFI_ERROR (Status) && ArgsSize > 0) {
if (!EFI_ERROR(Status) && ArgsSize > 0) {
OcRemoveArgumentFromCmd (ArgsStr, "-s");
}
}
@ -500,7 +500,7 @@ AppleMapPrepareMemoryPool (
BootCompat->ServicePtrs.GetMemoryMap
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCABC: Memory pool allocation failure - %r\n", Status));
}
}
@ -546,7 +546,7 @@ AppleMapPrepareBooterState (
GetMemoryMap,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_ERROR,
"OCABC: Failed to allocate system table memory - %r\n",

View File

@ -61,7 +61,7 @@ InstallAbcProtocol (
&Interface
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Ensure we do not run with AptioMemoryFix.
// It also checks for attempts to install this protocol twice.
@ -78,7 +78,7 @@ InstallAbcProtocol (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCABC: protocol install failure - %r\n", Status));
return Status;
}
@ -105,7 +105,7 @@ OcAbcInitialize (
UINTN TotalMemory;
Status = InstallAbcProtocol ();
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}

View File

@ -62,7 +62,7 @@ FixRuntimeAttributes (
Status = BootCompat->ServiceState.FwRuntime->GetExecArea (&Address, &Pages);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
OcRebuildAttributes (Address, BootCompat->ServicePtrs.GetMemoryMap);
}
@ -111,7 +111,7 @@ ForceExitBootServices (
//
Status = ExitBootServices (ImageHandle, MapKey);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
//
// It is too late to free memory map here, but it does not matter, because boot.efi has an old one
// and will freely use the memory.
@ -132,7 +132,7 @@ ForceExitBootServices (
// We have the latest memory map and its key, try again!
//
Status = ExitBootServices (ImageHandle, MapKey);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCABC: ExitBootServices failed twice - %r\n", Status));
}
} else {
@ -140,7 +140,7 @@ ForceExitBootServices (
Status = EFI_INVALID_PARAMETER;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCABC: Waiting 10 secs...\n"));
gBS->Stall (SECONDS_TO_MICROSECONDS (10));
}
@ -355,7 +355,7 @@ OcAllocatePages (
Memory
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FixRuntimeAttributes (BootCompat, MemoryType);
if (BootCompat->ServiceState.AppleBootNestedCount > 0) {
@ -411,7 +411,7 @@ OcFreePages (
Pages
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FixRuntimeAttributes (BootCompat, EfiRuntimeServicesData);
}
@ -460,7 +460,7 @@ OcGetMemoryMap (
return EFI_BUFFER_TOO_SMALL;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -556,7 +556,7 @@ OcAllocatePool (
Buffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FixRuntimeAttributes (BootCompat, PoolType);
}
@ -583,7 +583,7 @@ OcFreePool (
Buffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FixRuntimeAttributes (BootCompat, EfiRuntimeServicesData);
}
@ -664,7 +664,7 @@ OcStartImage (
(VOID *) &OSInfo
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
OSInfo->OSVendor (EFI_OS_INFO_APPLE_VENDOR_NAME);
OSInfo->OSName ("Mac OS X 10.15");
}
@ -793,7 +793,7 @@ OcExitBootServices (
//
// Abort on error.
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -949,7 +949,7 @@ SetGetVariableHookHandler (
(VOID **) &FwRuntime
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (FwRuntime->Revision == OC_FIRMWARE_RUNTIME_REVISION) {
DEBUG ((DEBUG_INFO, "OCABC: Got rendezvous with OpenRuntime r%u\n", OC_FIRMWARE_RUNTIME_REVISION));
DEBUG ((DEBUG_INFO, "OCABC: MAT support is %d\n", OcGetMemoryAttributes (NULL) != NULL));
@ -971,7 +971,7 @@ SetGetVariableHookHandler (
//
// Mark protocol as useable.
//
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
BootCompat->ServiceState.FwRuntime = FwRuntime;
}
}
@ -1034,14 +1034,14 @@ InstallServiceOverrides (
&BootCompat->ServiceState.GetVariableEvent
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = gBS->RegisterProtocolNotify (
&gOcFirmwareRuntimeProtocolGuid,
BootCompat->ServiceState.GetVariableEvent,
&Registration
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->CloseEvent (BootCompat->ServiceState.GetVariableEvent);
}
}

View File

@ -170,7 +170,7 @@ InternalFileExists (
0
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FileHandle->Close (FileHandle);
return EFI_SUCCESS;
}
@ -350,13 +350,13 @@ InternalGetBooterFromBlessedSystemFolderPath (
FreePool (DevicePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: Blessed folder append failed - %r\n", Status));
return Status;
}
Status = InternalFileExists (Root, BooterPath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: Blessed folder %s is missing - %r\n", BooterPath, Status));
return EFI_NOT_FOUND;
}
@ -395,7 +395,7 @@ OcGetBooterFromPredefinedPathList (
Root,
Prefix != NULL ? &PathName[1] : &PathName[0]
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((
DEBUG_BULK_INFO,
"OCBP: Predefined %s %s was found\n",
@ -460,12 +460,12 @@ InternalGetApfsVolumeInfo (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -473,7 +473,7 @@ InternalGetApfsVolumeInfo (
Root->Close (Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return EFI_NOT_FOUND;
}
@ -518,7 +518,7 @@ InternalGetBooterFromApfsVolumePredefinedPathList (
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: Missing partition %s on preboot - %r\n", VolumeDirectoryName, Status));
return Status;
} else {
@ -611,7 +611,7 @@ InternalGetBooterFromApfsPredefinedPathList (
DEBUG ((DEBUG_BULK_INFO, "OCBP: %u filesystems for APFS - %r\n", (UINT32) NumberOfHandles, Status));
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -870,17 +870,17 @@ InternalGetApfsVolumeHandle (
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = InternalGetApfsSpecialFileInfo (Root, NULL, &ContainerInfo);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// FIXME: ApfsVolumeHandle is only returned when a predefined path exists
//
@ -928,20 +928,20 @@ OcBootPolicyGetBootFile (
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = InternalGetBooterFromBlessedSystemFilePath (Root, FilePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = InternalGetBooterFromBlessedSystemFolderPath (Device, Root, FilePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = OcGetBooterFromPredefinedPathList (
Device,
Root,
@ -1004,19 +1004,19 @@ OcBootPolicyGetBootFileEx (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: Missing filesystem - %r\n", Status));
return Status;
}
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: Invalid root volume - %r\n", Status));
return Status;
}
Status = InternalGetApfsSpecialFileInfo (Root, &VolumeInfo, &ContainerInfo);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = EFI_NOT_FOUND;
if ((VolumeInfo->Role & APPLE_APFS_VOLUME_ROLE_PREBOOT) != 0) {
TmpStatus = InternalGetBooterFromBlessedSystemFilePath (Root, FilePath);
@ -1046,9 +1046,9 @@ OcBootPolicyGetBootFileEx (
FreePool (ContainerInfo);
} else {
Status = InternalGetBooterFromBlessedSystemFilePath (Root, FilePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = InternalGetBooterFromBlessedSystemFolderPath (Device, Root, FilePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = OcGetBooterFromPredefinedPathList (
Device,
Root,
@ -1107,12 +1107,12 @@ OcBootPolicyDevicePathToDirPath (
&DevicePath,
Device
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = InternalGetBootPathName (DevicePath, BootPathName);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -1142,7 +1142,7 @@ OcBootPolicyDevicePathToDirPathAndApfsHandle (
BootPathName,
Device
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -1188,7 +1188,7 @@ BootPolicyDevicePathToDirPath (
Device,
ApfsVolumeHandle
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
*BootPathName = NULL;
*Device = NULL;
*ApfsVolumeHandle = NULL;
@ -1257,7 +1257,7 @@ OcBootPolicyGetApfsRecoveryFilePath (
&VolumeHandle
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: APFS recovery boot info failed - %r\n", Status));
return EFI_NOT_FOUND;
}
@ -1277,7 +1277,7 @@ OcBootPolicyGetApfsRecoveryFilePath (
&VolumeRole
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: APFS recovery volume info missing\n"));
return EFI_NOT_FOUND;
}
@ -1290,7 +1290,7 @@ OcBootPolicyGetApfsRecoveryFilePath (
&HandleBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_BULK_INFO, "OCBP: APFS recovery simple fs missing - %r\n", Status));
return Status;
}
@ -1320,7 +1320,7 @@ OcBootPolicyGetApfsRecoveryFilePath (
Status
));
if (EFI_ERROR (Status)
if (EFI_ERROR(Status)
|| VolumeRole2 != APPLE_APFS_VOLUME_ROLE_RECOVERY
|| !CompareGuid (&ContainerGuid2, &ContainerGuid)) {
continue;
@ -1331,12 +1331,12 @@ OcBootPolicyGetApfsRecoveryFilePath (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
Status = FileSystem->OpenVolume (FileSystem, Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -1369,7 +1369,7 @@ OcBootPolicyGetApfsRecoveryFilePath (
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
(*Root)->Close (*Root);
FreePool (FullPathBuffer);
continue;
@ -1478,7 +1478,7 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
&HandleBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -1489,7 +1489,7 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
Status = EFI_OUT_OF_RESOURCES;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (HandleBuffer);
if (VolumeInfo != NULL) {
@ -1514,7 +1514,7 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
&VolumeInfo[NumberOfVolumeInfos].VolumeRole
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -1565,7 +1565,7 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
Status = EFI_NOT_FOUND;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (HandleBuffer);
FreePool (VolumeInfo);
FreePool (ContainerGuids);
@ -1587,12 +1587,12 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -1621,7 +1621,7 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -1656,7 +1656,7 @@ OcBootPolicyGetAllApfsRecoveryFilePath (
FreePool (ContainerGuids);
FreePool (HandleBuffer);
if (!EFI_ERROR (Status) && *NumberOfEntries == 0) {
if (!EFI_ERROR(Status) && *NumberOfEntries == 0) {
Status = EFI_NOT_FOUND;
}
@ -1694,7 +1694,7 @@ OcAppleBootPolicyInstallProtocol (
if (Reinstall) {
Status = OcUninstallAllProtocolInstances (&gAppleBootPolicyProtocolGuid);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
// DEBUG ((DEBUG_ERROR, "OCBP: Uninstall failed: %r\n", Status));
return NULL;
}
@ -1705,7 +1705,7 @@ OcAppleBootPolicyInstallProtocol (
(VOID *) &Protocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return Protocol;
}
}
@ -1718,7 +1718,7 @@ OcAppleBootPolicyInstallProtocol (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}

View File

@ -283,14 +283,14 @@ OcAppleDiskImageInstallBlockIo (
&DiskImageData->BlockIo,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCDI: Failed to install protocols %r\n", Status));
FreePool (DiskImageData);
return NULL;
}
Status = gBS->ConnectController (BlockIoHandle, NULL, NULL, TRUE);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCDI: Failed to connect DMG handle %r\n", Status));
Status = gBS->UninstallMultipleProtocolInterfaces (
@ -301,7 +301,7 @@ OcAppleDiskImageInstallBlockIo (
&DiskImageData->BlockIo,
NULL
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FreePool (DiskImageData);
} else {
DEBUG ((DEBUG_INFO, "OCDI: Failed to uninstall protocols %r\n", Status));
@ -339,7 +339,7 @@ OcAppleDiskImageUninstallBlockIo (
&gEfiBlockIoProtocolGuid,
(VOID **)&BlockIo
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCDI: Invalid handle for Block I/O uninstall\n"));
return;
}
@ -355,7 +355,7 @@ OcAppleDiskImageUninstallBlockIo (
&DiskImageData->DevicePath,
NULL
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FreePool (DiskImageData);
} else {
DEBUG ((

View File

@ -208,7 +208,7 @@ OcAppleDiskImageInitializeFromFile (
ASSERT (File != NULL);
Status = GetFileSize (File, &FileSize);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCDI: Failed to retrieve DMG file size\n"));
return FALSE;
}

View File

@ -281,7 +281,7 @@ OcKeyMapFlush (
Keys
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCKM: GetKeyStrokes failure - %r\n", Status));
break;
}
@ -300,7 +300,7 @@ OcKeyMapFlush (
if (FlushConsole) {
do {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &EfiKey);
} while (!EFI_ERROR (Status));
} while (!EFI_ERROR(Status));
//
// This one is required on APTIO IV after holding OPT key.
@ -353,7 +353,7 @@ InternalContainsKeyStrokes (
DbKeyCodes
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -598,7 +598,7 @@ OcAppleKeyMapInstallProtocols (
if (Reinstall) {
Status = OcUninstallAllProtocolInstances (&gAppleKeyMapDatabaseProtocolGuid);
Status2 = OcUninstallAllProtocolInstances (&gAppleKeyStateProtocolGuid);
if (EFI_ERROR (Status) || EFI_ERROR (Status2)) {
if (EFI_ERROR(Status) || EFI_ERROR (Status2)) {
DEBUG ((DEBUG_ERROR, "OCKM: Uninstall failed: %r/%r\n", Status, Status2));
return NULL;
}
@ -618,11 +618,11 @@ OcAppleKeyMapInstallProtocols (
//
// VMware Fusion has no KeyMapDatabase, and it is intended.
//
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
mKeyMapDatabase = Database;
}
return Aggregator;
} else if (!EFI_ERROR (Status)) {
} else if (!EFI_ERROR(Status)) {
//
// Installed KeyMapDatabase makes no sense, however.
//
@ -658,7 +658,7 @@ OcAppleKeyMapInstallProtocols (
(VOID *)&KeyMapAggregatorData->Aggregator,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (KeyMapAggregatorData);
return NULL;
}

View File

@ -194,7 +194,7 @@ InternalAllocateRemainingSize (
&AllocatedArea
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCRAM: Broken allocator for 0x%Lx in 0x%Lx bytes, rem 0x%Lx - %r\n",
@ -514,7 +514,7 @@ OcAppleRamDiskLoadFile (
while (FileSize > 0 && ExtentSize > 0) {
Status = File->SetPosition (File, FilePosition);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (TmpBuffer);
return FALSE;
}
@ -526,7 +526,7 @@ OcAppleRamDiskLoadFile (
&ReadSize,
TmpBuffer
);
if (EFI_ERROR (Status) || RequestedSize != ReadSize) {
if (EFI_ERROR(Status) || RequestedSize != ReadSize) {
FreePool (TmpBuffer);
return FALSE;
}

View File

@ -56,7 +56,7 @@ OcActivateHibernateWake (
// If legacy boot-switch-vars exists (NVRAM working), then use it.
//
Status = GetVariable2 (L"boot-switch-vars", &gEfiAppleBootGuid, &Value, &Size);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Leave it as is.
//
@ -73,7 +73,7 @@ OcActivateHibernateWake (
&Size,
&Attributes
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (IsDevicePathValid (BootImagePath, Size)) {
DebugPrintDevicePath (
DEBUG_INFO,
@ -140,7 +140,7 @@ OcActivateHibernateWake (
// Prior to 10.13.6.
//
Status = GetVariable2 (L"IOHibernateRTCVariables", &gEfiAppleBootGuid, &Value, &Size);
if (!HasHibernateInfo && !EFI_ERROR (Status) && Size == sizeof (RtcVars)) {
if (!HasHibernateInfo && !EFI_ERROR(Status) && Size == sizeof (RtcVars)) {
CopyMem (RtcRawVars, Value, sizeof (RtcVars));
HasHibernateInfo = RtcVars.signature[0] == 'A'
&& RtcVars.signature[1] == 'A'
@ -159,7 +159,7 @@ OcActivateHibernateWake (
//
// Erase RTC variables in NVRAM.
//
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = gRT->SetVariable (
L"IOHibernateRTCVariables",
&gEfiAppleBootGuid,

View File

@ -259,7 +259,7 @@ OcReadApplePanicLog (
Index
);
Status = GetVariable2 (VariableName, &gEfiAppleBootGuid, &Value, &ValueSize);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
break;
}

View File

@ -147,7 +147,7 @@ OcAppendArgumentToCmd (
Context,
OcPrivilegeAuthorized
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
if (Status != EFI_ABORTED) {
ASSERT (FALSE);
return FALSE;
@ -232,7 +232,7 @@ OcCheckArgumentFromEnv (
BootArgsVar
);
if (!EFI_ERROR (Status) && BootArgsVarLen > 0) {
if (!EFI_ERROR(Status) && BootArgsVarLen > 0) {
//
// Just in case we do not have 0-termination
//

View File

@ -67,7 +67,7 @@ OcPlayAudioFile (
NULL,
(VOID **) &Context->OcAudio
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Context->OcAudio = NULL;
}
}
@ -76,7 +76,7 @@ OcPlayAudioFile (
Status = Context->OcAudio->PlayFile (Context->OcAudio, File, TRUE);
}
if (Fallback && EFI_ERROR (Status)) {
if (Fallback && EFI_ERROR(Status)) {
switch (File) {
case AppleVoiceOverAudioFileBeep:
Status = OcPlayAudioBeep (
@ -157,7 +157,7 @@ OcPlayAudioBeep (
NULL,
(VOID **) &Context->BeepGen
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
}

View File

@ -224,12 +224,12 @@ InternalGetRecoveryOsBooter (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = FileSystem->OpenVolume (FileSystem, &Root);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -275,7 +275,7 @@ InternalGetRecoveryOsBooter (
FreePool (TmpPath);
}
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// This entry should point to a folder with recovery.
// Apple never adds trailing slashes to blessed folder paths.
@ -301,7 +301,7 @@ InternalGetRecoveryOsBooter (
// and we have to copy.
//
Status = SafeFileOpen (Root, &Recovery, L"\\com.apple.recovery.boot", EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Do not do any extra checks for simplicity, as they will be done later either way.
//
@ -374,7 +374,7 @@ OcGetBootEntryLabelImage (
&Device
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -384,7 +384,7 @@ OcGetBootEntryLabelImage (
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (BootDirectoryName);
return Status;
}
@ -444,7 +444,7 @@ OcGetBootEntryIcon (
&Device
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -454,7 +454,7 @@ OcGetBootEntryIcon (
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (BootDirectoryName);
return Status;
}
@ -499,7 +499,7 @@ InternalDescribeBootEntry (
&Device
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -509,7 +509,7 @@ InternalDescribeBootEntry (
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (BootDirectoryName);
return Status;
}
@ -543,7 +543,7 @@ InternalDescribeBootEntry (
if (BootEntry->Type == OC_BOOT_UNKNOWN && BootEntry->IsGeneric) {
DEBUG ((DEBUG_INFO, "OCB: Trying to detect Microsoft BCD\n"));
Status = ReadFileSize (FileSystem, L"\\EFI\\Microsoft\\Boot\\BCD", &BcdSize);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
BootEntry->Type = OC_BOOT_WINDOWS;
}
}

View File

@ -120,7 +120,7 @@ ExpandShortFormBootPath (
&RemainingDevicePath,
&FileSystemHandle
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -148,7 +148,7 @@ ExpandShortFormBootPath (
EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -226,7 +226,7 @@ IsOpenCoreBootloader (
EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
@ -236,7 +236,7 @@ IsOpenCoreBootloader (
sizeof (FileReadMagic),
FileReadMagic
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
@ -460,7 +460,7 @@ AddBootEntryOnFileSystem (
BootEntry->IsExternal = RecoveryPart ? FileSystem->RecoveryFs->External : FileSystem->External;
Status = InternalDescribeBootEntry (BootEntry);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (BootEntry);
return Status;
}
@ -691,7 +691,7 @@ AddBootEntryFromBless (
&gEfiDevicePathProtocolGuid,
(VOID **) &HdDevicePath
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return EFI_UNSUPPORTED;
}
@ -709,9 +709,9 @@ AddBootEntryFromBless (
(VOID **) &SimpleFs
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = SimpleFs->OpenVolume (SimpleFs, &Root);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = OcGetBooterFromPredefinedPathList (
FileSystem->Handle,
Root,
@ -731,7 +731,7 @@ AddBootEntryFromBless (
//
// On failure obtain normal bless paths.
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = OcBootPolicyGetBootFileEx (
FileSystem->Handle,
PredefinedPaths,
@ -743,7 +743,7 @@ AddBootEntryFromBless (
//
// If both custom and normal found nothing, then nothing is blessed.
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -847,7 +847,7 @@ AddBootEntryFromBless (
FreePool (NewDevicePath);
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCB: APFS recovery is not present - %r\n", Status));
continue;
}
@ -886,7 +886,7 @@ AddBootEntryFromBless (
TRUE,
Deduplicate
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (NewDevicePath);
}
}
@ -927,7 +927,7 @@ AddBootEntryFromSelfRecovery (
&DevicePath,
FALSE
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -942,7 +942,7 @@ AddBootEntryFromSelfRecovery (
FALSE
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (DevicePath);
}
@ -1008,9 +1008,9 @@ AddBootEntryFromBootOption (
&DevicePathSize
);
if (EFI_ERROR (Status) || !IsDevicePathValid (DevicePath, DevicePathSize)) {
if (EFI_ERROR(Status) || !IsDevicePathValid (DevicePath, DevicePathSize)) {
DEBUG ((DEBUG_INFO, "OCB: Legacy DP invalid - %r\n", Status));
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FreePool (DevicePath);
}
return EFI_NOT_FOUND;
@ -1179,7 +1179,7 @@ AddBootEntryFromBootOption (
Status = EFI_UNSUPPORTED;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (DevicePath);
}
@ -1311,7 +1311,7 @@ AddFileSystemEntry (
DEBUG_CODE_END ();
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -1451,7 +1451,7 @@ InternalFileSystemForHandle (
}
Status = AddFileSystemEntry (BootContext, FileSystemHandle, &FileSystem);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return FileSystem;
}
@ -1498,7 +1498,7 @@ BuildFileSystemList (
&NoHandles,
&Handles
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return BootContext;
}
@ -1674,7 +1674,7 @@ OcScanForDefaultBootEntry (
DEBUG ((DEBUG_INFO, "OCB: Processing %u blessed list - %r\n", (UINT32) NoHandles, Status));
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < NoHandles; ++Index) {
//
// Do not add filesystems twice.
@ -1688,7 +1688,7 @@ OcScanForDefaultBootEntry (
Handles[Index],
&FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -1794,9 +1794,9 @@ OcLoadBootEntry (
&EntryHandle,
&DmgLoadContext
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = Context->StartImage (BootEntry, EntryHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCB: StartImage failed - %r\n", Status));
//
// Unload dmg if any.

View File

@ -69,7 +69,7 @@ InternalGetBootOptionData (
(VOID **)&LoadOption,
&LoadOptionSize
);
if (EFI_ERROR (Status) || (LoadOptionSize < sizeof (*LoadOption))) {
if (EFI_ERROR(Status) || (LoadOptionSize < sizeof (*LoadOption))) {
return NULL;
}
@ -178,7 +178,7 @@ InternalDebugBootEnvironment (
(VOID **)&UefiDevicePath,
&UefiDevicePathSize
);
if (!EFI_ERROR (Status) && IsDevicePathValid (UefiDevicePath, UefiDevicePathSize)) {
if (!EFI_ERROR(Status) && IsDevicePathValid (UefiDevicePath, UefiDevicePathSize)) {
DevicePathText = ConvertDevicePathToText (UefiDevicePath, FALSE, FALSE);
if (DevicePathText != NULL) {
DEBUG ((DEBUG_INFO, "OCB: %s = %s\n", AppleDebugVariables[Index], DevicePathText));
@ -381,7 +381,7 @@ OcGetBootOrder (
&VariableSize,
&BootNext
);
if (!EFI_ERROR (Status) && VariableSize == sizeof (BootNext)) {
if (!EFI_ERROR(Status) && VariableSize == sizeof (BootNext)) {
if (HasBootNext != NULL) {
*HasBootNext = TRUE;
}
@ -412,17 +412,17 @@ OcGetBootOrder (
&VariableSize,
BootOrder + (UINTN) WithBootNext
);
if (EFI_ERROR (Status)
if (EFI_ERROR(Status)
|| VariableSize < sizeof (*BootOrder)
|| VariableSize % sizeof (*BootOrder) != 0) {
FreePool (BootOrder);
Status = EFI_UNSUPPORTED;
}
} else if (!EFI_ERROR (Status)) {
} else if (!EFI_ERROR(Status)) {
Status = EFI_NOT_FOUND;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
if (WithBootNext) {
BootOrder = AllocateCopyPool (sizeof (BootNext), &BootNext);
if (BootOrder != NULL) {
@ -596,7 +596,7 @@ OcSetDefaultBootEntry (
&DeviceHandle
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
MatchedEntry = InternalGetBootEntryByDevicePath (
Entry,
1,
@ -641,7 +641,7 @@ OcSetDefaultBootEntry (
FreePool (LoadOption);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCB: Failed to set default entry Boot0080 - %r\n",
@ -708,7 +708,7 @@ OcSetDefaultBootEntry (
FreePool (NewBootOrder);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCB: Failed to set default BootOrder - %r\n",
@ -746,7 +746,7 @@ InternalRegisterBootOption (
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCB: Failed to obtain device path for boot option - %r\n", Status));
return Status;
}
@ -804,7 +804,7 @@ InternalRegisterBootOption (
FreePool (Option);
FreePool (DevicePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCB: Failed to store boot option - %r\n", Status));
return Status;
}
@ -841,9 +841,9 @@ InternalRegisterBootOption (
(VOID *) (BootOrder + 1)
);
if (EFI_ERROR (Status) || BootOrderSize == 0 || BootOrderSize % sizeof (UINT16) != 0) {
if (EFI_ERROR(Status) || BootOrderSize == 0 || BootOrderSize % sizeof (UINT16) != 0) {
DEBUG ((DEBUG_INFO, "OCB: Failed to obtain boot order %u - %r\n", (UINT32) BootOrderSize, Status));
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FreePool (BootOrder);
}
return EFI_OUT_OF_RESOURCES;
@ -917,7 +917,7 @@ OcRegisterBootOption (
(VOID **) &FwRuntime
);
if (!EFI_ERROR (Status) && FwRuntime->Revision == OC_FIRMWARE_RUNTIME_REVISION) {
if (!EFI_ERROR(Status) && FwRuntime->Revision == OC_FIRMWARE_RUNTIME_REVISION) {
ZeroMem (&Config, sizeof (Config));
FwRuntime->SetOverride (&Config);
DEBUG ((DEBUG_INFO, "OCB: Found FW NVRAM, full access %d\n", Config.BootVariableRedirect));
@ -1002,7 +1002,7 @@ InternalLoadBootEntry (
&ParentFilePath
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
} else {
@ -1038,7 +1038,7 @@ InternalLoadBootEntry (
FreePool (EntryData);
}
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
OptionalStatus = gBS->HandleProtocol (
*EntryHandle,
&gEfiLoadedImageProtocolGuid,

View File

@ -59,7 +59,7 @@ InternalGetFirstDeviceBootFilePath (
&NumHandles,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -69,7 +69,7 @@ InternalGetFirstDeviceBootFilePath (
&gEfiDevicePathProtocolGuid,
(VOID **)&FsDevicePath
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -94,7 +94,7 @@ InternalGetFirstDeviceBootFilePath (
gAppleBootPolicyNumPredefinedPaths,
&BootDevicePath
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
break;
}
@ -233,7 +233,7 @@ InternalFindFirstDmgFileName (
for (
Status = FileHandleFindFirstFile (Directory, &FileInfo), NoFile = FALSE;
(!EFI_ERROR (Status) && !NoFile);
(!EFI_ERROR(Status) && !NoFile);
Status = FileHandleFindNextFile (Directory, FileInfo, &NoFile)
) {
if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0) {
@ -281,7 +281,7 @@ InternalFindDmgChunklist (
for (
Status = FileHandleFindFirstFile (Directory, &FileInfo), NoFile = FALSE;
(!EFI_ERROR (Status) && !NoFile);
(!EFI_ERROR(Status) && !NoFile);
Status = FileHandleFindNextFile (Directory, FileInfo, &NoFile)
) {
if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0) {
@ -355,7 +355,7 @@ InternalLoadDmg (
EFI_FILE_MODE_READ,
EFI_FILE_DIRECTORY
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DevPathText = ConvertDevicePathToText (Context->DevicePath, FALSE, FALSE);
DEBUG ((DEBUG_INFO, "OCB: Failed to open DMG directory %s\n", DevPathText));
if (DevPathText != NULL) {
@ -384,7 +384,7 @@ InternalLoadDmg (
EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCB: Failed to open DMG file %s - %r\n",
@ -398,7 +398,7 @@ InternalLoadDmg (
}
Status = GetFileSize (DmgFile, &DmgFileSize);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCB: Failed to retrieve DMG file size - %r\n",
@ -446,7 +446,7 @@ InternalLoadDmg (
EFI_FILE_MODE_READ,
0
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = GetFileSize (ChunklistFile, &ChunklistFileSize);
if (Status == EFI_SUCCESS) {
ChunklistBuffer = AllocatePool (ChunklistFileSize);
@ -455,7 +455,7 @@ InternalLoadDmg (
ChunklistFileSize = 0;
} else {
Status = GetFileData (ChunklistFile, 0, ChunklistFileSize, ChunklistBuffer);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (ChunklistBuffer);
ChunklistBuffer = NULL;
ChunklistFileSize = 0;

View File

@ -57,7 +57,7 @@ OcLoadPickerHotKeys (
(VOID **) &KeyMap
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCB: Missing AppleKeyMapAggregator - %r\n", Status));
return;
}
@ -70,7 +70,7 @@ OcLoadPickerHotKeys (
Keys
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCB: GetKeyStrokes - %r\n", Status));
return;
}
@ -156,7 +156,7 @@ OcGetAppleKeyIndex (
Keys
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCB: GetKeyStrokes - %r\n", Status));
return OC_INPUT_INVALID;
}
@ -249,7 +249,7 @@ OcGetAppleKeyIndex (
// by the SIP configuration. This might be an oversight, but is
// consistent with the boot.efi implementation.
//
WantsZeroSlide = !EFI_ERROR (Status) && (CsrActiveConfig & CSR_ALLOW_UNRESTRICTED_NVRAM) != 0;
WantsZeroSlide = !EFI_ERROR(Status) && (CsrActiveConfig & CSR_ALLOW_UNRESTRICTED_NVRAM) != 0;
}
if (WantsZeroSlide) {

View File

@ -365,7 +365,7 @@ OcShowSimplePasswordRequest (
//
do {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
} while (!EFI_ERROR (Status));
} while (!EFI_ERROR(Status));
gST->ConOut->OutputString (gST->ConOut, OC_MENU_PASSWORD_REQUEST);
OcPlayAudioFile (Context, OcVoiceOverAudioFileEnterPassword, TRUE);
@ -374,7 +374,7 @@ OcShowSimplePasswordRequest (
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (Status == EFI_NOT_READY) {
continue;
} else if (EFI_ERROR (Status)) {
} else if (EFI_ERROR(Status)) {
gST->ConOut->ClearScreen (gST->ConOut);
SecureZeroMem (Password, PwIndex);
SecureZeroMem (&Key.UnicodeChar, sizeof (Key.UnicodeChar));
@ -530,7 +530,7 @@ OcRunBootPicker (
Context,
OcPrivilegeAuthorized
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
if (Status != EFI_ABORTED) {
ASSERT (FALSE);
return Status;
@ -599,7 +599,7 @@ OcRunBootPicker (
Status = RunShowMenu (BootContext, &Chosen);
if (EFI_ERROR (Status) && Status != EFI_ABORTED) {
if (EFI_ERROR(Status) && Status != EFI_ABORTED) {
DEBUG ((DEBUG_ERROR, "OCB: ShowMenu failed - %r\n", Status));
OcFreeBootContext (BootContext);
return Status;
@ -619,11 +619,11 @@ OcRunBootPicker (
continue;
}
ASSERT (!EFI_ERROR (Status) || Status == EFI_ABORTED);
ASSERT (!EFI_ERROR(Status) || Status == EFI_ABORTED);
Context->TimeoutSeconds = 0;
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCB: Should boot from %u. %s (T:%d|F:%d|G:%d|E:%d|DEF:%d)\n",
@ -666,7 +666,7 @@ OcRunBootPicker (
//
OcPlayAudioFile (Context, OcVoiceOverAudioFileLoading, FALSE);
Status = OcPlayAudioEntry (Context, Chosen);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
OcPlayAudioBeep (
Context,
OC_VOICE_OVER_SIGNALS_PASSWORD_OK,
@ -685,7 +685,7 @@ OcRunBootPicker (
//
// Do not wait on successful return code.
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
OcPlayAudioFile (Context, OcVoiceOverAudioFileExecutionFailure, TRUE);
gBS->Stall (SECONDS_TO_MICROSECONDS (3));
//
@ -731,14 +731,14 @@ OcRunAppleBootPicker (
0,
&NewHandle
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = EFI_INVALID_PARAMETER;
}
} else {
Status = EFI_NOT_FOUND;
}
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
PickerEntryReason = ApplePickerEntryReasonUnknown;
Status = gRT->SetVariable (
APPLE_PICKER_ENTRY_REASON_VARIABLE_NAME,
@ -755,7 +755,7 @@ OcRunAppleBootPicker (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = EFI_UNSUPPORTED;
}
}

View File

@ -58,7 +58,7 @@ OcGetDevicePolicyType (
}
Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return 0;
}
@ -389,7 +389,7 @@ OcGetAppleBootLoadedImage (
(VOID **)&LoadedImage
);
if (!EFI_ERROR (Status)
if (!EFI_ERROR(Status)
&& LoadedImage->FilePath != NULL
&& (OcGetBootDevicePathType (LoadedImage->FilePath, NULL, NULL) & OC_BOOT_APPLE_ANY) != 0) {
return LoadedImage;

View File

@ -193,10 +193,10 @@ DeleteVariables (
RequestedSize = BufferSize;
Status = gRT->GetNextVariableName (&RequestedSize, Buffer, &CurrentGuid);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (IsDeletableVariable (Buffer, &CurrentGuid)) {
Status = gRT->SetVariable (Buffer, &CurrentGuid, 0, 0, NULL);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"Deleting %g:%s... OK\n",
@ -273,7 +273,7 @@ OcDeleteVariables (
&BootProtectSize,
&BootProtect
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
BootProtect = 0;
}
@ -283,7 +283,7 @@ OcDeleteVariables (
(VOID **) &FwRuntime
);
if (!EFI_ERROR (Status) && FwRuntime->Revision == OC_FIRMWARE_RUNTIME_REVISION) {
if (!EFI_ERROR(Status) && FwRuntime->Revision == OC_FIRMWARE_RUNTIME_REVISION) {
ZeroMem (&Config, sizeof (Config));
FwRuntime->SetOverride (&Config);
DEBUG ((DEBUG_INFO, "OCB: Found FW NVRAM, full access %d\n", Config.BootVariableRedirect));
@ -300,7 +300,7 @@ OcDeleteVariables (
&BootOption,
&BootOptionSize
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCB: Found %g:%s for preservation of %u bytes\n",
@ -324,7 +324,7 @@ OcDeleteVariables (
BootOption
);
BootOrder = OC_BOOT_OPTION;
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = gRT->SetVariable (
EFI_BOOT_ORDER_VARIABLE_NAME,
BootProtectGuid,

View File

@ -43,7 +43,7 @@ OcConsoleControlSetMode (
//
// No console control, assume already set.
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Mode;
}
@ -58,7 +58,7 @@ OcConsoleControlSetMode (
// Cannot get mode, assume already set.
// Same mode, do not waste time.
//
if (EFI_ERROR (Status) || OldMode == Mode) {
if (EFI_ERROR(Status) || OldMode == Mode) {
return Mode;
}
@ -98,7 +98,7 @@ OcConsoleControlInstallProtocol (
//
// Native implementation exists, overwrite.
//
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Provide original mode if requested.
//

View File

@ -81,7 +81,7 @@ ConsoleHandleProtocol (
NULL,
Interface
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return EFI_SUCCESS;
}
}
@ -90,12 +90,12 @@ ConsoleHandleProtocol (
}
VOID
OcProvideConsoleGop (
OcProvideConsoleGop(
IN BOOLEAN Route
)
{
EFI_STATUS Status;
EFI_GRAPHICS_OUTPUT_PROTOCOL *OriginalGop;
EFI_GRAPHICS_OUTPUT_PROTOCOL *OriginalGop = NULL;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
@ -116,10 +116,10 @@ OcProvideConsoleGop (
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID **) &OriginalGop
(VOID **)&OriginalGop
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCC: GOP exists on ConsoleOutHandle and has %u modes\n",
@ -148,7 +148,7 @@ OcProvideConsoleGop (
&HandleBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: No handles with GOP protocol - %r\n", Status));
return;
}
@ -168,7 +168,7 @@ OcProvideConsoleGop (
DEBUG ((DEBUG_INFO, "OCC: Alternative GOP status is - %r\n", Status));
FreePool (HandleBuffer);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
gBS->UninstallProtocolInterface (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
@ -180,14 +180,14 @@ OcProvideConsoleGop (
Status = gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **) &Gop);
}
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
Gop,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCC: Failed to install GOP on ConsoleOutHandle - %r\n", Status));
}
@ -231,7 +231,7 @@ DirectGopFromTarget (
Context,
&ConfigureSize
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (Context);
return NULL;
}
@ -264,7 +264,7 @@ DirectGopSetMode (
mFramebufferContext = NULL;
Status = mOriginalGopSetMode (This, ModeNumber);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
mFramebufferContext = Original;
gBS->RestoreTPL (OldTpl);
return Status;
@ -359,7 +359,7 @@ OcReconnectConsole (
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < HandleCount; ++Index) {
gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
}
@ -396,7 +396,7 @@ OcUseDirectGop (
(VOID **) &Gop
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: Cannot find console GOP for direct GOP - %r\n", Status));
return Status;
}
@ -428,7 +428,7 @@ OcUseDirectGop (
CacheType,
Status
));
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
mCachePolicy = CacheType;
}
}

View File

@ -58,7 +58,7 @@ AppleFramebufferGetInfo (
(VOID **) &GraphicsOutput
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return EFI_UNSUPPORTED;
}
@ -100,7 +100,7 @@ OcAppleFbInfoInstallProtocol (
if (Reinstall) {
Status = OcUninstallAllProtocolInstances (&gAppleFramebufferInfoProtocolGuid);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCOS: Uninstall failed: %r\n", Status));
return NULL;
}
@ -111,7 +111,7 @@ OcAppleFbInfoInstallProtocol (
(VOID *) &Protocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return Protocol;
}
}
@ -123,7 +123,7 @@ OcAppleFbInfoInstallProtocol (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}

View File

@ -71,7 +71,7 @@ OcSetConsoleResolutionForProtocol (
&Info
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: Mode %u failure - %r\n", ModeIndex, Status));
continue;
}
@ -137,7 +137,7 @@ OcSetConsoleResolutionForProtocol (
));
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) ModeNumber);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_WARN,
"OCC: Failed to set mode %u (prev %u) with %ux%u resolution\n",
@ -194,7 +194,7 @@ OcSetConsoleModeForProtocol (
&Rows
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -253,7 +253,7 @@ OcSetConsoleModeForProtocol (
));
Status = TextOut->SetMode (TextOut, (UINTN) ModeNumber);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_WARN,
"OCC: Failed to set mode %u with %ux%u console mode\n",
@ -307,7 +307,7 @@ OcSetConsoleResolution (
(VOID **) &GraphicsOutput
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCC: Missing GOP on console - %r\n", Status));
continue;
}

View File

@ -298,7 +298,7 @@ FlushCursor (
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return;
}
@ -422,7 +422,7 @@ AsciiTextReset (
(VOID **) &mGraphicsOutput
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return EFI_DEVICE_ERROR;
}
@ -433,7 +433,7 @@ AsciiTextReset (
mForegroundColor.Raw = mGraphicsEfiColors[ARRAY_SIZE (mGraphicsEfiColors) / 2 - 1];
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -468,7 +468,7 @@ AsciiTextOutputString (
//
if (mConsoleGopMode != mGraphicsOutput->Mode->Mode) {
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -589,7 +589,7 @@ AsciiTextQueryMode (
if (mConsoleGopMode != mGraphicsOutput->Mode->Mode) {
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -627,7 +627,7 @@ AsciiTextSetMode (
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
Status = RenderResync (This);
gBS->RestoreTPL (OldTpl);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
}
@ -656,7 +656,7 @@ AsciiTextSetAttribute (
if (mConsoleGopMode != mGraphicsOutput->Mode->Mode) {
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -703,7 +703,7 @@ AsciiTextClearScreen (
if (mConsoleGopMode != mGraphicsOutput->Mode->Mode) {
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -761,7 +761,7 @@ AsciiTextSetCursorPosition (
if (mConsoleGopMode != mGraphicsOutput->Mode->Mode) {
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -800,7 +800,7 @@ AsciiTextEnableCursor (
if (mConsoleGopMode != mGraphicsOutput->Mode->Mode) {
Status = RenderResync (This);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
gBS->RestoreTPL (OldTpl);
return Status;
}
@ -900,7 +900,7 @@ ConsoleControlInstall (
(VOID *) &ConsoleControl
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
CopyMem (
@ -936,7 +936,7 @@ OcUseBuiltinTextOutput (
(VOID *) &mFontScale
);
if (EFI_ERROR (Status) || mFontScale != 2) {
if (EFI_ERROR(Status) || mFontScale != 2) {
mFontScale = 1;
}
@ -944,7 +944,7 @@ OcUseBuiltinTextOutput (
Status = AsciiTextReset (&mAsciiTextOutputProtocol, TRUE);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: Cannot setup ASCII output - %r\n", Status));
return;
}

View File

@ -170,7 +170,7 @@ AllocateNullTextOutSystemTable (
&NewSystemTable->Hdr.CRC32
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCC: Failed to calculated new system table CRC32 with Status: %r\n", Status));
FreePool (NewSystemTable);
return NULL;

View File

@ -154,14 +154,14 @@ ControlledClearScreen (
(VOID **) &GraphicsOutput
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = GraphicsOutput->QueryMode (
GraphicsOutput,
GraphicsOutput->Mode->Mode,
&SizeOfInfo,
&Info
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Width = Info->HorizontalResolution;
Height = Info->VerticalResolution;
FreePool (Info);
@ -221,7 +221,7 @@ ConsoleControlGetMode (
StdInLocked
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
mConsoleMode = *Mode;
}
@ -263,7 +263,7 @@ ConsoleControlSetMode (
(VOID **) &GraphicsOutput
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = GraphicsOutput->Blt (
GraphicsOutput,
&mEfiBackgroundColors[BitFieldRead32 ((UINT32) gST->ConOut->Mode->Attribute, 4, 6)],

View File

@ -102,7 +102,7 @@ OcUgaDrawSetMode (
DEBUG ((DEBUG_INFO, "OCC: UGA SetConsoleResolutionOnHandle attempt - %r\n", Status));
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = OcSetConsoleResolutionForProtocol (
OcUgaDraw->GraphicsOutput,
0,
@ -178,7 +178,7 @@ OcProvideUgaPassThrough (
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: Found %u handles with UGA draw\n", (UINT32) HandleCount));
FreePool (HandleBuffer);
} else {
@ -193,7 +193,7 @@ OcProvideUgaPassThrough (
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: Found %u handles with GOP for UGA check\n", (UINT32) HandleCount));
for (Index = 0; Index < HandleCount; ++Index) {
@ -205,7 +205,7 @@ OcProvideUgaPassThrough (
(VOID **) &GraphicsOutput
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: No GOP protocol - %r\n", Status));
continue;
}
@ -216,7 +216,7 @@ OcProvideUgaPassThrough (
(VOID **) &UgaDraw
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCC: No UGA protocol - %r\n", Status));
OcUgaDraw = AllocateZeroPool (sizeof (*OcUgaDraw));

View File

@ -54,7 +54,7 @@ ScanMpServices (
NumberOfEnabledProcessors
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -68,7 +68,7 @@ ScanMpServices (
for (Index = 0; Index < *NumberOfProcessors; ++Index) {
Status = MpServices->GetProcessorInfo (MpServices, Index, &Info);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCCPU: Failed to get info for processor %Lu - %r\n",
@ -123,7 +123,7 @@ ScanFrameworkMpServices (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -144,7 +144,7 @@ ScanFrameworkMpServices (
&Context
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCCPU: Failed to get context for processor %Lu - %r\n",
@ -212,14 +212,14 @@ ScanThreadCount (
(VOID **) &MpServices
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = gBS->LocateProtocol (
&gFrameworkEfiMpServiceProtocolGuid,
NULL,
(VOID **) &FrameworkMpServices
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCCPU: No MP services - %r\n", Status));
return Status;
}
@ -247,7 +247,7 @@ ScanThreadCount (
Status
));
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -909,7 +909,7 @@ OcCpuCorrectTscSync (
(VOID **) &MpServices
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
MpServices = NULL;
Status = gBS->LocateProtocol (
&gFrameworkEfiMpServiceProtocolGuid,
@ -917,7 +917,7 @@ OcCpuCorrectTscSync (
(VOID **) &FrameworkMpServices
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCCPU: Failed to find mp services - %r\n", Status));
return Status;
}

View File

@ -52,13 +52,13 @@ WaitForKeyPress (
//
do {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
} while (!EFI_ERROR (Status));
} while (!EFI_ERROR(Status));
//
// Wait for debugger signal or key press.
//
Proceed = FALSE;
while (EFI_ERROR (Status) && !Proceed) {
while (EFI_ERROR(Status) && !Proceed) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
DebugBreak ();
}

View File

@ -123,7 +123,7 @@ AppleDebugLogPrint (
sizeof (mCurrentBuffer) - 1,
Message
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Length = AsciiStrLen (mCurrentBuffer);
if (Length > 0) {
@ -157,7 +157,7 @@ AppleDebugLogPrint (
//
// New message does not fit, send it directly.
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return AppleDebugLogPrintToOcLog (
OcLog,
"AAPL: %a",
@ -257,7 +257,7 @@ OcAppleDebugLogInstallProtocol (
if (Reinstall) {
Status = OcUninstallAllProtocolInstances (&gAppleDebugLogProtocolGuid);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCL: Uninstall failed: %r\n", Status));
return NULL;
}
@ -268,7 +268,7 @@ OcAppleDebugLogInstallProtocol (
(VOID *) &Protocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return Protocol;
}
}
@ -281,7 +281,7 @@ OcAppleDebugLogInstallProtocol (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}

View File

@ -112,7 +112,7 @@ GetLogPath (
}
Status = gRT->GetTime (&Date, NULL);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
ZeroMem (&Date, sizeof (Date));
}
@ -281,7 +281,7 @@ OcLogAddEntry (
//
Status = AsciiStrCatS (Private->AsciiBuffer, Private->AsciiBufferSize, Private->TimingTxt);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Status = AsciiStrCatS (Private->AsciiBuffer, Private->AsciiBufferSize, Private->LineBuffer);
}
@ -314,7 +314,7 @@ OcLogAddEntry (
} else {
Status = EFI_BUFFER_TOO_SMALL;
}
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
if ((OcLog->Options & OC_LOG_NONVOLATILE) != 0) {
Attributes |= EFI_VARIABLE_NON_VOLATILE;
@ -328,7 +328,7 @@ OcLogAddEntry (
Private->NvramBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
//
// On APTIO V this may not even get printed. Regardless of volatile or not
// it will firstly start discarding NVRAM data silently, and then will borks
@ -416,7 +416,7 @@ InternalGetOcLog (
(VOID **) &mInternalOcLog
);
if (EFI_ERROR (Status) || mInternalOcLog->Revision != OC_LOG_REVISION) {
if (EFI_ERROR(Status) || mInternalOcLog->Revision != OC_LOG_REVISION) {
mInternalOcLog = NULL;
}
}
@ -449,14 +449,14 @@ OcConfigureLogProtocol (
if (LogPath != NULL) {
if (LogFileSystem != NULL) {
Status = LogFileSystem->OpenVolume (LogFileSystem, &LogRoot);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
LogRoot = NULL;
}
}
if (LogRoot == NULL) {
Status = FindWritableFileSystem (&LogRoot);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCL: There is no place to write log file to - %r\n", Status));
LogRoot = NULL;
}
@ -526,7 +526,7 @@ OcConfigureLogProtocol (
&Private->OcLog
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
OcLog = &Private->OcLog;
} else {
FreePool (Private);
@ -534,13 +534,13 @@ OcConfigureLogProtocol (
}
}
if (!EFI_ERROR (Status)
if (!EFI_ERROR(Status)
&& (Options & (OC_LOG_SERIAL | OC_LOG_ENABLE)) == (OC_LOG_SERIAL | OC_LOG_ENABLE)) {
SerialPortInitialize ();
}
if (LogRoot != NULL) {
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (OC_LOG_PRIVATE_DATA_FROM_OC_LOG_THIS (OcLog)->AsciiBufferSize > 0) {
SetFileData (
LogRoot,

View File

@ -63,7 +63,7 @@ InternalConnectAll (
&HandleCount,
&HandleBuffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < HandleCount; Index++) {
gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
}
@ -106,7 +106,7 @@ BmMatchUsbClass (
// Check Vendor Id and Product Id.
//
Status = UsbIo->UsbGetDeviceDescriptor (UsbIo, &DevDesc);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
@ -129,7 +129,7 @@ BmMatchUsbClass (
// Protocol in Interface Descriptor instead.
//
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &IfDesc);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
@ -197,7 +197,7 @@ BmMatchUsbWwid (
// Check Vendor Id and Product Id.
//
Status = UsbIo->UsbGetDeviceDescriptor (UsbIo, &DevDesc);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
if ((DevDesc.IdVendor != UsbWwid->VendorId) ||
@ -209,7 +209,7 @@ BmMatchUsbWwid (
// Check Interface Number.
//
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &IfDesc);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
if (IfDesc.InterfaceNumber != UsbWwid->InterfaceNumber) {
@ -229,7 +229,7 @@ BmMatchUsbWwid (
TableSize = 0;
LangIdTable = NULL;
Status = UsbIo->UsbGetSupportedLanguages (UsbIo, &LangIdTable, &TableSize);
if (EFI_ERROR (Status) || (TableSize == 0) || (LangIdTable == NULL)) {
if (EFI_ERROR(Status) || (TableSize == 0) || (LangIdTable == NULL)) {
return FALSE;
}
@ -253,7 +253,7 @@ BmMatchUsbWwid (
DevDesc.StrSerialNumber,
&SerialNumberStr
);
if (EFI_ERROR (Status) || (SerialNumberStr == NULL)) {
if (EFI_ERROR(Status) || (SerialNumberStr == NULL)) {
continue;
}
@ -312,7 +312,7 @@ BmFindUsbDevice (
UsbIoHandleCount,
&UsbIoHandles
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
*UsbIoHandleCount = 0;
UsbIoHandles = NULL;
}
@ -328,7 +328,7 @@ BmFindUsbDevice (
);
UsbIoDevicePath = DevicePathFromHandle (UsbIoHandles[Index]);
Matched = FALSE;
if (!EFI_ERROR (Status) && (UsbIoDevicePath != NULL)) {
if (!EFI_ERROR(Status) && (UsbIoDevicePath != NULL)) {
//
// Compare starting part of UsbIoHandle's device path with ParentDevicePath.
@ -486,7 +486,7 @@ BmExpandMediaDevicePath (
//
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);
// CHANGE: Do not ASSERT.
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
Buffer = AllocatePool (BlockIo->Media->BlockSize);
@ -657,7 +657,7 @@ BmExpandPartitionDevicePath (
// CHANGE: Only connect all on failure.
//
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
BlockIoHandleCount = 0;
BlockIoBuffer = NULL;
}
@ -763,19 +763,19 @@ BmConnectUsbShortFormDevicePath (
&HandleCount,
&Handles
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (
Handles[Index],
&gEfiPciIoProtocolGuid,
(VOID **) &PciIo
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Check whether the Pci device is the wanted usb host controller
//
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class);
if (!EFI_ERROR (Status) &&
if (!EFI_ERROR(Status) &&
((PCI_CLASS_SERIAL == Class[2]) && (PCI_CLASS_SERIAL_USB == Class[1]))
) {
Status = gBS->ConnectController (
@ -816,7 +816,7 @@ OcGetNextLoadOptionDevicePath (
//
Node = FilePath;
Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &Node, &Handle);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (FullPath != NULL) {
return NULL;
}
@ -825,7 +825,7 @@ OcGetNextLoadOptionDevicePath (
}
Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &Node, &Handle);
if (!EFI_ERROR (Status) && IsDevicePathEnd (Node)) {
if (!EFI_ERROR(Status) && IsDevicePathEnd (Node)) {
return BmExpandMediaDevicePath (FilePath, FullPath, Handle);
}
@ -853,7 +853,7 @@ OcGetNextLoadOptionDevicePath (
} else {
Node = FilePath;
Status = gBS->LocateDevicePath (&gEfiUsbIoProtocolGuid, &Node, &Handle);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
//
// Only expand the USB WWID/Class device path
// when FilePath doesn't point to a physical UsbIo controller.

View File

@ -35,14 +35,14 @@ GetFileData (
UINTN ReadSize;
Status = File->SetPosition (File, Position);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
ReadSize = Size;
Status = File->Read (File, &ReadSize, Buffer);
File->SetPosition (File, 0);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -63,13 +63,13 @@ GetFileSize (
UINT64 Position;
Status = File->SetPosition (File, 0xFFFFFFFFFFFFFFFFULL);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = File->GetPosition (File, &Position);
File->SetPosition (File, 0);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -109,7 +109,7 @@ GetFileModifcationTime (
}
Status = File->GetInfo (File, &gEfiFileInfoGuid, &BufferSize, FileInfo);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (FileInfo);
return Status;
}
@ -142,7 +142,7 @@ FindWritableFileSystem (
&HandleCount,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -153,7 +153,7 @@ FindWritableFileSystem (
(VOID **) &SimpleFs
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_VERBOSE,
"OCFS: FindWritableFileSystem gBS->HandleProtocol[%u] returned %r\n",
@ -164,7 +164,7 @@ FindWritableFileSystem (
}
Status = SimpleFs->OpenVolume (SimpleFs, &Fs);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_VERBOSE,
"OCFS: FindWritableFileSystem SimpleFs->OpenVolume[%u] returned %r\n",
@ -184,7 +184,7 @@ FindWritableFileSystem (
EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE,
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_VERBOSE,
"OCFS: FindWritableFileSystem Fs->Open[%u] returned %r\n",
@ -222,7 +222,7 @@ SetFileData (
if (WritableFs == NULL) {
Status = FindWritableFileSystem (&Fs);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_VERBOSE, "OCFS: WriteFileData can't find writable FS\n"));
return Status;
}
@ -238,12 +238,12 @@ SetFileData (
0
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
WrittenSize = Size;
Status = File->Write (File, &WrittenSize, (VOID *) Buffer);
Fs->Close (File);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_VERBOSE, "OCFS: WriteFileData file->Write returned %r\n", Status));
} else if (WrittenSize != Size) {
DEBUG ((

View File

@ -52,7 +52,7 @@ GetFvFileVolume (
//
// TODO: Support FirmwareVolume2?
//
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -65,7 +65,7 @@ GetFvFileVolume (
(VOID **) &FirmwareVolumeInterface
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -79,7 +79,7 @@ GetFvFileVolume (
&AuthenticationStatus
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
gBS->FreePool (HandleBuffer);
return CurrentVolume;
}

View File

@ -53,7 +53,7 @@ OcUnblockUnmountedPartitions (
&NumHandles,
&Handles
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCFSQ: Could not locate DiskIo handles\n"));
return;
}
@ -67,7 +67,7 @@ OcUnblockUnmountedPartitions (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **) &FileSystem
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
continue;
}
//
@ -78,7 +78,7 @@ OcUnblockUnmountedPartitions (
&gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo
);
if (EFI_ERROR (Status) || !BlockIo->Media->LogicalPartition) {
if (EFI_ERROR(Status) || !BlockIo->Media->LogicalPartition) {
continue;
}
//
@ -90,7 +90,7 @@ OcUnblockUnmountedPartitions (
&BlockIoInfos,
&NumBlockIoInfo
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCFSQ: Attached drivers could not been retrieved\n"));
continue;
}
@ -102,7 +102,7 @@ OcUnblockUnmountedPartitions (
BlockIoInfos[BlockIoInfoIndex].AgentHandle,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCFSQ: Failed to unblock handle %p - %r\n",

View File

@ -62,7 +62,7 @@ GetFileInfo (
FileInfoBuffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (RealFileInfoSize != NULL) {
*RealFileInfoSize = FileInfoSize;
}
@ -75,4 +75,4 @@ GetFileInfo (
}
return FileInfoBuffer;
}
}

View File

@ -50,7 +50,7 @@ GetVolumeLabel (
&Volume
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}

View File

@ -61,7 +61,7 @@ OcDiskInitializeContext (
Status = EFI_ABORTED;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = gBS->HandleProtocol (
DiskHandle,
&gEfiBlockIoProtocolGuid,
@ -71,7 +71,7 @@ OcDiskInitializeContext (
Context->BlockIo = NULL;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((
DEBUG_INFO,
"OCPI: Block I/O (%d/%d) protocols (%d) are not present on %p - %r\n",
@ -206,9 +206,9 @@ InternalPartitionGetDiskHandle (
&TempPath,
&DiskHandle
);
*HasBlockIo2 = !EFI_ERROR (Status);
*HasBlockIo2 = !EFI_ERROR(Status);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
TempPath = PrefixPath;
Status = gBS->LocateDevicePath (
&gEfiBlockIoProtocolGuid,
@ -217,7 +217,7 @@ InternalPartitionGetDiskHandle (
);
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DebugPrintDevicePath (
DEBUG_INFO,
"OCPI: Failed to locate disk",
@ -308,7 +308,7 @@ OcDiskFindSystemPartitionPath (
&NumHandles,
&Handles
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCPI: Failed to locate FS handles\n"));
return NULL;
}
@ -408,13 +408,13 @@ OcGetDiskPartitions (
&mInternalDiskPartitionEntriesProtocolGuid,
(VOID **) &PartEntries
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCPI: Located cached partition entries\n"));
return PartEntries;
}
Status = OcDiskInitializeContext (&DiskContext, DiskHandle, UseBlockIo2);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -434,7 +434,7 @@ OcGetDiskPartitions (
BufferSize,
GptHeader
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (GptHeader);
DEBUG ((
DEBUG_INFO,
@ -498,7 +498,7 @@ OcGetDiskPartitions (
PartEntriesSize,
PartEntries->FirstEntry
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (PartEntries);
DEBUG ((
DEBUG_INFO,
@ -523,7 +523,7 @@ OcGetDiskPartitions (
PartEntries,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCPI: Failed to cache partition entries\n"));
FreePool (PartEntries);
return NULL;
@ -560,7 +560,7 @@ OcGetGptPartitionEntry (
&mInternalPartitionEntryProtocolGuid,
(VOID **)&PartEntry
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCPI: Located cached partition entry\n"));
return PartEntry;
}
@ -624,7 +624,7 @@ OcGetGptPartitionEntry (
PartEntry,
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCPI: Failed to cache partition entry\n"));
return NULL;
}

View File

@ -61,7 +61,7 @@ LocateFileSystem (
&DeviceHandle
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_WARN, "OCFS: Failed to locate device handle over path - %r\n", Status));
return NULL;
}
@ -73,7 +73,7 @@ LocateFileSystem (
(VOID **) &FileSystem
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCFS: No filesystem on device handle %p\n", DeviceHandle));
return NULL;
}
@ -97,7 +97,7 @@ LocateRootVolume (
}
Status = FileSystem->OpenVolume (FileSystem, &RootVolume);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -129,7 +129,7 @@ LocateFileSystemByGuid (
&NumHandles,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -141,7 +141,7 @@ LocateFileSystemByGuid (
&gEfiDevicePathProtocolGuid,
(VOID **)&DevicePath
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -162,7 +162,7 @@ LocateFileSystemByGuid (
&gEfiSimpleFileSystemProtocolGuid,
(VOID **)&SimpleFs
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
SimpleFs = NULL;
}

View File

@ -87,7 +87,7 @@ OcOpenFileByRemainingDevicePath (
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -96,7 +96,7 @@ OcOpenFileByRemainingDevicePath (
// we have to release LastFile on error.
//
Status = FileSystem->OpenVolume (FileSystem, &LastFile);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -152,7 +152,7 @@ OcOpenFileByRemainingDevicePath (
FreePool (AlignedPathName);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
goto CloseLastFile;
}
@ -174,7 +174,7 @@ CloseLastFile:
// We are on the error path; we must have set an error Status for returning
// to the caller.
//
ASSERT (EFI_ERROR (Status));
ASSERT (EFI_ERROR(Status));
return Status;
}
@ -201,7 +201,7 @@ OcOpenFileByDevicePath (
FilePath,
&FileSystemHandle
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}

View File

@ -51,7 +51,7 @@ ReadFile (
FileSystem,
&Volume
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -65,7 +65,7 @@ ReadFile (
Volume->Close (Volume);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
@ -73,7 +73,7 @@ ReadFile (
FileHandle,
&FileReadSize
);
if (EFI_ERROR (Status)
if (EFI_ERROR(Status)
|| OcOverflowAddU32 (FileReadSize, sizeof (CHAR16), &FileBufferSize)
|| (MaxFileSize > 0 && FileReadSize > MaxFileSize)) {
FileHandle->Close (FileHandle);
@ -89,7 +89,7 @@ ReadFile (
FileBuffer
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
FileBuffer[FileReadSize] = 0;
FileBuffer[FileReadSize + 1] = 0;
if (FileSize != NULL) {
@ -124,7 +124,7 @@ ReadFileSize (
FileSystem,
&Volume
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -138,7 +138,7 @@ ReadFileSize (
Volume->Close (Volume);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}

View File

@ -56,7 +56,7 @@ LegacyRegionLock (
(VOID **) &LegacyRegionProtocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Lock Region Using LegacyRegionProtocol
//

View File

@ -55,7 +55,7 @@ LegacyRegionUnlock (
(VOID **) &LegacyRegionProtocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Unlock Region Using LegacyRegionProtocol
//

View File

@ -51,7 +51,7 @@ OcAllocatePagesFromTop (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}

View File

@ -393,7 +393,7 @@ OcRebuildAttributes (
MemoryAttributesEntry,
MemoryAttributesTable->DescriptorSize
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// Statically allocate memory for the memory map to avoid allocations.
//
@ -417,7 +417,7 @@ OcRebuildAttributes (
&DescriptorVersion
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
OcSortMemoryMap (
MemoryMapSize,
MemoryMap,
@ -600,7 +600,7 @@ OcSplitMemoryMapByAttributes (
MemoryAttributesEntry,
DescriptorSize
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
*MemoryMapSize = CurrentEntryCount * DescriptorSize;
return Status;
}

View File

@ -88,7 +88,7 @@ OcGetCurrentMemoryMap (
&DescriptorVersionValue
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (MemoryMap);
return NULL;
}
@ -164,7 +164,7 @@ OcGetCurrentMemoryMapAlloc (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCMM: Temp memory map allocation from top failure - %r\n", Status));
*MemoryMap = NULL;
return Status;
@ -187,7 +187,7 @@ OcGetCurrentMemoryMapAlloc (
DescriptorVersion
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
if (TopMemory != NULL) {
gBS->FreePages (
(EFI_PHYSICAL_ADDRESS) ((UINTN) *MemoryMap),

View File

@ -160,7 +160,7 @@ VmAllocateMemoryPool (
NULL
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
Context->MemoryPool = (UINT8 *)(UINTN)Addr;
Context->FreePages = NumPages;
}
@ -389,7 +389,7 @@ VmMapVirtualPages (
Status = EFI_SUCCESS;
while (NumPages > 0 && !EFI_ERROR (Status)) {
while (NumPages > 0 && !EFI_ERROR(Status)) {
Status = VmMapVirtualPage (
Context,
PageTable,

View File

@ -36,7 +36,7 @@ GetArguments (
&gEfiShellParametersProtocolGuid,
(VOID**) &ShellParameters
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
*Argc = ShellParameters->Argc;
*Argv = ShellParameters->Argv;
return EFI_SUCCESS;
@ -47,7 +47,7 @@ GetArguments (
&gEfiLoadedImageProtocolGuid,
(VOID**) &LoadedImage
);
if (EFI_ERROR (Status) || LoadedImage->LoadOptions == NULL) {
if (EFI_ERROR(Status) || LoadedImage->LoadOptions == NULL) {
return EFI_NOT_FOUND;
}
@ -81,7 +81,7 @@ OcUninstallAllProtocolInstances (
return EFI_SUCCESS;
}
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -92,7 +92,7 @@ OcUninstallAllProtocolInstances (
&OriginalProto
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
break;
}
@ -102,7 +102,7 @@ OcUninstallAllProtocolInstances (
OriginalProto
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
break;
}
}
@ -126,7 +126,7 @@ OcHandleProtocolFallback (
Protocol,
Interface
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
Status = gBS->LocateProtocol (
Protocol,
NULL,

View File

@ -70,7 +70,7 @@ XhciReleaseOwnership (
&HcCapParams
);
ExtendCap = EFI_ERROR (Status) ? 0 : ((HcCapParams >> 14U) & 0x3FFFCU);
ExtendCap = EFI_ERROR(Status) ? 0 : ((HcCapParams >> 14U) & 0x3FFFCU);
while (ExtendCap) {
Status = PciIo->Mem.Read (
@ -82,7 +82,7 @@ XhciReleaseOwnership (
&Value
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
break;
}
@ -560,7 +560,7 @@ ReleaseUsbOwnership (
&HandleArray
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -573,7 +573,7 @@ ReleaseUsbOwnership (
(VOID **) &PciIo
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
continue;
}
@ -585,7 +585,7 @@ ReleaseUsbOwnership (
&Pci
);
if (EFI_ERROR (Status)
if (EFI_ERROR(Status)
|| Pci.Hdr.ClassCode[1] != PCI_CLASS_SERIAL_USB
|| Pci.Hdr.ClassCode[2] != PCI_CLASS_SERIAL) {
continue;

View File

@ -206,7 +206,7 @@ OcOSInfoInstallProtocol (
if (Reinstall) {
Status = OcUninstallAllProtocolInstances (&gEfiOSInfoProtocolGuid);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCOS: Uninstall failed: %r\n", Status));
return NULL;
}
@ -217,7 +217,7 @@ OcOSInfoInstallProtocol (
(VOID *) &Protocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return Protocol;
}
}
@ -229,7 +229,7 @@ OcOSInfoInstallProtocol (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}

View File

@ -46,7 +46,7 @@ SyncRtcRead (
}
Status = EfiAcquireLockOrFail (&mAppleRtcRamLock);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -70,7 +70,7 @@ SyncRtcWrite (
}
Status = EfiAcquireLockOrFail (&mAppleRtcRamLock);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -92,7 +92,7 @@ SyncRtcWaitForReady (
for (Count = 0; Count < 100; ++Count) {
Status = EfiAcquireLockOrFail (&mAppleRtcRamLock);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
RegisterA = OcRtcRead (RTC_ADDRESS_REGISTER_A);
EfiReleaseLock (&mAppleRtcRamLock);
@ -144,23 +144,23 @@ AppleRtcRamReadData (
for (Index = 0; Index < BufferSize; ++Index) {
Status = SyncRtcWaitForReady ();
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = SyncRtcRead ((UINT8) Address, Buffer);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
if (Address == APPLE_RTC_BG_COLOR_ADDR) {
Status = SyncRtcWaitForReady ();
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
Status = SyncRtcRead (APPLE_RTC_BG_COMPLEMENT_ADDR, &Temp);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status;
}
@ -201,7 +201,7 @@ AppleRtcRamWriteData (
}
Status = AppleRtcRamReadData (This, TempBuffer, APPLE_RTC_TOTAL_SIZE, 0);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return Status; ///< This is not checked in the original.
}
@ -250,19 +250,19 @@ AppleRtcRamReset (
for (Index = APPLE_RTC_CHECKSUM_START; Index < APPLE_RTC_CORE_SIZE; ++Index) {
Status = SyncRtcWaitForReady ();
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
SyncRtcRead ((UINT8) Index, &Buffer[Index]);
}
}
Status = SyncRtcWaitForReady ();
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
SyncRtcRead ((UINT8) APPLE_RTC_FIRMWARE_57_ADDR, &Buffer[APPLE_RTC_FIRMWARE_57_ADDR]);
}
for (Index = APPLE_RTC_RESERVED_ADDR; Index < APPLE_RTC_RESERVED_ADDR + APPLE_RTC_RESERVED_LENGTH; ++Index) {
Status = SyncRtcWaitForReady ();
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
SyncRtcRead ((UINT8) Index, &Buffer[Index]);
}
}
@ -299,7 +299,7 @@ OcAppleRtcRamInstallProtocol (
if (Reinstall) {
Status = OcUninstallAllProtocolInstances (&gAppleRtcRamProtocolGuid);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_ERROR, "OCRTC: Uninstall failed: %r\n", Status));
return NULL;
}
@ -310,7 +310,7 @@ OcAppleRtcRamInstallProtocol (
(VOID *) &Protocol
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
return Protocol;
}
}
@ -331,7 +331,7 @@ OcAppleRtcRamInstallProtocol (
&RtcBlacklistSize
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
for (Index = 0; Index < RtcBlacklistSize; ++Index) {
mEmulatedRtcStatus[RtcBlacklist[Index]] = TRUE;
DEBUG ((DEBUG_INFO, "OCRTC: Blacklisted %02x address\n", RtcBlacklist[Index]));
@ -359,7 +359,7 @@ OcAppleRtcRamInstallProtocol (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}

View File

@ -231,7 +231,7 @@ OcStorageInitFromFs (
Context->FileSystem = FileSystem;
Status = FileSystem->OpenVolume (FileSystem, &RootVolume);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCST: FileSystem volume cannot be opened - %r\n", Status));
return Status;
}
@ -246,7 +246,7 @@ OcStorageInitFromFs (
RootVolume->Close (RootVolume);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCST: Directory %s cannot be opened - %r\n", Path, Status));
return Status;
}
@ -278,7 +278,7 @@ OcStorageInitFromFs (
Status = OcStorageInitializeVault (Context, Vault, DataSize, StorageKey, Signature, SignatureSize);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "OCST: Vault init failure %p (%u) - %r\n", Vault, DataSize, Status));
}
@ -353,7 +353,7 @@ OcStorageExistsFileUnicode (
0
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
File->Close (File);
return TRUE;
}
@ -404,12 +404,12 @@ OcStorageReadFileUnicode (
0
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return NULL;
}
Status = GetFileSize (File, &Size);
if (EFI_ERROR (Status) || Size >= MAX_UINT32 - 1) {
if (EFI_ERROR(Status) || Size >= MAX_UINT32 - 1) {
File->Close (File);
return NULL;
}
@ -422,7 +422,7 @@ OcStorageReadFileUnicode (
Status = GetFileData (File, 0, Size, FileBuffer);
File->Close (File);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
FreePool (FileBuffer);
return NULL;
}

View File

@ -1,4 +1,5 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/OcStorageLib.h>
#include <Library/OcSerializeLib.h>
#include <Library/OcTemplateLib.h>
@ -8,49 +9,13 @@
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/OcQuirksProtocol.h>
#define ROOT_PATH L"EFI\\CLOVER"
#define CONFIG_PATH L"drivers\\UEFI\\OcQuirks.plist"
//#define CONFIG_PATH L"drivers\\UEFI\\OcQuirks.plist"
#define MAX_DATA_SIZE 10000
#define OC_MMIO_WL_STRUCT_FIELDS(_, __) \
_(BOOLEAN , Enabled , , FALSE , ()) \
_(UINT64 , Address , , 0 , ()) \
_(OC_STRING , Comment , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING))
OC_DECLARE (OC_MMIO_WL_STRUCT)
#define OC_MMIO_WL_ARRAY_FIELDS(_, __) \
OC_ARRAY (OC_MMIO_WL_STRUCT, _, __)
OC_DECLARE (OC_MMIO_WL_ARRAY)
#define OC_QUIRKS_FIELDS(_, __) \
_(BOOLEAN , AvoidRuntimeDefrag , , TRUE ,()) \
_(BOOLEAN , DevirtualiseMmio , , FALSE ,()) \
_(BOOLEAN , DisableSingleUser , , FALSE ,()) \
_(BOOLEAN , DisableVariableWrite , , FALSE ,()) \
_(BOOLEAN , DiscardHibernateMap , , FALSE ,()) \
_(BOOLEAN , EnableSafeModeSlide , , TRUE ,()) \
_(BOOLEAN , EnableWriteUnprotector , , FALSE ,()) \
_(BOOLEAN , ForceExitBootServices , , TRUE ,()) \
_(OC_MMIO_WL_ARRAY , MmioWhitelist , , OC_CONSTR2 (OC_MMIO_WL_ARRAY, _, __) , OC_DESTR (OC_MMIO_WL_ARRAY)) \
_(BOOLEAN , ProtectMemoryRegions , , FALSE ,()) \
_(BOOLEAN , ProtectSecureBoot , , FALSE ,()) \
_(BOOLEAN , ProtectUefiServices , , FALSE ,()) \
_(BOOLEAN , ProvideConsoleGopEnable , , TRUE ,()) \
_(UINT8 , ProvideMaxSlide , , 0 ,()) \
_(BOOLEAN , ProvideCustomSlide , , TRUE ,()) \
_(BOOLEAN , RebuildAppleMemoryMap , , TRUE ,()) \
_(BOOLEAN , SetupVirtualMap , , TRUE ,()) \
_(BOOLEAN , SignalAppleOS , , FALSE ,()) \
_(BOOLEAN , SyncRuntimePermissions , , TRUE ,())
OC_DECLARE (OC_QUIRKS)
OC_STRUCTORS (OC_MMIO_WL_STRUCT, ())
OC_ARRAY_STRUCTORS (OC_MMIO_WL_ARRAY)
OC_STRUCTORS (OC_QUIRKS, ())
/*
STATIC
OC_SCHEMA
mMmioWhitelistEntry[] = {
@ -114,7 +79,7 @@ QuirksProvideConfig (
(VOID **) &LoadedImage
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
@ -136,7 +101,7 @@ QuirksProvideConfig (
NULL
);
if (EFI_ERROR (Status)) {
if (EFI_ERROR(Status)) {
return FALSE;
}
@ -154,13 +119,15 @@ QuirksProvideConfig (
return FALSE;
}
//ConfigData is still XML file content. Now parsing
BOOLEAN Success = ParseSerialized (Config, &mConfigInfo, ConfigData, ConfigDataSize);
FreePool(ConfigData);
return Success;
}
*/
OCQUIRKS_PROTOCOL *mQuirks = NULL;
EFI_STATUS
EFIAPI
@ -169,11 +136,31 @@ QuirksEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
OC_QUIRKS Config;
EFI_STATUS Status;
OC_ABC_SETTINGS AbcSettings = { TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE,
FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, NULL, 0, NULL, NULL, NULL, NULL };
BOOLEAN ProvideConsoleGopEnable = TRUE;
OC_QUIRKS_CONSTRUCT (&Config, sizeof (Config));
QuirksProvideConfig(&Config, Handle);
Status = gBS->LocateProtocol(&gOcQuirksProtocolGuid, NULL, (VOID **)&mQuirks);
// if not found then use default values
// if (EFI_ERROR(Status)) {
// return Status;
// }
// OC_QUIRKS Config;
// OC_QUIRKS_CONSTRUCT (&Config, sizeof (Config));
// QuirksProvideConfig(&Config, Handle);
if (mQuirks) {
Status = mQuirks->GetConfig(mQuirks, &AbcSettings, &ProvideConsoleGopEnable);
}
if (EFI_ERROR(Status)) {
// OC_QUIRKS_DESTRUCT (&Config, sizeof(Config));
// return Status;
DEBUG ((DEBUG_INFO, L"config not found, use default"));
}
/*
OC_ABC_SETTINGS AbcSettings = {
.AvoidRuntimeDefrag = Config.AvoidRuntimeDefrag,
@ -214,12 +201,12 @@ QuirksEntryPoint (
AbcSettings.MmioWhitelistSize = abcIndex;
} // Else couldn't allocate slots for mmio addresses
}
if (Config.ProvideConsoleGopEnable) {
OcProvideConsoleGop (TRUE);
*/
if (ProvideConsoleGopEnable) {
OcProvideConsoleGop(TRUE);
}
OC_QUIRKS_DESTRUCT (&Config, sizeof (Config));
// OC_QUIRKS_DESTRUCT (&Config, sizeof (Config));
return OcAbcInitialize (&AbcSettings);
return OcAbcInitialize(&AbcSettings);
}

View File

@ -19,17 +19,18 @@
OcBootManagementLib
MachoLib
OcOSInfoLib
OcStorageLib
# OcStorageLib
OcConsoleLib
OcSerializeLib
OcTemplateLib
# OcSerializeLib
# OcTemplateLib
UefiBootServicesTableLib
UefiDriverEntryPoint
[Protocols]
gEfiSimpleFileSystemProtocolGuid
gEfiLoadedImageProtocolGuid
gOcQuirksProtocolGuid
[Sources]
OcQuirks.c

View File

@ -102,7 +102,7 @@ UefiEntrypoint (
&Interface
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// In case for whatever reason one tried to reload the driver.
//
@ -124,7 +124,7 @@ UefiEntrypoint (
NULL
);
ASSERT_EFI_ERROR (Status);
ASSERT_EFI_ERROR(Status);
return EFI_SUCCESS;
}

View File

@ -159,7 +159,7 @@ WrapGetTime (
Capabilities
);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
//
// On old AMI firmwares (like the one found in GA-Z87X-UD4H) there is a chance
// of getting 2047 (EFI_UNSPECIFIED_TIMEZONE) from GetTime. This is valid,
@ -382,7 +382,7 @@ WrapGetNextVariableName (
Size = sizeof (TempName);
Status = mStoredGetNextVariableName (&Size, TempName, &TempGuid);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (!IsEfiBootVar (TempName, &TempGuid)) {
Size = StrSize (TempName); ///< Not guaranteed to be updated with EFI_SUCCESS.
@ -467,7 +467,7 @@ WrapGetNextVariableName (
Size = sizeof (TempName);
Status = mStoredGetNextVariableName (&Size, TempName, &TempGuid);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR(Status)) {
if (IsOcBootVar (TempName, &TempGuid)) {
Size = StrSize (TempName); ///< Not guaranteed to be updated with EFI_SUCCESS.
@ -720,5 +720,5 @@ RedirectRuntimeServices (
&mTranslateEvent
);
ASSERT_EFI_ERROR (Status);
ASSERT_EFI_ERROR(Status);
}

View File

@ -2182,6 +2182,7 @@
A51C784721E0981C001385A7 /* HdaControllerMem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = HdaControllerMem.c; sourceTree = "<group>"; };
A51C784821E0981C001385A7 /* HdaModels.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = HdaModels.c; sourceTree = "<group>"; };
A52212DA24BD80EF00DAB7D6 /* OcMemoryLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcMemoryLib.h; sourceTree = "<group>"; };
A52213D024BE04A300DAB7D6 /* OcQuirksProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcQuirksProtocol.h; sourceTree = "<group>"; };
A523130F2448792B00421FB2 /* image.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = image.h; sourceTree = "<group>"; };
A52313102448B12A00421FB2 /* unicode_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unicode_conversions.h; sourceTree = "<group>"; };
A52313112448B12A00421FB2 /* unicode_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unicode_conversions.cpp; sourceTree = "<group>"; };
@ -16953,6 +16954,7 @@
A5C324A324B5022F004E20CC /* OcAudio.h */,
A5C3248324B5022F004E20CC /* OcFirmwareRuntime.h */,
A5C330D224B72957004E20CC /* OcLog.h */,
A52213D024BE04A300DAB7D6 /* OcQuirksProtocol.h */,
A5C3248224B5022F004E20CC /* OSInfo.h */,
A5C3249524B5022F004E20CC /* PciIoImp.h */,
A5C3249D24B5022F004E20CC /* SimpleAudioOut.h */,

View File

@ -21,6 +21,20 @@
#include <Protocol/OSInfo.h>
#include <Protocol/AppleGraphConfig.h>
#include <Protocol/KeyboardInfo.h>
#include <Protocol/OcQuirksProtocol.h>
#include "Injectors.h"
#ifndef DEBUG_ALL
#define DEBUG_PRO 1
#else
#define DEBUG_PRO DEBUG_ALL
#endif
#if DEBUG_PRO == 0
#define DBG(...)
#else
#define DBG(...) DebugLog(DEBUG_PRO, __VA_ARGS__)
#endif
EFI_GUID gDevicePropertiesGuid = {
0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}
@ -36,6 +50,7 @@ EFI_GUID gAppleFramebufferInfoProtocolGuid = {
// 03622D6D-362A-4E47-9710-C238B23755C1 - GraphConfig
extern EFI_GUID gAppleFramebufferInfoProtocolGuid;
extern BOOLEAN gProvideConsoleGopEnable;
UINT32 mPropSize = 0;
UINT8* mProperties = NULL;
@ -215,6 +230,7 @@ EFI_STATUS EFIAPI GetScreenInfo(VOID* This, UINT64* baseAddress, UINT64* frameBu
if(EFI_ERROR(Status))
return EFI_UNSUPPORTED;
//this print never occured so this procedure is redundant
DBG("GetScreenInfo called\n");
// printf("GetScreenInfo called with args: %lx %lx %lx %lx %lx %lx\n",
// baseAddress, frameBufferSize, bpr, w, h, colorDepth);
*frameBufferSize = (UINT64)mGraphicsOutput->Mode->FrameBufferSize;
@ -251,7 +267,7 @@ OSInfoOSNameImpl (
// this variable can be used at OnExitBoootServices,
// as it will be set by boot.efi
BootOSName = (__typeof__(BootOSName))AllocateCopyPool(AsciiStrLen(OSName) + 1, (VOID*)OSName);
DBG("OSInfo:OSName called\n");
EfiNamedEventSignal (&gAppleOSLoadedNamedEventGuid);
}
@ -264,6 +280,7 @@ OSInfoOSVendorImpl (
{
// never used as never called
INTN Result;
DBG("OSInfo:OSVendor called\n");
if (!OSVendor) {
return;
}
@ -296,6 +313,7 @@ RestoreConfig (APPLE_GRAPH_CONFIG_PROTOCOL* This,
UINT32 Param1, UINT32 Param2, VOID* Param3, VOID* Param4, VOID* Param5
)
{
DBG("RestoreConfig called Param1=%x\n", Param1);
return EFI_SUCCESS;
}
@ -322,7 +340,7 @@ UsbKbGetKeyboardDeviceInfo (
if (CountryCode) {
*CountryCode = 0;
}
DBG("KeyboardDeviceInfo called\n");
return EFI_SUCCESS;
}
@ -330,6 +348,27 @@ EFI_KEYBOARD_INFO_PROTOCOL mKeyboardInfo = {
UsbKbGetKeyboardDeviceInfo
};
#define OCQUIRKS_PROTOCOL_REVISION 23
EFI_STATUS
EFIAPI
GetQuirksConfig (IN OCQUIRKS_PROTOCOL *This,
OUT OC_ABC_SETTINGS *Buffer,
OUT BOOLEAN *GopEnable
)
{
DBG("GetQuirksConfig called\n");
CopyMem(Buffer, &gQuirks, sizeof(OC_ABC_SETTINGS));
*GopEnable = gProvideConsoleGopEnable;
return EFI_SUCCESS;
}
OCQUIRKS_PROTOCOL mQuirksConfig = {
OCQUIRKS_PROTOCOL_REVISION,
0, //reserved
GetQuirksConfig
};
EFI_STATUS
SetPrivateVarProto(VOID)
{
@ -345,6 +384,8 @@ SetPrivateVarProto(VOID)
&mGraphConfig,
&gEfiKeyboardInfoProtocolGuid,
&mKeyboardInfo,
&gOcQuirksProtocolGuid,
&mQuirksConfig,
NULL
);
//obligatory protocol

View File

@ -8,14 +8,16 @@
#ifndef PLATFORM_INJECTORS_H_
#define PLATFORM_INJECTORS_H_
extern UINT32 mPropSize;
extern UINT8 *mProperties;
extern CHAR8 *gDeviceProperties;
extern UINT32 cPropSize;
extern UINT8 *cProperties;
extern CHAR8 *cDeviceProperties;
extern CHAR8 *BootOSName;
#include <Library/OcAfterBootCompatLib.h>
extern UINT32 mPropSize;
extern UINT8 *mProperties;
extern CHAR8 *gDeviceProperties;
extern UINT32 cPropSize;
extern UINT8 *cProperties;
extern CHAR8 *cDeviceProperties;
extern CHAR8 *BootOSName;
extern OC_ABC_SETTINGS gQuirks;
EFI_STATUS
SetPrivateVarProto (VOID);

View File

@ -31,6 +31,8 @@
#include "ati_reg.h"
#include "../../Version.h"
#include <Protocol/OcQuirksProtocol.h>
#ifndef DEBUG_ALL
#define DEBUG_SET 1
#else
@ -142,8 +144,9 @@ EFI_GUID gUuid;
EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL;
extern BOOLEAN NeedPMfix;
extern BOOLEAN NeedPMfix;
OC_ABC_SETTINGS gQuirks;
BOOLEAN gProvideConsoleGopEnable;
//extern INTN OldChosenAudio;
@ -210,40 +213,6 @@ static struct FIX_CONFIG { const CHAR8* oldName; const CHAR8* newName; UINT32 bi
{ NULL, "FixMutex", FIX_MUTEX }
};
/*
VOID __inline WaitForSts(VOID) {
UINT32 inline_timeout = 100000;
while (AsmReadMsr64(MSR_IA32_PERF_STATUS) & (1 << 21)) { if (!inline_timeout--) break; }
}
*/
#if 0
UINT32
GetCrc32 (
UINT8 *Buffer,
UINTN Size
)
{
UINTN i;
UINTN Len;
UINT32 x;
UINT32 *Fake;
Fake = (UINT32*)Buffer;
if (Fake == NULL) {
DBG("Buffer=NULL\n");
return 0;
}
x = 0;
Len = Size >> 2;
for (i = 0; i < Len; i++) {
x += Fake[i];
}
return x;
}
#else //nice programming
UINT32
GetCrc32 (
UINT8 *Buffer,
@ -257,7 +226,6 @@ GetCrc32 (
while (Size--) x+= *Fake++;
return x;
}
#endif
ACPI_NAME_LIST *
ParseACPIName(CHAR8 *String)
@ -2482,8 +2450,6 @@ GetEarlyUserSettings (
FreePool(Value);
}
gSettings.KextPatchesAllowed = TRUE;
gSettings.KernelAndKextPatches.KPAppleRTC = TRUE;
gSettings.KernelAndKextPatches.KPDELLSMBIOS = FALSE; // default is false
@ -3234,6 +3200,102 @@ GetEarlyUserSettings (
}
}
DictPointer = GetProperty(Dict, "Quirks");
if (DictPointer != NULL) {
Prop = GetProperty(DictPointer, "AvoidRuntimeDefrag");
gQuirks.AvoidRuntimeDefrag = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
Prop = GetProperty(DictPointer, "DevirtualiseMmio");
gQuirks.DevirtualiseMmio = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.DevirtualiseMmio? QUIRK_MMIO:0;
Prop = GetProperty(DictPointer, "DisableSingleUser");
gQuirks.DisableSingleUser = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.DisableSingleUser? QUIRK_SU:0;
Prop = GetProperty(DictPointer, "DisableVariableWrite");
gQuirks.DisableVariableWrite = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.DisableVariableWrite? QUIRK_VAR:0;
Prop = GetProperty(DictPointer, "DiscardHibernateMap");
gQuirks.DiscardHibernateMap = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.DiscardHibernateMap? QUIRK_HIBER:0;
Prop = GetProperty(DictPointer, "EnableSafeModeSlide");
gQuirks.EnableSafeModeSlide = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.EnableSafeModeSlide? QUIRK_SAFE:0;
Prop = GetProperty(DictPointer, "EnableWriteUnprotector");
gQuirks.EnableWriteUnprotector = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0;
Prop = GetProperty(DictPointer, "ForceExitBootServices");
gQuirks.ForceExitBootServices = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.ForceExitBootServices? QUIRK_EXIT:0;
Prop = GetProperty(DictPointer, "ProtectMemoryRegions");
gQuirks.ProtectMemoryRegions = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.ProtectMemoryRegions? QUIRK_REGION:0;
Prop = GetProperty(DictPointer, "ProtectSecureBoot");
gQuirks.ProtectSecureBoot = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.ProtectMemoryRegions? QUIRK_SECURE:0;
Prop = GetProperty(DictPointer, "ProtectUefiServices");
gQuirks.ProtectUefiServices = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.ProtectUefiServices? QUIRK_UEFI:0;
Prop = GetProperty(DictPointer, "ProvideConsoleGopEnable");
gProvideConsoleGopEnable = IsPropertyTrue(Prop);
Prop = GetProperty(DictPointer, "ProvideCustomSlide");
gQuirks.ProvideCustomSlide = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0;
Prop = GetProperty(DictPointer, "ProvideMaxSlide");
gQuirks.ProvideMaxSlide = GetPropertyInteger(Prop, 0);
Prop = GetProperty(DictPointer, "RebuildAppleMemoryMap");
gQuirks.RebuildAppleMemoryMap = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0;
Prop = GetProperty(DictPointer, "SetupVirtualMap");
gQuirks.SetupVirtualMap = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.SetupVirtualMap? QUIRK_VIRT:0;
Prop = GetProperty(DictPointer, "SignalAppleOS");
gQuirks.SignalAppleOS = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.SignalAppleOS? QUIRK_OS:0;
Prop = GetProperty(DictPointer, "SyncRuntimePermissions");
gQuirks.SyncRuntimePermissions = IsPropertyTrue(Prop);
gSettings.QuirksMask |= gQuirks.SyncRuntimePermissions? QUIRK_PERM:0;
Dict2 = GetProperty(DictPointer, "MmioWhitelist");
if (Dict2 != NULL) {
INTN Count = GetTagCount(Dict2);
TagPtr Dict3;
//OC_SCHEMA_INTEGER_IN ("Address", OC_MMIO_WL_STRUCT, Address),
//OC_SCHEMA_STRING_IN ("Comment", OC_MMIO_WL_STRUCT, Comment),
//OC_SCHEMA_BOOLEAN_IN ("Enabled", OC_MMIO_WL_STRUCT, Enabled),
if (Count > 0) {
gQuirks.MmioWhitelistLabels = (__typeof__(gQuirks.MmioWhitelistLabels))AllocatePool(sizeof(char*) * Count);
gQuirks.MmioWhitelist = (__typeof__(gQuirks.MmioWhitelist))AllocatePool(sizeof(*gQuirks.MmioWhitelist) * Count);
gQuirks.MmioWhitelistEnabled = (__typeof__(gQuirks.MmioWhitelistEnabled))AllocatePool(sizeof(BOOLEAN) * Count);
gQuirks.MmioWhitelistSize = 0;
for (INTN i = 0; i < Count; i++) {
Status = GetElement(Dict2, i, &Dict3);
if (EFI_ERROR(Status)) {
DBG("error %s getting next element of MmioWhitelist at index %lld\n", strerror(Status), i);
continue;
}
if (Dict3 == NULL) {
break;
}
gQuirks.MmioWhitelistLabels[gQuirks.MmioWhitelistSize] = (__typeof__(char *))AllocateZeroPool(256);
Prop = GetProperty(Dict3, "Comment");
if (Prop != NULL && (Prop->type == kTagTypeString) && Prop->string) {
snprintf(gQuirks.MmioWhitelistLabels[gQuirks.MmioWhitelistSize], 255, "%s", Prop->string);
} else {
snprintf(gQuirks.MmioWhitelistLabels[gQuirks.MmioWhitelistSize], 255, " (NoLabel)");
}
Prop = GetProperty(Dict2, "Address");
if (Prop != 0) {
gQuirks.MmioWhitelist[gQuirks.MmioWhitelistSize] = GetPropertyInteger(Prop, 0);
Prop = GetProperty(Dict2, "Enabled");
gQuirks.MmioWhitelistEnabled[gQuirks.MmioWhitelistSize] = IsPropertyTrue(Prop);
}
gQuirks.MmioWhitelistSize++;
}
}
}
}
}
return Status;
@ -4908,11 +4970,11 @@ GetUserSettings(
DEV_PROPERTY *DevProp;
if (Count > 0) {
DBG("Add %lld devices (Arbitrary):\n", Count);
DBG("Add %lld devices (Arbitrary):\n", Count);
for (Index = 0; Index < Count; Index++) {
UINTN DeviceAddr = 0U;
CHAR8 *Label;
DBG(" - [%02lld]:", Index);
DBG(" - [%02lld]:", Index);
if (EFI_ERROR(GetElement(Prop, Index, &Prop2))) {
DBG(" continue\n"/*, Index*/);
continue;
@ -5385,14 +5447,14 @@ GetUserSettings(
gSettings.LenToReplace = (__typeof__(gSettings.LenToReplace))AllocateZeroPool(Count * sizeof(UINT32));
gSettings.PatchDsdtLabel = (__typeof__(gSettings.PatchDsdtLabel))AllocateZeroPool(Count * sizeof(UINT8*));
gSettings.PatchDsdtMenuItem = (__typeof__(gSettings.PatchDsdtMenuItem))AllocateZeroPool(Count * sizeof(INPUT_ITEM));
DBG("PatchesDSDT: %lld requested\n", Count);
DBG("PatchesDSDT: %lld requested\n", Count);
for (i = 0; i < Count; i++) {
UINTN Size = 0;
CHAR8 *DSDTPatchesLabel;
Status = GetElement(Prop, i, &Prop2);
if (EFI_ERROR(Status)) {
DBG("error %s getting next element of PatchesDSDT at index %lld\n", strerror(Status), i);
DBG("error %s getting next element of PatchesDSDT at index %lld\n", strerror(Status), i);
continue;
}
@ -5400,17 +5462,17 @@ GetUserSettings(
break;
}
DBG(" - [%02lld]:", i);
DBG(" - [%02lld]:", i);
DSDTPatchesLabel = (__typeof__(DSDTPatchesLabel))AllocateZeroPool(256);
Prop3 = GetProperty(Prop2, "Comment");
if (Prop3 != NULL && (Prop3->type == kTagTypeString) && Prop3->string) {
snprintf(DSDTPatchesLabel, 255, "%s", Prop3->string);
snprintf(DSDTPatchesLabel, 255, "%s", Prop3->string);
} else {
snprintf(DSDTPatchesLabel, 255, " (NoLabel)");
}
gSettings.PatchDsdtLabel[i] = (__typeof_am__(gSettings.PatchDsdtLabel[i]))AllocateZeroPool(256);
snprintf(gSettings.PatchDsdtLabel[i], 255, "%s", DSDTPatchesLabel);
snprintf(gSettings.PatchDsdtLabel[i], 255, "%s", DSDTPatchesLabel);
DBG(" (%s)", gSettings.PatchDsdtLabel[i]);
FreePool(DSDTPatchesLabel);
@ -5420,10 +5482,10 @@ GetUserSettings(
//DBG(" DSDT bin patch #%d ", i);
gSettings.PatchDsdtFind[i] = GetDataSetting (Prop2, "Find", &Size);
DBG(" lenToFind: %llu", Size);
DBG(" lenToFind: %llu", Size);
gSettings.LenToFind[i] = (UINT32)Size;
gSettings.PatchDsdtReplace[i] = GetDataSetting (Prop2, "Replace", &Size);
DBG(", lenToReplace: %llu", Size);
DBG(", lenToReplace: %llu", Size);
gSettings.LenToReplace[i] = (UINT32)Size;
gSettings.PatchDsdtTgt[i] = (CHAR8*)GetDataSetting (Prop2, "TgtBridge", &Size);
DBG(", Target Bridge: %s\n", gSettings.PatchDsdtTgt[i]);

View File

@ -513,7 +513,7 @@ typedef struct {
// ACPI/PATCHED/AML
UINT32 DisabledAMLCount;
CHAR16 **DisabledAML;
CHAR8 **PatchDsdtLabel; //yyyy
CHAR8 **PatchDsdtLabel;
CHAR8 **PatchDsdtTgt;
INPUT_ITEM *PatchDsdtMenuItem;
@ -529,6 +529,9 @@ typedef struct {
UINT8 flagstate[32];
DEV_PROPERTY *ArbProperties;
UINTN QuirksMask;
UINTN MaxSlide;
} SETTINGS_DATA;

View File

@ -67,13 +67,13 @@ VOID AddSecureBootTool(VOID)
// Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (gSettings.SecureBoot) {
Entry = new REFIT_MENU_ENTRY_SECURE_BOOT();
Entry->Title.SPrintf("Clover Secure Boot Configuration");
Entry->Title.SWPrintf("Clover Secure Boot Configuration");
// Entry->Tag = TAG_SECURE_BOOT_CONFIG;
Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT_CONFIG);
} else {
Entry = new REFIT_MENU_ENTRY_SECURE_BOOT_CONFIG();
Entry->Title.SPrintf("Enable Clover Secure Boot");
Entry->Title.SWPrintf("Enable Clover Secure Boot");
// Entry->Tag = TAG_SECURE_BOOT;
Entry->Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_SECURE_BOOT);
}

View File

@ -419,6 +419,7 @@
gEfiPlatformDriverOverrideProtocolGuid
gEmuVariableControlProtocolGuid
gEfiAudioIoProtocolGuid # CONSUMES
gOcQuirksProtocolGuid
[FeaturePcd]
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport

View File

@ -231,18 +231,35 @@ typedef enum {
#define SCREEN_KEXTS 23
#define SCREEN_KERNELS 24
#define SCREEN_DSDT_PATCHES 25
#define SCREEN_DEVICES 26
#define SCREEN_BOOTER 27
#define SCREEN_KEXT_INJECT 28
#define SCREEN_KEXTS_MAN 29
#define SCREEN_AUDIOPORTS 30
#define SCREEN_DEVICES 26
#define SCREEN_BOOTER 27
#define SCREEN_KEXT_INJECT 28
#define SCREEN_KEXTS_MAN 29
#define SCREEN_AUDIOPORTS 30
#define SCREEN_QUIRKS 31
#define MAX_ANIME 41
#define QUIRK_DEFRAG bit(0)
#define QUIRK_MMIO bit(1)
#define QUIRK_SU bit(2)
#define QUIRK_VAR bit(3)
#define QUIRK_HIBER bit(4)
#define QUIRK_SAFE bit(5)
#define QUIRK_UNPROT bit(6)
#define QUIRK_EXIT bit(7)
#define QUIRK_REGION bit(8)
#define QUIRK_SECURE bit(9)
#define QUIRK_UEFI bit(10)
#define QUIRK_CUSTOM bit(11)
#define QUIRK_MAP bit(12)
#define QUIRK_VIRT bit(13)
#define QUIRK_OS bit(14)
#define QUIRK_PERM bit(15)
//some unreal values
#define FILM_CENTRE 40000
#define FILM_CENTRE 40000
//#define FILM_LEFT 50000
//#define FILM_TOP 50000
//#define FILM_RIGHT 60000

View File

@ -57,6 +57,7 @@
#include "../Platform/FixBiosDsdt.h"
#include "../include/Devices.h"
#include "../Platform/boot.h"
#include "../Platform/Injectors.h"
#ifndef DEBUG_ALL
#define DEBUG_MENU 1
@ -71,6 +72,7 @@
#endif
extern CONST CHAR8 *AudioOutputNames[];
extern BOOLEAN gProvideConsoleGopEnable;
INTN LayoutMainMenuHeight = 376;
INTN LayoutAnimMoveForMenuX = 0;
@ -516,8 +518,8 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeXHCI);
InputItems[InputItemsCount].ItemType = CheckBit; //101 - vacant
InputItems[InputItemsCount++].IValue = 0; //dropDSM;
InputItems[InputItemsCount].ItemType = CheckBit; //101 - Quirks
InputItems[InputItemsCount++].IValue = gSettings.QuirksMask; //
InputItems[InputItemsCount].ItemType = BoolValue; //102
InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT;
@ -590,7 +592,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //121
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
InputItems[InputItemsCount].ItemType = Decimal; //122
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04lld", gSettings.MaxSlide);
InputItems[InputItemsCount].ItemType = BoolValue; //123
InputItems[InputItemsCount++].BValue = gProvideConsoleGopEnable;
@ -1070,12 +1078,26 @@ VOID ApplyInputs(VOID)
gSettings.FakeXHCI = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //101 - vacant
i++; //101 - Quirks
if (InputItems[i].Valid) {
// gSettings.DropOEM_DSM = (UINT16)StrHexToUint64(InputItems[i].SValue);
// gSettings.DropOEM_DSM = (UINT16)InputItems[i].IValue;
// dropDSM = gSettings.DropOEM_DSM; //?
// defDSM = TRUE;
gSettings.QuirksMask = InputItems[i].IValue;
gQuirks.AvoidRuntimeDefrag = ((gSettings.QuirksMask & QUIRK_DEFRAG) != 0); //1
gQuirks.DevirtualiseMmio = ((gSettings.QuirksMask & QUIRK_MMIO) != 0); //0
gQuirks.DisableSingleUser = ((gSettings.QuirksMask & QUIRK_SU) != 0); //0
gQuirks.DisableVariableWrite = ((gSettings.QuirksMask & QUIRK_VAR) != 0); //0
gQuirks.DiscardHibernateMap = ((gSettings.QuirksMask & QUIRK_HIBER) != 0); //0
gQuirks.EnableSafeModeSlide = ((gSettings.QuirksMask & QUIRK_SAFE) != 0); //1
gQuirks.EnableWriteUnprotector = ((gSettings.QuirksMask & QUIRK_UNPROT) != 0); //1
gQuirks.ForceExitBootServices = ((gSettings.QuirksMask & QUIRK_EXIT) != 0); //0
gQuirks.ProtectMemoryRegions = ((gSettings.QuirksMask & QUIRK_REGION) != 0); //0
gQuirks.ProtectSecureBoot = ((gSettings.QuirksMask & QUIRK_SECURE) != 0); //0
gQuirks.ProtectUefiServices = ((gSettings.QuirksMask & QUIRK_UEFI) != 0); //0
gQuirks.ProvideCustomSlide = ((gSettings.QuirksMask & QUIRK_CUSTOM) != 0); //1
gQuirks.RebuildAppleMemoryMap = ((gSettings.QuirksMask & QUIRK_MAP) != 0); //0
gQuirks.SetupVirtualMap = ((gSettings.QuirksMask & QUIRK_VIRT) != 0); //1
gQuirks.SignalAppleOS = ((gSettings.QuirksMask & QUIRK_OS) != 0); //0
gQuirks.SyncRuntimePermissions = ((gSettings.QuirksMask & QUIRK_PERM) != 0); //1
DBG("applied Quirks mask:%llx\n", gSettings.QuirksMask); //default is 0xA861
}
i++; //102
if (InputItems[i].Valid) {
@ -1205,6 +1227,17 @@ VOID ApplyInputs(VOID)
gSettings.KernelAndKextPatches.KPPanicNoKextDump = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //122
if (InputItems[i].Valid) {
gSettings.MaxSlide = (UINTN)StrDecimalToUintn(InputItems[i].SValue);
DBG(" set MaxSlide = %lld\n", gSettings.MaxSlide);
}
i++; //123
if (InputItems[i].Valid) {
gProvideConsoleGopEnable = InputItems[i].BValue;
DBG("applied ConsoleGopEnable=%s\n", gProvideConsoleGopEnable?"Y":"N");
}
if (NeedSave) {
SaveSettings();
@ -2249,41 +2282,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
/*
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSM, NULL);
// Entry->Title.SPrintf("Drop OEM _DSM [0x%04hhx]->", gSettings.DropOEM_DSM);
// submenu description
SubScreen->AddMenuInfoLine_f("Choose devices to drop OEM _DSM methods from DSDT");
SubScreen->AddMenuCheck("ATI/AMD Graphics", DEV_ATI, 101);
SubScreen->AddMenuCheck("Nvidia Graphics", DEV_NVIDIA, 101);
SubScreen->AddMenuCheck("Intel Graphics", DEV_INTEL, 101);
SubScreen->AddMenuCheck("PCI HDA audio", DEV_HDA, 101);
SubScreen->AddMenuCheck("HDMI audio", DEV_HDMI, 101);
SubScreen->AddMenuCheck("PCI LAN Adapter", DEV_LAN, 101);
SubScreen->AddMenuCheck("PCI WiFi Adapter", DEV_WIFI, 101);
SubScreen->AddMenuCheck("IDE HDD", DEV_IDE, 101);
SubScreen->AddMenuCheck("SATA HDD", DEV_SATA, 101);
SubScreen->AddMenuCheck("USB Controllers", DEV_USB, 101);
SubScreen->AddMenuCheck("LPC Controller", DEV_LPC, 101);
SubScreen->AddMenuCheck("SMBUS Controller", DEV_SMBUS, 101);
SubScreen->AddMenuCheck("IMEI Device", DEV_IMEI, 101);
SubScreen->AddMenuCheck("Firewire", DEV_FIREWIRE, 101);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);
return Entry;
}
*/
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
{
REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry;
@ -2332,7 +2331,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches() //yyyy
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
@ -2710,6 +2709,46 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuConfigs()
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuQuirks()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_QUIRKS, NULL);
Entry->Title.SWPrintf("Quirks mask [0x%04llx]->", gSettings.QuirksMask);
// submenu description
SubScreen->AddMenuInfoLine_f("Choose options to fix memory");
SubScreen->AddMenuCheck("AvoidRuntimeDefrag", QUIRK_DEFRAG, 101);
SubScreen->AddMenuCheck("DevirtualiseMmio", QUIRK_MMIO, 101);
SubScreen->AddMenuCheck("DisableSingleUser", QUIRK_SU, 101);
SubScreen->AddMenuCheck("DisableVariableWrite", QUIRK_VAR, 101);
SubScreen->AddMenuCheck("DiscardHibernateMap", QUIRK_HIBER, 101);
SubScreen->AddMenuCheck("EnableSafeModeSlide", QUIRK_SAFE, 101);
SubScreen->AddMenuCheck("EnableWriteUnprotector", QUIRK_UNPROT, 101);
SubScreen->AddMenuCheck("ForceExitBootServices", QUIRK_EXIT, 101);
SubScreen->AddMenuCheck("ProtectMemoryRegions", QUIRK_REGION, 101);
SubScreen->AddMenuCheck("ProtectSecureBoot", QUIRK_SECURE, 101);
SubScreen->AddMenuCheck("ProtectUefiServices", QUIRK_UEFI, 101);
SubScreen->AddMenuItemInput(123, "ProvideConsoleGopEnable", FALSE);
SubScreen->AddMenuCheck("ProvideCustomSlide", QUIRK_CUSTOM, 101);
//decimal
SubScreen->AddMenuItemInput(122, "ProvideMaxSlide:", TRUE);
SubScreen->AddMenuCheck("RebuildAppleMemoryMap", QUIRK_MAP, 101);
SubScreen->AddMenuCheck("SetupVirtualMap", QUIRK_VIRT, 101);
SubScreen->AddMenuCheck("SignalAppleOS", QUIRK_OS, 101);
SubScreen->AddMenuCheck("SyncRuntimePermissions", QUIRK_PERM, 101);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);
return Entry;
}
VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
{
REFIT_ABSTRACT_MENU_ENTRY *TmpChosenEntry = NULL;
@ -2758,12 +2797,13 @@ VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
}
OptionMenu.AddMenuEntry( SubMenuACPI(), true);
OptionMenu.AddMenuEntry( SubMenuSmbios(), true);
OptionMenu.AddMenuEntry( SubMenuBinaries(), true);
OptionMenu.AddMenuEntry( SubMenuQuirks(), true);
OptionMenu.AddMenuEntry( SubMenuGraphics(), true);
OptionMenu.AddMenuEntry( SubMenuPCI(), true);
OptionMenu.AddMenuEntry( SubMenuSpeedStep(), true);
OptionMenu.AddMenuEntry( SubMenuGraphics(), true);
OptionMenu.AddMenuEntry( SubMenuAudio(), true);
OptionMenu.AddMenuEntry( SubMenuAudioPort(), true);
OptionMenu.AddMenuEntry( SubMenuBinaries(), true);
OptionMenu.AddMenuEntry( SubMenuSystem(), true);
OptionMenu.AddMenuEntry( &MenuEntryReturn, false);
//DBG("option menu created entries=%d\n", OptionMenu.Entries.size());