Skip to content

Commit

Permalink
OcApfsLib: Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Jun 5, 2020
1 parent 97cfaa4 commit c63ecf5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 11 deletions.
Binary file modified Docs/Configuration.pdf
Binary file not shown.
7 changes: 5 additions & 2 deletions Docs/Configuration.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,7 @@ \subsection{Boot Properties}\label{miscbootprops}
\item Entry is macOS recovery.
\item Entry is macOS Time Machine.
\item Entry is explicitly marked as \texttt{Auxiliary}.
\item Entry is system (e.g. \texttt{Clean NVRAM}).
\item Entry is system (e.g. \texttt{Reset NVRAM}).
\end{itemize}

To see all entries picker menu needs to be reloaded in extended mode by pressing
Expand Down Expand Up @@ -2798,6 +2798,9 @@ \subsection{Security Properties}\label{miscsecurityprops}
\textbf{Description}: Allow \texttt{CMD+OPT+P+R} handling and enable
showing \texttt{NVRAM Reset} entry in boot picker.

\emph{Note}: Resetting NVRAM will also erase all the boot options
otherwise not backed up with bless (e.g. Linux).

\item
\texttt{AllowSetDefault}\\
\textbf{Type}: \texttt{plist\ boolean}\\
Expand Down Expand Up @@ -5276,7 +5279,7 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
firmwares, ASUS firmwares on APTIO V in particular, have bugs. For them scanning is
implemented improperly, and firmware preferences may get accidentally corrupted
due to \texttt{BootOrder} entry duplication (each option will be added twice) making
it impossible to boot without cleaning NVRAM.
it impossible to boot without resetting NVRAM.

To trigger the bug one should have some valid boot options (e.g. OpenCore) and then
install Windows with \texttt{RequestBootVarRouting} enabled. As Windows bootloader
Expand Down
Binary file modified Docs/Differences/Differences.pdf
Binary file not shown.
19 changes: 12 additions & 7 deletions Docs/Differences/Differences.tex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Tue Jun 2 03:55:18 2020
%DIF ADD ../Configuration.tex Tue Jun 2 08:06:06 2020
%DIF ADD ../Configuration.tex Fri Jun 5 12:29:25 2020

\usepackage{lmodern}
\usepackage{amssymb,amsmath}
Expand Down Expand Up @@ -176,9 +176,10 @@ \section{Introduction}\label{introduction}
operating system. It is to be read as the official clarification of expected
OpenCore behaviour. All deviations, if found in published OpenCore releases,
shall be considered documentation or implementation bugs, and are requested to be
reported through \href{https://github.com/acidanthera/bugtracker}{Acidanthera Bugtracker}\DIFaddbegin \DIFadd{.
Errata sheet is available in
}\href{https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/Errata/Errata.pdf}{OpenCorePkg repository}\DIFaddend .
reported through \href{https://github.com/acidanthera/bugtracker}{Acidanthera Bugtracker}.
\DIFaddbegin \DIFadd{Errata sheet is available in
}\href{https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/Errata/Errata.pdf}{OpenCorePkg repository}\DIFadd{.
}\DIFaddend

This document is structured as a specification, and is not meant to provide a step by
step algorithm for configuring end-user board support package (BSP). The intended audience
Expand Down Expand Up @@ -2456,7 +2457,7 @@ \subsection{Boot Properties}\label{miscbootprops}
\item Entry is macOS recovery.
\item Entry is macOS Time Machine.
\item Entry is explicitly marked as \texttt{Auxiliary}.
\item Entry is system (e.g. \texttt{Clean NVRAM}).
\item Entry is system (e.g. \texttt{\DIFdelbegin \DIFdel{Clean }\DIFdelend \DIFaddbegin \DIFadd{Reset }\DIFaddend NVRAM}).
\end{itemize}

To see all entries picker menu needs to be reloaded in extended mode by pressing
Expand Down Expand Up @@ -2858,7 +2859,11 @@ \subsection{Security Properties}\label{miscsecurityprops}
\textbf{Description}: Allow \texttt{CMD+OPT+P+R} handling and enable
showing \texttt{NVRAM Reset} entry in boot picker.

\item
\DIFaddbegin \emph{\DIFadd{Note}}\DIFadd{: Resetting NVRAM will also erase all the boot options
otherwise not backed up with bless (e.g. Linux).
}

\DIFaddend \item
\texttt{AllowSetDefault}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
Expand Down Expand Up @@ -5336,7 +5341,7 @@ \subsection{Quirks Properties}\label{uefiquirkprops}
firmwares, ASUS firmwares on APTIO V in particular, have bugs. For them scanning is
implemented improperly, and firmware preferences may get accidentally corrupted
due to \texttt{BootOrder} entry duplication (each option will be added twice) making
it impossible to boot without cleaning NVRAM.
it impossible to boot without \DIFdelbegin \DIFdel{cleaning }\DIFdelend \DIFaddbegin \DIFadd{resetting }\DIFaddend NVRAM.

To trigger the bug one should have some valid boot options (e.g. OpenCore) and then
install Windows with \texttt{RequestBootVarRouting} enabled. As Windows bootloader
Expand Down
Binary file modified Docs/Errata/Errata.pdf
Binary file not shown.
28 changes: 26 additions & 2 deletions Library/OcApfsLib/OcApfsIo.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ ApfsReadJumpStart (
JumpStart
);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_INFO,
"OCJS: Block (P:%d|F:%d) read req %Lx -> %Lx of %x (mask %u, mul %u) - %r\n",
BlockIo == PrivateData->BlockIo,
PrivateData->IsFusion,
PrivateData->EfiJumpStart,
Lba,
PrivateData->ApfsBlockSize,
PrivateData->FusionMask,
PrivateData->LbaMultiplier,
Status
));
FreePool (JumpStart);
return Status;
}
Expand All @@ -159,6 +171,7 @@ ApfsReadJumpStart (
// Version is not checked by ApfsJumpStart driver.
//
if (JumpStart->Magic != APFS_NX_EFI_JUMPSTART_MAGIC) {
DEBUG ((DEBUG_INFO, "OCJS: Unknown JSDR magic %08x, expected %08x\n", JumpStart->Magic, APFS_NX_EFI_JUMPSTART_MAGIC));
FreePool (JumpStart);
return EFI_UNSUPPORTED;
}
Expand All @@ -176,6 +189,7 @@ ApfsReadJumpStart (
//
MaxExtents = (PrivateData->ApfsBlockSize - sizeof (*JumpStart)) / sizeof (JumpStart->RecordExtents[0]);
if (MaxExtents < JumpStart->NumExtents) {
DEBUG ((DEBUG_INFO, "OCJS: Invalid extent count %u / %u\n", JumpStart->NumExtents, MaxExtents));
FreePool (JumpStart);
return EFI_UNSUPPORTED;
}
Expand Down Expand Up @@ -395,7 +409,12 @@ InternalApfsReadDriver (
&JumpStart
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "OCJS: Failed to read JumpStart for %g\n", &PrivateData->LocationInfo.ContainerUuid));
DEBUG ((
DEBUG_INFO,
"OCJS: Failed to read JumpStart for %g - %r\n",
&PrivateData->LocationInfo.ContainerUuid,
Status
));
return Status;
}

Expand All @@ -409,7 +428,12 @@ InternalApfsReadDriver (
FreePool (JumpStart);

if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "OCJS: Failed to read driver for %g\n", &PrivateData->LocationInfo.ContainerUuid));
DEBUG ((
DEBUG_INFO,
"OCJS: Failed to read driver for %g - %r\n",
&PrivateData->LocationInfo.ContainerUuid,
Status
));
return Status;
}

Expand Down

0 comments on commit c63ecf5

Please sign in to comment.