Skip to content

Commit

Permalink
OcAppleKernelLib: Correct CustomPciSerialDevice patch, thanks @joevt
Browse files Browse the repository at this point in the history
  • Loading branch information
PMheart committed May 3, 2022
1 parent 72ebddc commit a825d00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Library/OcAppleKernelLib/CommonPatches.c
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ PatchCustomPciSerialDevice (
EFI_STATUS Status;

Status = EFI_INVALID_PARAMETER;
if ( ((mPmioRegisterBase != 0) && (mPmioRegisterStride > 1))
if ( ((mPmioRegisterBase != 0) && (mPmioRegisterStride != 0))
&& ((mPmioRegisterBase + 7U * mPmioRegisterStride) <= MAX_UINT16))
{
Status = PatchCustomPciSerialPmio (Patcher);
Expand Down
4 changes: 2 additions & 2 deletions Library/OcMainLib/OpenCoreKernelPatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ OcKernelApplyPatches (
if (Config->Misc.Serial.Override && Config->Kernel.Quirks.CustomPciSerialDevice) {
RegisterBase = GetSerialRegisterBase ();
RegisterStride = PatchPcdGet32 (PcdSerialRegisterStride);
if ( ((RegisterBase != 0) && (RegisterStride > 1))
&& (RegisterBase != 0x3F8U))
if ( ((RegisterBase != 0 && RegisterStride != 0))
&& (RegisterBase != 0x3F8U || RegisterStride != 1))
{
PatchSetPciSerialDevice (RegisterBase, RegisterStride);
OcKernelApplyQuirk (KernelQuirkCustomPciSerialDevice, CacheType, DarwinVersion, NULL, &KernelPatcher);
Expand Down

0 comments on commit a825d00

Please sign in to comment.