diff --git a/Changelog.md b/Changelog.md
index 8ea179f5..060e2896 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,6 +2,7 @@ OpenCore Changelog
==================
#### v0.7.9
- Added auto-detect `macOS Installer` volume name for use when `.disk_label` file cannot be displayed
+- Added `--restore-nosnoop` flag to AudioDxe, making v0.7.7 fix for Windows sound opt-in
#### v0.7.8
- Updated ocvalidate to warn about insecure `DmgLoading` with secure `SecureBootModel` (already disallowed in runtime)
diff --git a/Docs/Configuration.md5 b/Docs/Configuration.md5
index 7e39c18a..80ebff7f 100644
--- a/Docs/Configuration.md5
+++ b/Docs/Configuration.md5
@@ -1 +1 @@
-234bf876a6e9ec92239d908af9aae409
+8fe92652e6b6bf444b97fb743cae2a52
diff --git a/Docs/Configuration.pdf b/Docs/Configuration.pdf
index 0087d59c..de99604c 100644
Binary files a/Docs/Configuration.pdf and b/Docs/Configuration.pdf differ
diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex
index e6875115..35889977 100755
--- a/Docs/Configuration.tex
+++ b/Docs/Configuration.tex
@@ -6537,6 +6537,9 @@ with the boot menu.
High Definition Audio support driver in UEFI firmware for most Intel and some other analog audio controllers.
+\emph{Note}: AudioDxe is a staging driver, refer to \href{https://github.com/acidanthera/bugtracker/issues/740}{acidanthera/bugtracker\#740}
+for known issues.
+
\subsubsection{Configuration}
Most UEFI audio configuration is handled via the \hyperref[uefiaudioprops]{\texttt{UEFI Audio Properties}}
@@ -6590,10 +6593,15 @@ on most Apple hardware, and possibly some others) may be specified in \texttt{UE
Values for driver parameters can be specified in hexadecimal beginning with \texttt{0x} or
in decimal, e.g. \texttt{-{}-gpio-pins=0x12} or \texttt{-{}-gpio-pins=18}.
-\end{itemize}
-\emph{Note}: AudioDxe is a staging driver, refer to \href{https://github.com/acidanthera/bugtracker/issues/740}{acidanthera/bugtracker\#740}
-for known issues.
+ \item \texttt{-{}-restore-nosnoop} - Boolean flag, enabled if present. \medskip
+
+ AudioDxe clears the Intel HDA No Snoop Enable (NSNPEN) bit. On some systems, this change must
+ be reversed on exit in order to avoid breaking sound in Windows. If so, this flag should
+ be added to AudioDxe driver arguments.
+ Not enabled by default, since restoring the flag can prevent sound from working in macOS on
+ some other systems. \medskip
+\end{itemize}
\subsection{Properties}\label{uefiprops}
diff --git a/Docs/Differences/Differences.pdf b/Docs/Differences/Differences.pdf
index ac4304ba..e34f7cfb 100644
Binary files a/Docs/Differences/Differences.pdf and b/Docs/Differences/Differences.pdf differ
diff --git a/Docs/Differences/Differences.tex b/Docs/Differences/Differences.tex
index 4d7d8ce9..9d22d8da 100644
--- a/Docs/Differences/Differences.tex
+++ b/Docs/Differences/Differences.tex
@@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
-%DIF DEL PreviousConfiguration.tex Mon Feb 7 23:02:40 2022
-%DIF ADD ../Configuration.tex Mon Feb 7 23:05:00 2022
+%DIF DEL PreviousConfiguration.tex Wed Feb 9 09:37:10 2022
+%DIF ADD ../Configuration.tex Wed Feb 9 23:42:58 2022
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
@@ -6597,7 +6597,11 @@ with the boot menu.
High Definition Audio support driver in UEFI firmware for most Intel and some other analog audio controllers.
-\subsubsection{Configuration}
+\DIFaddbegin \emph{\DIFadd{Note}}\DIFadd{: AudioDxe is a staging driver, refer to }\href{https://github.com/acidanthera/bugtracker/issues/740}{\DIFadd{acidanthera/bugtracker\#740}}
+\DIFadd{for known issues.
+}
+
+\DIFaddend \subsubsection{Configuration}
Most UEFI audio configuration is handled via the \hyperref[uefiaudioprops]{\texttt{UEFI Audio Properties}}
section, but if required the following additonal configuration options (which are needed to produce sound
@@ -6650,10 +6654,22 @@ on most Apple hardware, and possibly some others) may be specified in \texttt{UE
Values for driver parameters can be specified in hexadecimal beginning with \texttt{0x} or
in decimal, e.g. \texttt{-{}-gpio-pins=0x12} or \texttt{-{}-gpio-pins=18}.
-\end{itemize}
+\DIFdelbegin %DIFDELCMD < \end{itemize}
+%DIFDELCMD < %%%
+\DIFdelend
-\emph{Note}: AudioDxe is a staging driver, refer to \href{https://github.com/acidanthera/bugtracker/issues/740}{acidanthera/bugtracker\#740}
-for known issues.
+ \DIFdelbegin \emph{\DIFdel{Note}}%DIFAUXCMD
+\DIFdel{: AudioDxe is a staging driver, refer to }\href{https://github.com/acidanthera/bugtracker/issues/740}{\DIFdel{acidanthera/bugtracker\#740}}
+%DIFAUXCMD
+\DIFdel{for known issues. }\DIFdelend \DIFaddbegin \item \texttt{\DIFadd{-}{}\DIFadd{-restore-nosnoop}} \DIFadd{- Boolean flag, enabled if present. }\medskip
+
+ \DIFadd{AudioDxe clears the Intel HDA No Snoop Enable (NSNPEN) bit. On some systems, this change must
+ be reversed on exit in order to avoid breaking sound in Windows. If so, this flag should
+ be added to AudioDxe driver arguments.
+ Not enabled by default, since restoring the flag can prevent sound from working in macOS on
+ some other systems. }\medskip
+\end{itemize}
+\DIFaddend
\subsection{Properties}\label{uefiprops}
diff --git a/Docs/Errata/Errata.pdf b/Docs/Errata/Errata.pdf
index f0e6b03b..385b11c2 100644
Binary files a/Docs/Errata/Errata.pdf and b/Docs/Errata/Errata.pdf differ
diff --git a/OpenCorePkg.dec b/OpenCorePkg.dec
index 362c9a32..e738d235 100755
--- a/OpenCorePkg.dec
+++ b/OpenCorePkg.dec
@@ -722,12 +722,6 @@
## @Prompt Audio codec setup code should produce an error when no valid output bits are specified.
gOpenCorePkgTokenSpaceGuid.PcdAudioCodecErrorOnNoOutputs|TRUE|BOOLEAN|0x00000005
- ## Indicates if AudioDxe will try to reset the PCI associated with the HDA controller on Exit Boot Services.
- ## TRUE - Register event to reset the controller on Exit Boot Services.
- ## FALSE - Do not reset the contoller on Exit Boot Services.
- ## @Prompt AudioDxe will try to reset the HDA controller on Exit Boot Services.
- gOpenCorePkgTokenSpaceGuid.PcdAudioControllerResetPciOnExitBootServices|TRUE|BOOLEAN|0x00000006
-
## Indicates if AudioDxe will try EFI_OPEN_PROTOCOL_GET_PROTOCOL if EFI_OPEN_PROTOCOL_BY_DRIVER
## fails with access denied.
## TRUE - Use EFI_OPEN_PROTOCOL_GET_PROTOCOL if EFI_OPEN_PROTOCOL_BY_DRIVER fails.
diff --git a/Staging/AudioDxe/AudioDxe.c b/Staging/AudioDxe/AudioDxe.c
index 1487a278..79be92ee 100644
--- a/Staging/AudioDxe/AudioDxe.c
+++ b/Staging/AudioDxe/AudioDxe.c
@@ -32,8 +32,9 @@
#include
#include
-UINTN gGpioSetupStageMask = GPIO_SETUP_STAGE_NONE;
-UINTN gGpioPinMask = GPIO_PIN_MASK_AUTO;
+UINTN gGpioSetupStageMask = GPIO_SETUP_STAGE_NONE;
+UINTN gGpioPinMask = GPIO_PIN_MASK_AUTO;
+BOOLEAN gRestoreNoSnoop = FALSE;
/**
HdaController Driver Binding.
@@ -87,11 +88,13 @@ AudioDxeInit(
Status = OcParseLoadOptions (LoadedImage, &ParsedLoadOptions);
if (!EFI_ERROR (Status)) {
+ gRestoreNoSnoop = OcHasParsedVar (ParsedLoadOptions, L"--restore-nosnoop", TRUE);
+
Status = OcParsedVarsGetInt (ParsedLoadOptions, L"--gpio-setup", &gGpioSetupStageMask, TRUE);
if (Status == EFI_NOT_FOUND && OcHasParsedVar (ParsedLoadOptions, L"--gpio-setup", TRUE)) {
gGpioSetupStageMask = GPIO_SETUP_STAGE_ALL;
}
- DEBUG ((DEBUG_INFO, "HDA: GPIO setup stages 0x%X\n", gGpioSetupStageMask));
+ DEBUG ((DEBUG_INFO, "HDA: GPIO setup stages 0x%X, restore NSNPEN %d\n", gGpioSetupStageMask, gRestoreNoSnoop));
if (gGpioSetupStageMask != GPIO_SETUP_STAGE_NONE) {
OcParsedVarsGetInt (ParsedLoadOptions, L"--gpio-pins", &gGpioPinMask, TRUE);
diff --git a/Staging/AudioDxe/AudioDxe.h b/Staging/AudioDxe/AudioDxe.h
index 20479e5d..d57204df 100644
--- a/Staging/AudioDxe/AudioDxe.h
+++ b/Staging/AudioDxe/AudioDxe.h
@@ -87,7 +87,8 @@ extern EFI_AUDIO_DECODE_PROTOCOL gEfiAudioDecodeProtocol;
//
// Stored parsed config.
//
-extern UINTN gGpioSetupStageMask;
-extern UINTN gGpioPinMask;
+extern UINTN gGpioSetupStageMask;
+extern UINTN gGpioPinMask;
+extern BOOLEAN gRestoreNoSnoop;
#endif // EFI_AUDIODXE_H
diff --git a/Staging/AudioDxe/AudioDxe.inf b/Staging/AudioDxe/AudioDxe.inf
index 822c078c..326850ee 100644
--- a/Staging/AudioDxe/AudioDxe.inf
+++ b/Staging/AudioDxe/AudioDxe.inf
@@ -64,7 +64,6 @@
[FeaturePcd]
gOpenCorePkgTokenSpaceGuid.PcdAudioCodecErrorOnNoOutputs ## CONSUMES
- gOpenCorePkgTokenSpaceGuid.PcdAudioControllerResetPciOnExitBootServices ## CONSUMES
gOpenCorePkgTokenSpaceGuid.PcdAudioControllerTryProtocolGetMode ## CONSUMES
gOpenCorePkgTokenSpaceGuid.PcdAudioControllerUsePinCapsForOutputs ## CONSUMES
diff --git a/Staging/AudioDxe/HdaController/HdaController.c b/Staging/AudioDxe/HdaController/HdaController.c
index 85ec3091..563c7221 100644
--- a/Staging/AudioDxe/HdaController/HdaController.c
+++ b/Staging/AudioDxe/HdaController/HdaController.c
@@ -362,9 +362,10 @@ HdaControllerExitBootServicesHandler (
//
// Restore No Snoop Enable bit at Exit Boot Services to avoid breaking in-OS sound in Windows with some firmware.
- // Note: Windows sound is fine even without this on many systems where AudioDxe disables No Snoop.
+ // Windows sound is fine even without this on many systems where AudioDxe disables No Snoop, and doing this
+ // (even though it should only be restoring the previous value) breaks macOS sound on some systems.
// REF: https://github.com/acidanthera/bugtracker/issues/1909
- // REF: https://github.com/acidanthera/bugtracker/issues/740#issuecomment-998762564
+ // REF: https://github.com/acidanthera/bugtracker/issues/1945
// REF: Intel I/O Controller Hub 9 (ICH9) Family Datasheet (DEVC - Device Conrol Register/NSNPEN)
//
HdaControllerRestoreNoSnoopEn (HdaControllerDev);
@@ -415,8 +416,10 @@ HdaControllerReset (
return EFI_SUCCESS;
}
- if (PcdGetBool (PcdAudioControllerResetPciOnExitBootServices)
- && HdaControllerDev->ExitBootServicesEvent == NULL) {
+ //
+ // Currently restore NSNPEN is the only functionality needed at ExitBootServices.
+ //
+ if (gRestoreNoSnoop && HdaControllerDev->ExitBootServicesEvent == NULL) {
Status = gBS->CreateEvent (
EVT_SIGNAL_EXIT_BOOT_SERVICES,
TPL_CALLBACK,