提交 04553264 编写于 作者: M MikeBeaton

AudioDxe: Add --restore-nosnoop flag

上级 f3004e2e
......@@ -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)
......
234bf876a6e9ec92239d908af9aae409
8fe92652e6b6bf444b97fb743cae2a52
......@@ -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}
......
\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}.
\DIFdelbegin %DIFDELCMD < \end{itemize}
%DIFDELCMD < %%%
\DIFdelend
\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}
\emph{Note}: AudioDxe is a staging driver, refer to \href{https://github.com/acidanthera/bugtracker/issues/740}{acidanthera/bugtracker\#740}
for known issues.
\DIFaddend
\subsection{Properties}\label{uefiprops}
......
......@@ -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.<BR><BR>
## TRUE - Register event to reset the controller on Exit Boot Services.<BR>
## FALSE - Do not reset the contoller on Exit Boot Services.<BR>
## @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.<BR><BR>
## TRUE - Use EFI_OPEN_PROTOCOL_GET_PROTOCOL if EFI_OPEN_PROTOCOL_BY_DRIVER fails.<BR>
......
......@@ -32,8 +32,9 @@
#include <Library/OcBootManagementLib.h>
#include <Library/OcFlexArrayLib.h>
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);
......
......@@ -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
......@@ -64,7 +64,6 @@
[FeaturePcd]
gOpenCorePkgTokenSpaceGuid.PcdAudioCodecErrorOnNoOutputs ## CONSUMES
gOpenCorePkgTokenSpaceGuid.PcdAudioControllerResetPciOnExitBootServices ## CONSUMES
gOpenCorePkgTokenSpaceGuid.PcdAudioControllerTryProtocolGetMode ## CONSUMES
gOpenCorePkgTokenSpaceGuid.PcdAudioControllerUsePinCapsForOutputs ## CONSUMES
......
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册