...
 
Commits (11)
    https://gitcode.net/btwise/opencorepkg_mod/-/commit/0b1f8388c595e727b8400ba9d241dead2f06e59b OpenCanopy: Fixed intro animation getting stuck 2024-01-03T06:59:40+00:00 Mike Beaton mjsbeaton@gmail.com When triggered, this: - Looks wrong - Disables ESC and SPACE - Can hide the menu completely (if triggered early) https://gitcode.net/btwise/opencorepkg_mod/-/commit/7e916f57151e62f14d97a672dc0882c56bd4cb04 OpenCanopy: Only require presence of label images when used 2024-01-03T21:36:39+00:00 Mike Beaton mjsbeaton@gmail.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/34da204e97bfb83490b748c95653c70e205bb6a0 OpenCanopy: Provide OC_ATTR_REDUCE_MOTION to disable non-needed OpenCanopy an... 2024-01-04T04:21:23+00:00 Mike Beaton mjsbeaton@gmail.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/312f25515b4cf36fc4e82114c0273fa81e0031ee LogoutHook: Convert all CFString to CFData before saving 2024-01-04T10:12:07+00:00 Mike Beaton mjsbeaton@gmail.com Works round fact that OpenCore XML parser does not automatically decode any XML entities. https://gitcode.net/btwise/opencorepkg_mod/-/commit/5ce824b291e34405f4a9ab6e8b428a341250ab90 OcCpuLib: Fix CPU frequency calculation on AMD 0Fh family 2024-01-04T22:52:32-06:00 John Davis goldfishnet64@outlook.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/fe5fc3320bea28da260333902d08989f314f7815 OcCpuLib: Fix cpu-type detection on Raptor Lake (#518) 2024-01-06T14:56:52+03:00 Alex James git@alextjam.es https://gitcode.net/btwise/opencorepkg_mod/-/commit/22b851e58964804d0ab8f62e35117ab25cdbc8bf OcAppleKernelLib: Add Exclude strategy for mkext 2024-01-09T20:52:12-06:00 John Davis goldfishnet64@outlook.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/b227a85420e5cb5460d395d15604b6fedc7dae6c OcAppleKernelLib: Fix previous commit 2024-01-09T21:51:25-06:00 John Davis goldfishnet64@outlook.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/a61a208a77db1e4ee392a9550ba63f011dead859 Update changelog 2024-01-10T17:11:17-06:00 John Davis goldfishnet64@outlook.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/593ce5c8ee12efc0970906e6e61f01f0f05cf7ed Merge branch 'master' of https://github.com/acidanthera/OpenCorePkg 2024-01-11T19:49:40+08:00 btwise tyq@qq.com https://gitcode.net/btwise/opencorepkg_mod/-/commit/3dd980c7be11196e00f789533cf88a85b280d437 Merge branch 'master' of https://gitee.com/btwise/OpenCorePkg 2024-01-11T19:50:57+08:00 btwise tyq@qq.com
......@@ -5,6 +5,12 @@ OpenCore Changelog
- Fixed CPU frequency calculation on AMD 10h family
- Swapped the position of Shutdown and Restart buttons to better match recent macOS
- Added `OC_ATTR_USE_REVERSED_UI` to allow access to previous default Shutdown and Restart button arrangement
- Fixed intro animation getting stuck in OpenCanopy if an entry which returns to menu is selected before animation ends
- Modified OpenCanopy to require presence of label images only when used due to `OC_ATTR_USE_GENERIC_LABEL_IMAGE`
- Provided `OC_ATTR_REDUCE_MOTION` to optionally disable non-required OpenCanopy menu animations
- Modified NVRAM logout hook to handle XML entities in string vars
- Fixed CPU frequency calculation on AMD 0Fh family
- Added kext blocker `Exclude` strategy for mkext
#### v0.9.7
- Updated recovery_urls.txt
......
e8e6a05be5ae29df99c3e435fc0e7add
e2c0f86b5f70d8124acb82a49163cde8
......@@ -3697,6 +3697,12 @@ the default boot entry choice will remain changed until the next manual reconfig
Restart buttons, affects OpenCanopy and builtin picker. The reversed setting matches older macOS,
and since it was the previous default in OpenCore it may better match some custom backgrounds.
Only applicable when \texttt{OC\_ATTR\_USE\_MINIMAL\_UI} is not set.
\item \texttt{0x0200} --- \texttt{OC\_ATTR\_REDUCE\_MOTION}, reduce password and menu animation
in \texttt{OpenCanopy}, leaving only animations which communicate information not otherwise
provided.
\emph{Note}: These same animations, plus additional animations whose information is provided
by voice-over, are automatically disabled when \texttt{PickerAudioAssist} is enabled.
\end{itemize}
\item
......
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Thu Dec 28 17:20:22 2023
%DIF ADD ../Configuration.tex Mon Jan 1 15:56:40 2024
%DIF ADD ../Configuration.tex Wed Jan 3 22:50:02 2024
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
......@@ -3757,6 +3757,13 @@ the default boot entry choice will remain changed until the next manual reconfig
Restart buttons, affects OpenCanopy and builtin picker. The reversed setting matches older macOS,
and since it was the previous default in OpenCore it may better match some custom backgrounds.
Only applicable when }\texttt{\DIFadd{OC\_ATTR\_USE\_MINIMAL\_UI}} \DIFadd{is not set.
}\item \texttt{\DIFadd{0x0200}} \DIFadd{--- }\texttt{\DIFadd{OC\_ATTR\_REDUCE\_MOTION}}\DIFadd{, reduce password and menu animation
in }\texttt{\DIFadd{OpenCanopy}}\DIFadd{, leaving only animations which communicate information not otherwise
provided.
}
\emph{\DIFadd{Note}}\DIFadd{: These same animations, plus additional animations whose information is provided
by voice-over, are automatically disabled when }\texttt{\DIFadd{PickerAudioAssist}} \DIFadd{is enabled.
}\DIFaddend \end{itemize}
\item
......
......@@ -1173,6 +1173,20 @@ PatcherExcludePrelinkedKext (
IN OUT PRELINKED_CONTEXT *PrelinkedContext
);
/**
Exclude kext from mkext.
@param[in,out] MkextContext Mkext context.
@param[in] Identifier Kext identifier to be excluded.
@return EFI_SUCCESS on success.
**/
EFI_STATUS
PatcherExcludeMkextKext (
IN OUT MKEXT_CONTEXT *MkextContext,
IN CONST CHAR8 *Identifier
);
/**
Block kext from loading.
......
......@@ -111,12 +111,13 @@ typedef struct OC_HOTKEY_CONTEXT_ OC_HOTKEY_CONTEXT;
#define OC_ATTR_USE_MINIMAL_UI BIT6
#define OC_ATTR_USE_FLAVOUR_ICON BIT7
#define OC_ATTR_USE_REVERSED_UI BIT8
#define OC_ATTR_REDUCE_MOTION BIT9
#define OC_ATTR_ALL_BITS (\
OC_ATTR_USE_VOLUME_ICON | OC_ATTR_USE_DISK_LABEL_FILE | \
OC_ATTR_USE_GENERIC_LABEL_IMAGE | OC_ATTR_HIDE_THEMED_ICONS | \
OC_ATTR_USE_POINTER_CONTROL | OC_ATTR_SHOW_DEBUG_DISPLAY | \
OC_ATTR_USE_MINIMAL_UI | OC_ATTR_USE_FLAVOUR_ICON | \
OC_ATTR_USE_REVERSED_UI )
OC_ATTR_USE_REVERSED_UI | OC_ATTR_REDUCE_MOTION )
/**
Default timeout for IDLE timeout during menu picker navigation
......
......@@ -216,7 +216,7 @@ enum {
AppleProcessorTypeCorei9Type1 = 0x1001, // may not be used
AppleProcessorTypeCorei9Type5 = 0x1005, // SKL-X i9, most likely to be invalid!
AppleProcessorTypeCorei9Type9 = 0x1009 // ideal value for Coffee Lake i9, need confirmation
AppleProcessorTypeCorei9Type9 = 0x1009 // i9 9980HK (MacBookPro16,1)
};
// APPLE_PROCESSOR_TYPE_CLASS
......
......@@ -241,15 +241,18 @@ typedef enum {
#define CPU_MODEL_COFFEELAKE_DT 0x9E
#define CPU_MODEL_ICELAKE_Y 0x7D
#define CPU_MODEL_ICELAKE_U 0x7E
#define CPU_MODEL_ICELAKE_SP 0x9F /* Some variation of Ice Lake */
#define CPU_MODEL_COMETLAKE_S 0xA5 /* desktop CometLake */
#define CPU_MODEL_COMETLAKE_Y 0xA5 /* aka 10th generation Amber Lake Y */
#define CPU_MODEL_ICELAKE_SP 0x9F ///< Some variation of Ice Lake
#define CPU_MODEL_COMETLAKE_S 0xA5 ///< desktop CometLake
#define CPU_MODEL_COMETLAKE_Y 0xA5 ///< aka 10th generation Amber Lake Y
#define CPU_MODEL_COMETLAKE_U 0xA6
#define CPU_MODEL_ROCKETLAKE_S 0xA7/* desktop RocketLake */
#define CPU_MODEL_ROCKETLAKE_S 0xA7 ///< desktop RocketLake
#define CPU_MODEL_TIGERLAKE_U 0x8C
#define CPU_MODEL_ALDERLAKE_S 0x97
#define CPU_MODEL_RAPTORLAKE_S 0xB7 ///< Raptor Lake B0 stepping
#define CPU_MODEL_RAPTORLAKE_HX 0xBF ///< Raptor Lake C0 stepping
#define AMD_CPU_FAMILY 0xF
#define AMD_CPU_EXT_FAMILY_0FH 0x0
#define AMD_CPU_EXT_FAMILY_10H 0x1
#define AMD_CPU_EXT_FAMILY_15H 0x6
#define AMD_CPU_EXT_FAMILY_16H 0x7
......
......@@ -542,6 +542,172 @@ PatcherExcludePrelinkedKext (
return EFI_NOT_FOUND;
}
EFI_STATUS
PatcherExcludeMkextKext (
IN OUT MKEXT_CONTEXT *MkextContext,
IN CONST CHAR8 *Identifier
)
{
EFI_STATUS Status;
MKEXT_V2_FILE_ENTRY *MkextV2FileEntry;
MKEXT_HEADER_ANY *MkextHeader;
CONST CHAR8 *KextIdentifier;
BOOLEAN IsKextMatch;
UINT32 PlistBundlesCount;
XML_NODE *PlistBundle;
UINT32 PlistBundleIndex;
UINT32 PlistBundleCount;
CONST CHAR8 *PlistBundleKey;
XML_NODE *PlistBundleKeyValue;
UINT32 Index;
UINT32 PlistOffset;
UINT32 PlistSize;
UINT32 BinOffset;
UINT32 BinSize;
ASSERT (MkextContext != NULL);
ASSERT (Identifier != NULL);
MkextHeader = MkextContext->MkextHeader;
IsKextMatch = FALSE;
//
// Mkext v1.
//
if (MkextContext->MkextVersion == MKEXT_VERSION_V1) {
Status = InternalGetMkextV1KextOffsets (MkextContext, Identifier, &Index, &PlistOffset, &PlistSize, &BinOffset, &BinSize);
if (EFI_ERROR (Status)) {
return Status;
}
DEBUG ((
DEBUG_INFO,
"OCAK: Excluding mkext v1 %a - plist %x (%x), binary %x (%x)\n",
Identifier,
PlistOffset,
PlistSize,
BinOffset,
BinSize
));
//
// Zero out kext memory and kext list entry.
// A completely zero entry will be skipped by XNU, although a non-fatal error will be logged.
//
ZeroMem (&MkextContext->Mkext[PlistOffset], PlistSize);
ZeroMem (&MkextContext->Mkext[BinOffset], BinSize);
ZeroMem (&MkextHeader->V1.Kexts[Index], sizeof (MkextHeader->V1.Kexts[Index]));
//
// Mkext v2.
//
} else if (MkextContext->MkextVersion == MKEXT_VERSION_V2) {
//
// Enumerate bundle dicts and find kext to be removed.
//
PlistBundlesCount = XmlNodeChildren (MkextContext->MkextKexts);
for (Index = 0; Index < PlistBundlesCount; Index++) {
PlistBundle = PlistNodeCast (XmlNodeChild (MkextContext->MkextKexts, Index), PLIST_NODE_TYPE_DICT);
if (PlistBundle == NULL) {
continue;
}
PlistBundleCount = PlistDictChildren (PlistBundle);
for (PlistBundleIndex = 0; PlistBundleIndex < PlistBundleCount; PlistBundleIndex++) {
PlistBundleKey = PlistKeyValue (PlistDictChild (PlistBundle, PlistBundleIndex, &PlistBundleKeyValue));
if ((PlistBundleKey == NULL) || (PlistBundleKeyValue == NULL)) {
continue;
}
if (AsciiStrCmp (PlistBundleKey, INFO_BUNDLE_IDENTIFIER_KEY) == 0) {
KextIdentifier = XmlNodeContent (PlistBundleKeyValue);
if ((PlistNodeCast (PlistBundleKeyValue, PLIST_NODE_TYPE_STRING) == NULL) || (KextIdentifier == NULL)) {
DEBUG ((
DEBUG_INFO,
"OCAK: Plist value cannot be interpreted as string, or current kext identifier is null (dict index %u, plist %p, plist index %u)\n",
PlistBundleIndex,
PlistBundle,
Index
));
return EFI_NOT_FOUND;
}
}
if (AsciiStrCmp (PlistBundleKey, MKEXT_EXECUTABLE_KEY) == 0) {
if (!PlistIntegerValue (PlistBundleKeyValue, &BinOffset, sizeof (BinOffset), TRUE)) {
DEBUG ((
DEBUG_INFO,
"OCAK: Plist value cannot be interpreted as integer (dict index %u, plist %p, plist index %u)\n",
PlistBundleIndex,
PlistBundle,
Index
));
return EFI_NOT_FOUND;
}
}
}
if ( (KextIdentifier != NULL)
&& (AsciiStrCmp (KextIdentifier, Identifier) == 0)
&& (BinOffset > 0)
&& (BinOffset < MkextContext->MkextSize - sizeof (MKEXT_V2_FILE_ENTRY)))
{
IsKextMatch = TRUE;
break;
}
KextIdentifier = NULL;
BinOffset = 0;
}
//
// Bundle was not found, or invalid.
//
if (!IsKextMatch) {
return EFI_NOT_FOUND;
}
//
// Parse v2 binary header.
// We cannot support compressed binaries.
//
MkextV2FileEntry = (MKEXT_V2_FILE_ENTRY *)&MkextContext->Mkext[BinOffset];
if (MkextV2FileEntry->CompressedSize != 0) {
return EFI_UNSUPPORTED;
}
BinSize = SwapBytes32 (MkextV2FileEntry->FullSize);
DEBUG ((
DEBUG_INFO,
"OCAK: Excluding mkext v2 %a - dict index %u, plist %p, plist index %u, binary %x (%x)\n",
Identifier,
PlistBundleIndex,
PlistBundle,
Index,
BinOffset,
BinSize
));
//
// Erase kext data and drop from plist.
//
ZeroMem (&MkextContext->Mkext[BinOffset], BinSize + sizeof (MKEXT_V2_FILE_ENTRY));
InternalDropCachedMkextKext (MkextContext, KextIdentifier);
XmlNodeRemoveByIndex (MkextContext->MkextKexts, Index);
//
// Unsupported version.
//
} else {
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
EFI_STATUS
PatcherBlockKext (
IN OUT PATCHER_CONTEXT *Context
......
......@@ -259,27 +259,182 @@ InsertCachedMkextKext (
return MkextKext;
}
VOID
InternalDropCachedMkextKext (
IN OUT MKEXT_CONTEXT *Context,
IN CONST CHAR8 *Identifier
)
{
MKEXT_KEXT *MkextKext;
LIST_ENTRY *KextLink;
//
// Try to get cached kext.
//
MkextKext = NULL;
KextLink = GetFirstNode (&Context->CachedKexts);
while (!IsNull (&Context->CachedKexts, KextLink)) {
MkextKext = GET_MKEXT_KEXT_FROM_LINK (KextLink);
if (AsciiStrCmp (Identifier, MkextKext->Identifier) == 0) {
break;
}
KextLink = GetNextNode (&Context->CachedKexts, KextLink);
}
//
// Remove from cache linked list if found.
//
if (MkextKext != NULL) {
RemoveEntryList (&MkextKext->Link);
DEBUG ((DEBUG_VERBOSE, "OCAK: Removed %a from mkext cache\n", Identifier));
}
}
EFI_STATUS
InternalGetMkextV1KextOffsets (
IN OUT MKEXT_CONTEXT *Context,
IN CONST CHAR8 *Identifier,
OUT UINT32 *KextIndex,
OUT UINT32 *KextPlistOffset,
OUT UINT32 *KextPlistSize,
OUT UINT32 *KextBinOffset,
OUT UINT32 *KextBinSize
)
{
MKEXT_HEADER_ANY *MkextHeader;
UINT32 Index;
UINT32 PlistOffsetSize;
UINT32 BinOffsetSize;
BOOLEAN IsKextMatch;
UINT32 PlistOffset;
UINT32 PlistSize;
CHAR8 *PlistBuffer;
XML_DOCUMENT *PlistXml;
XML_NODE *PlistRoot;
UINT32 PlistBundleIndex;
UINT32 PlistBundleCount;
CONST CHAR8 *PlistBundleKey;
XML_NODE *PlistBundleKeyValue;
CONST CHAR8 *KextIdentifier;
UINT32 BinOffset;
UINT32 BinSize;
ASSERT (Context->MkextVersion == MKEXT_VERSION_V1);
MkextHeader = Context->MkextHeader;
IsKextMatch = FALSE;
PlistOffset = 0;
PlistSize = 0;
BinOffset = 0;
BinSize = 0;
for (Index = 0; Index < Context->NumKexts; Index++) {
//
// Binaryless and compressed kexts are not supported.
//
if ( (MkextHeader->V1.Kexts[Index].Plist.CompressedSize != 0)
|| (MkextHeader->V1.Kexts[Index].Binary.CompressedSize != 0)
|| (MkextHeader->V1.Kexts[Index].Binary.Offset == 0))
{
continue;
}
PlistOffset = SwapBytes32 (MkextHeader->V1.Kexts[Index].Plist.Offset);
PlistSize = SwapBytes32 (MkextHeader->V1.Kexts[Index].Plist.FullSize);
BinOffset = SwapBytes32 (MkextHeader->V1.Kexts[Index].Binary.Offset);
BinSize = SwapBytes32 (MkextHeader->V1.Kexts[Index].Binary.FullSize);
//
// Verify plist and binary are within bounds.
//
if ( BaseOverflowAddU32 (PlistOffset, PlistSize, &PlistOffsetSize)
|| (PlistOffsetSize > Context->MkextSize)
|| BaseOverflowAddU32 (BinOffset, BinSize, &BinOffsetSize)
|| (BinOffsetSize > Context->MkextSize))
{
return EFI_INVALID_PARAMETER;
}
PlistBuffer = AllocateCopyPool (PlistSize, &Context->Mkext[PlistOffset]);
if (PlistBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PlistXml = XmlDocumentParse (PlistBuffer, PlistSize, FALSE);
if (PlistXml == NULL) {
FreePool (PlistBuffer);
return EFI_OUT_OF_RESOURCES;
}
PlistRoot = PlistNodeCast (PlistDocumentRoot (PlistXml), PLIST_NODE_TYPE_DICT);
if (PlistRoot == NULL) {
XmlDocumentFree (PlistXml);
FreePool (PlistBuffer);
return EFI_OUT_OF_RESOURCES;
}
KextIdentifier = NULL;
PlistBundleCount = PlistDictChildren (PlistRoot);
for (PlistBundleIndex = 0; PlistBundleIndex < PlistBundleCount; PlistBundleIndex++) {
PlistBundleKey = PlistKeyValue (PlistDictChild (PlistRoot, PlistBundleIndex, &PlistBundleKeyValue));
if ((PlistBundleKey == NULL) || (PlistBundleKeyValue == NULL)) {
continue;
}
if (AsciiStrCmp (PlistBundleKey, INFO_BUNDLE_IDENTIFIER_KEY) == 0) {
KextIdentifier = XmlNodeContent (PlistBundleKeyValue);
break;
}
}
IsKextMatch = KextIdentifier != NULL && AsciiStrCmp (KextIdentifier, Identifier) == 0;
XmlDocumentFree (PlistXml);
FreePool (PlistBuffer);
if (IsKextMatch && (BinOffset > 0) && (BinSize > 0)) {
break;
}
}
//
// Bundle was not found, or invalid.
//
if (!IsKextMatch) {
return EFI_NOT_FOUND;
}
*KextIndex = Index;
*KextPlistOffset = PlistOffset;
*KextPlistSize = PlistSize;
*KextBinOffset = BinOffset;
*KextBinSize = BinSize;
return EFI_SUCCESS;
}
MKEXT_KEXT *
InternalCachedMkextKext (
IN OUT MKEXT_CONTEXT *Context,
IN CONST CHAR8 *Identifier
)
{
MKEXT_HEADER_ANY *MkextHeader;
EFI_STATUS Status;
MKEXT_V2_FILE_ENTRY *MkextV2FileEntry;
MKEXT_KEXT *MkextKext;
LIST_ENTRY *KextLink;
UINT32 Index;
UINT32 PlistOffsetSize;
UINT32 BinOffsetSize;
BOOLEAN IsKextMatch;
UINT32 PlistOffset;
UINT32 PlistSize;
CHAR8 *PlistBuffer;
XML_DOCUMENT *PlistXml;
XML_NODE *PlistRoot;
UINT32 PlistOffset;
UINT32 PlistSize;
UINT32 PlistBundlesCount;
XML_NODE *PlistBundle;
......@@ -292,8 +447,6 @@ InternalCachedMkextKext (
UINT32 KextBinOffset;
UINT32 KextBinSize;
MkextHeader = Context->MkextHeader;
//
// Try to get cached kext.
//
......@@ -317,78 +470,8 @@ InternalCachedMkextKext (
// Mkext v1.
//
if (Context->MkextVersion == MKEXT_VERSION_V1) {
for (Index = 0; Index < Context->NumKexts; Index++) {
//
// Do not cache binaryless or compressed kexts.
//
if ( (MkextHeader->V1.Kexts[Index].Plist.CompressedSize != 0)
|| (MkextHeader->V1.Kexts[Index].Binary.CompressedSize != 0)
|| (MkextHeader->V1.Kexts[Index].Binary.Offset == 0))
{
continue;
}
PlistOffset = SwapBytes32 (MkextHeader->V1.Kexts[Index].Plist.Offset);
PlistSize = SwapBytes32 (MkextHeader->V1.Kexts[Index].Plist.FullSize);
KextBinOffset = SwapBytes32 (MkextHeader->V1.Kexts[Index].Binary.Offset);
KextBinSize = SwapBytes32 (MkextHeader->V1.Kexts[Index].Binary.FullSize);
//
// Verify plist and binary are within bounds.
//
if ( BaseOverflowAddU32 (PlistOffset, PlistSize, &PlistOffsetSize)
|| (PlistOffsetSize > Context->MkextSize)
|| BaseOverflowAddU32 (KextBinOffset, KextBinSize, &BinOffsetSize)
|| (BinOffsetSize > Context->MkextSize))
{
return NULL;
}
PlistBuffer = AllocateCopyPool (PlistSize, &Context->Mkext[PlistOffset]);
if (PlistBuffer == NULL) {
return NULL;
}
PlistXml = XmlDocumentParse (PlistBuffer, PlistSize, FALSE);
if (PlistXml == NULL) {
FreePool (PlistBuffer);
return NULL;
}
PlistRoot = PlistNodeCast (PlistDocumentRoot (PlistXml), PLIST_NODE_TYPE_DICT);
if (PlistRoot == NULL) {
XmlDocumentFree (PlistXml);
FreePool (PlistBuffer);
return NULL;
}
KextIdentifier = NULL;
PlistBundleCount = PlistDictChildren (PlistRoot);
for (PlistBundleIndex = 0; PlistBundleIndex < PlistBundleCount; PlistBundleIndex++) {
PlistBundleKey = PlistKeyValue (PlistDictChild (PlistRoot, PlistBundleIndex, &PlistBundleKeyValue));
if ((PlistBundleKey == NULL) || (PlistBundleKeyValue == NULL)) {
continue;
}
if (AsciiStrCmp (PlistBundleKey, INFO_BUNDLE_IDENTIFIER_KEY) == 0) {
KextIdentifier = XmlNodeContent (PlistBundleKeyValue);
break;
}
}
IsKextMatch = KextIdentifier != NULL && AsciiStrCmp (KextIdentifier, Identifier) == 0;
XmlDocumentFree (PlistXml);
FreePool (PlistBuffer);
if (IsKextMatch && (KextBinOffset > 0) && (KextBinSize > 0)) {
break;
}
}
//
// Bundle was not found, or invalid.
//
if (!IsKextMatch) {
Status = InternalGetMkextV1KextOffsets (Context, Identifier, &Index, &PlistOffset, &PlistSize, &KextBinOffset, &KextBinSize);
if (Status != EFI_SUCCESS) {
return NULL;
}
......@@ -1551,13 +1634,19 @@ MkextContextBlock (
ASSERT (Context != NULL);
ASSERT (Identifier != NULL);
Status = PatcherInitContextFromMkext (&Patcher, Context, Identifier);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "OCAK: Failed to mkext find %a - %r\n", Identifier, Status));
return Status;
if (Exclude) {
Status = PatcherExcludeMkextKext (Context, Identifier);
} else {
Status = PatcherInitContextFromMkext (&Patcher, Context, Identifier);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "OCAK: Failed to mkext find %a - %r\n", Identifier, Status));
return Status;
}
Status = PatcherBlockKext (&Patcher);
}
return PatcherBlockKext (&Patcher);
return Status;
}
EFI_STATUS
......
......@@ -62,6 +62,23 @@ typedef struct {
MKEXT_KEXT_SIGNATURE \
))
VOID
InternalDropCachedMkextKext (
IN OUT MKEXT_CONTEXT *Context,
IN CONST CHAR8 *Identifier
);
EFI_STATUS
InternalGetMkextV1KextOffsets (
IN OUT MKEXT_CONTEXT *Context,
IN CONST CHAR8 *Identifier,
OUT UINT32 *KextIndex,
OUT UINT32 *KextPlistOffset,
OUT UINT32 *KextPlistSize,
OUT UINT32 *KextBinOffset,
OUT UINT32 *KextBinSize
);
MKEXT_KEXT *
InternalCachedMkextKext (
IN OUT MKEXT_CONTEXT *Context,
......
......@@ -611,6 +611,8 @@ InternalDetectAppleProcessorType (
case CPU_MODEL_ICELAKE_SP: // 0x9F FIXME - unknown, for now
case CPU_MODEL_TIGERLAKE_U: // 0x8C FIXME - unknown, for now
case CPU_MODEL_ALDERLAKE_S: // 0x97 FIXME - unknown, for now
case CPU_MODEL_RAPTORLAKE_S: // 0xB7 FIXME - unknown, for now
case CPU_MODEL_RAPTORLAKE_HX: // 0xBF FIXME - unknown, for now
if (AppleMajorType == AppleProcessorMajorM3) {
// MB101 (m3 7Y32)
return AppleProcessorTypeCoreM3Type7; // 0x0C07
......@@ -648,6 +650,7 @@ InternalDetectAppleProcessorType (
if (AppleMajorType == AppleProcessorMajorI9) {
// FIXME: find a dump from MBP151 with i9-8950HK,
// for now using an ideal value (0x1009), comparing to 0x0709 (used on MBP151, i7-8850H and MM81, i7-8700B)
// MBP161 (i9-9980HK)
return AppleProcessorTypeCorei9Type9; // 0x1009
}
......
......@@ -746,6 +746,23 @@ ScanAmdProcessor (
//
Cpu->CoreCount = Cpu->ThreadCount;
break;
case AMD_CPU_EXT_FAMILY_0FH:
if (Cpu->CPUFrequencyFromVMT == 0) {
// FIXME: Please refer to FIXME(1) for the MSR used here.
CofVid = AsmReadMsr64 (K8_FIDVID_STATUS);
CoreFrequencyID = (UINT8)BitFieldRead64 (CofVid, 0, 5);
// Frequency ID directly specifies the clock multiplier as a 6-bit coding.
// Coding starts at x4.
MaxBusRatio = (CoreFrequencyID / 2) + 4;
}
//
// AMD 0Fh CPUs don't support hyperthreading,
// so the core count is equal to the thread count.
//
Cpu->CoreCount = Cpu->ThreadCount;
break;
default:
return;
}
......
......@@ -402,12 +402,15 @@ InternalContextConstruct (
UINT32 ImageHeight;
BOOLEAN Result;
BOOLEAN AllowLessSize;
BOOLEAN UseGenericLabel;
ASSERT (Context != NULL);
Context->Scale = 1;
UiScaleSize = sizeof (Context->Scale);
UseGenericLabel = (Picker->PickerAttributes & OC_ATTR_USE_GENERIC_LABEL_IMAGE) != 0;
Status = gRT->GetVariable (
APPLE_UI_SCALE_VARIABLE_NAME,
&gAppleVendorVariableGuid,
......@@ -597,18 +600,22 @@ InternalContextConstruct (
}
for (Index = 0; Index < LABEL_NUM_TOTAL; ++Index) {
Status = LoadLabelFromStorage (
Storage,
mLabelNames[Index],
Context->Scale,
Context->LightBackground,
&Context->Labels[Index]
);
if (EFI_ERROR (Status)) {
if (!UseGenericLabel) {
Context->Labels[Index].Buffer = NULL;
DEBUG ((DEBUG_WARN, "OCUI: Failed to load images\n"));
InternalContextDestruct (Context);
return EFI_UNSUPPORTED;
} else {
Status = LoadLabelFromStorage (
Storage,
mLabelNames[Index],
Context->Scale,
Context->LightBackground,
&Context->Labels[Index]
);
if (EFI_ERROR (Status)) {
Context->Labels[Index].Buffer = NULL;
DEBUG ((DEBUG_WARN, "OCUI: Failed to load images\n"));
InternalContextDestruct (Context);
return EFI_UNSUPPORTED;
}
}
}
......
......@@ -123,7 +123,8 @@ typedef struct _BOOT_PICKER_GUI_CONTEXT {
BOOLEAN HideAuxiliary;
BOOLEAN Refresh;
BOOLEAN LightBackground;
BOOLEAN DoneIntroAnimation;
BOOLEAN UsePasswordEaseIn;
BOOLEAN UseMenuEaseIn;
BOOLEAN ReadyToBoot;
UINT8 Scale;
UINT8 VoAction;
......
......@@ -102,8 +102,18 @@ OcShowMenuByOc (
*ChosenBootEntry = NULL;
OcSetInitialCursorOffset ();
mGuiContext.BootEntry = NULL;
mGuiContext.ReadyToBoot = FALSE;
mGuiContext.BootEntry = NULL;
mGuiContext.ReadyToBoot = FALSE;
//
// When enabled, re-run intro animation on each entry into menu, to avoid
// stuck animation which happens otherwise, if a menu item which returns to
// the menu is selected before the animation ends.
// Do not play intro animation for visually impaired users.
//
mGuiContext.UseMenuEaseIn = !BootContext->PickerContext->PickerAudioAssist
&& ((BootContext->PickerContext->PickerAttributes & OC_ATTR_REDUCE_MOTION) == 0);
mGuiContext.HideAuxiliary = BootContext->PickerContext->HideAuxiliary;
mGuiContext.Refresh = FALSE;
mGuiContext.PickerContext = BootContext->PickerContext;
......@@ -115,12 +125,6 @@ OcShowMenuByOc (
}
mDrawContext.TimeOutSeconds = BootContext->PickerContext->TimeoutSeconds;
//
// Do not play intro animation for blind.
//
if (BootContext->PickerContext->PickerAudioAssist) {
mGuiContext.DoneIntroAnimation = TRUE;
}
Status = BootPickerViewInitialize (
&mDrawContext,
......@@ -248,12 +252,8 @@ OcShowPasswordByOc (
mDrawContext.TimeOutSeconds = 0;
//
// Do not play intro animation for blind.
//
if (Context->PickerAudioAssist) {
mGuiContext.DoneIntroAnimation = TRUE;
}
mGuiContext.UsePasswordEaseIn = !Context->PickerAudioAssist
&& ((Context->PickerAttributes & OC_ATTR_REDUCE_MOTION) == 0);
Status = PasswordViewInitialize (
&mDrawContext,
......
......@@ -1439,6 +1439,11 @@ CopyLabel (
IN CONST GUI_IMAGE *Source
)
{
if (Source->Buffer == NULL) {
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
Destination->Width = Source->Width;
Destination->Height = Source->Height;
Destination->Buffer = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)AllocateCopyPool (
......@@ -1782,6 +1787,8 @@ InternalBootPickerAnimateImageList (
return FALSE;
}
STATIC UINT32 mPrevSine;
STATIC GUI_INTERPOLATION mBpAnimInfoSinMove = {
GuiInterpolTypeSmooth,
0,
......@@ -1802,6 +1809,8 @@ InitBpAnimIntro (
// mBootPickerContainer between animation initialisation and start.
//
mBootPickerContainer.Obj.OffsetX += 35 * DrawContext->Scale;
mPrevSine = 0;
}
BOOLEAN
......@@ -1811,8 +1820,6 @@ InternalBootPickerAnimateIntro (
IN UINT64 CurrentTime
)
{
STATIC UINT32 PrevSine = 0;
UINT8 Opacity;
UINT32 InterpolVal;
UINT32 DeltaSine;
......@@ -1857,9 +1864,9 @@ InternalBootPickerAnimateIntro (
}
InterpolVal = GuiGetInterpolatedValue (&mBpAnimInfoSinMove, CurrentTime);
DeltaSine = InterpolVal - PrevSine;
DeltaSine = InterpolVal - mPrevSine;
mBootPickerContainer.Obj.OffsetX -= DeltaSine;
PrevSine = InterpolVal;
mPrevSine = InterpolVal;
//
// Draw the full dimension of the inner container to implicitly cover the
// scroll buttons with the off-screen entries.
......@@ -2141,7 +2148,7 @@ BootPickerViewInitialize (
InitializeListHead (&mBootPickerLabelAnimation.Link);
if (!GuiContext->DoneIntroAnimation) {
if (GuiContext->UseMenuEaseIn) {
InitBpAnimIntro (DrawContext);
InsertHeadList (&DrawContext->Animations, &mBootPickerIntroAnimation.Link);
//
......@@ -2150,8 +2157,6 @@ BootPickerViewInitialize (
mBootPickerContainer.Obj.Opacity = 0;
mBootPickerLeftScroll.Hdr.Obj.Opacity = 0;
mBootPickerRightScroll.Hdr.Obj.Opacity = 0;
GuiContext->DoneIntroAnimation = TRUE;
} else {
//
// The late code assumes the scroll buttons are visible by default.
......@@ -2164,7 +2169,9 @@ BootPickerViewInitialize (
mCommonActionButtonsContainer.Obj.Opacity = 0xFF;
}
if (DrawContext->TimeOutSeconds > 0) {
if ( !GuiContext->PickerContext->PickerAudioAssist
&& (DrawContext->TimeOutSeconds > 0))
{
STATIC GUI_ANIMATION PickerAnim2;
PickerAnim2.Context = NULL;
PickerAnim2.Animate = InternalBootPickerAnimateTimeout;
......
......@@ -834,7 +834,7 @@ PasswordViewInitialize (
mPasswordBoxContainer.Obj.OffsetX = (DrawContext->Screen.Width - mPasswordBox.Hdr.Obj.Width) / 2;
mPasswordBoxContainer.Obj.OffsetY = mPasswordLock.Obj.OffsetY + mPasswordLock.Obj.Height + PASSWORD_BOX_SPACE * DrawContext->Scale - BoxOffset;
if (!GuiContext->PickerContext->PickerAudioAssist) {
if (GuiContext->UsePasswordEaseIn) {
//
// Fade-in the entire screen.
//
......
......@@ -40,9 +40,30 @@ static kern_return_t GetOFVariable(char *name, CFStringRef *nameRef,
*valueRef = IORegistryEntryCreateCFProperty(gOptionsRef, *nameRef, 0, 0);
if (*valueRef == 0) return kIOReturnNotFound;
if (CFGetTypeID(*valueRef) == CFStringGetTypeID()) {
CFTypeRef oldValue = *valueRef;
*valueRef = CFStringCreateExternalRepresentation(kCFAllocatorDefault, *valueRef, kCFStringEncodingUTF8, 0);
CFRelease(oldValue);
if (*valueRef == 0) return kIOReturnNotFound;
}
return KERN_SUCCESS;
}
static CFMutableDictionaryRef dict4;
static void ConvertStringValues (const void* key, const void* value, void* context) {
if (CFGetTypeID(value) == CFStringGetTypeID()) {
CFDataRef dataValue = CFStringCreateExternalRepresentation(kCFAllocatorDefault, value, kCFStringEncodingUTF8, 0);
if (dataValue != NULL) {
CFDictionaryAddValue(dict4, key, dataValue);
}
} else {
CFDictionaryAddValue(dict4, key, value);
}
}
CFDictionaryRef CreateMyDictionary(void) {
char *guid;
......@@ -69,8 +90,17 @@ CFDictionaryRef CreateMyDictionary(void) {
if (result != KERN_SUCCESS) {
errx(1, "Error getting the firmware variables: %s", mach_error_string(result));
}
CFDictionarySetValue(dict0, CFSTR("7C436110-AB2A-4BBB-A880-FE41995C9F82"), dict1);
// To work round limitations of OpenCore XML parser (i.e. XML entities not
// automatically processed), force all string values to save as data.
dict4 = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionaryApplyFunction(dict1, ConvertStringValues, NULL);
CFDictionarySetValue(dict0, CFSTR("7C436110-AB2A-4BBB-A880-FE41995C9F82"), dict4);
CFRelease(dict1);
CFRelease(dict4);
CFMutableDictionaryRef dict2 = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
......