diff --git a/Changelog.md b/Changelog.md index 7b57bab6128ce944e9206dd65c6b8342fcde8ce2..49312819aaa210832021dfed434f298ba6946620 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,8 @@ OpenCore Changelog ================== #### v0.8.3 - Added ext4 file system driver -- Added support macOS 13 DP3 Kernel Collection +- Added support for macOS 13 DP3 Kernel Collection +- Added `--force-device` option to AudioDxe, allowing UEFI audio on HDA contollers which misreport themselves as non-HDA audio devices #### v0.8.2 - Fixed `AppleCpuPmCfgLock` on macOS 13 diff --git a/Docs/Configuration.md5 b/Docs/Configuration.md5 index 0762b4a67c9b2f7ba36e3634cb192122646f4c6d..6a179fcdc1e3b314025549be2d24c64ef9342f66 100644 --- a/Docs/Configuration.md5 +++ b/Docs/Configuration.md5 @@ -1 +1 @@ -5c72b1716d2046e9e507ea1ae35d860c +c35488bf631b9f319ae8c4059e1415f9 diff --git a/Docs/Configuration.pdf b/Docs/Configuration.pdf index dee82464e97f5f0dfc2bca6b519989ffc827ca3e..ce11660a27743860c1a009977375ec08d1104947 100644 Binary files a/Docs/Configuration.pdf and b/Docs/Configuration.pdf differ diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex index 9af1859711d91d219dfec70c4f1a9702c84618fc..8f230260b9e541ab45fd7aface9b3ecca1b10fde 100755 --- a/Docs/Configuration.tex +++ b/Docs/Configuration.tex @@ -6886,7 +6886,7 @@ will report that SIP has a non-standard value, however protection will be functi \subsection{AudioDxe}\label{uefiaudio} -High Definition Audio support driver in UEFI firmware for most Intel and some other analog audio controllers. +High Definition Audio (HDA) 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. @@ -6894,12 +6894,30 @@ for known issues. \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 -on most Apple hardware, and possibly some others) may be specified in \texttt{UEFI/Drivers/Arguments}: +section, but in addition some of the following configuration options may be required in order +to allow AudioDxe to correctly drive certain devices. All options are specified as text strings, +separated by space if more than one option is required, in the \texttt{Arguments} property for +the driver within the \texttt{UEFI/Drivers} section: \begin{itemize} \tightlist - \item \texttt{-{}-gpio-setup} - Default value is \texttt{0} (GPIO setup disabled) if argument is not provided, + \item \texttt{-{}-force-device} - String value, no default. \medskip + + When this option is present and has a value (e.g. \texttt{-{}-force-device=PciRoot(0x0)/Pci(0x1f,0x3)}), it + forces AudioDxe to connect to the specified PCI device, even if the device does not report itself as + an HDA audio controller. + + During driver connection, AudioDxe automatically provides audio services on all supported codecs of + all available HDA controllers. However, if the relevant controller is misreporting its identity + (typically, it will be reporting itself as a legacy audio device instead of an HDA controller) + then this argument may be required. + + Applies if the audio device can be made to work in macOS, but shows no sign of being detected by AudioDxe + (e.g. when including \texttt{DEBUG\_INFO} in \texttt{DisplayLevel} and using a DEBUG build of AudioDxe, + no controller and codec layout information is displayed during the \texttt{Connecting drivers...} + phase of OpenCore log). \medskip + + \item \texttt{-{}-gpio-setup} - Default value is \texttt{0} (GPIO setup disabled) if argument is not provided, or \texttt{7} (all GPIO setup stages stages enabled) if the argument is provided with no value. \medskip Available values, which may be combined by adding, are: \medskip diff --git a/Docs/Differences/Differences.pdf b/Docs/Differences/Differences.pdf index 300735c9c5ff204951740d6d095372d29d463f0b..63fa3ab407624a67083e09c61b2becf18381be03 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 547ac86e25b775846df023906576f69f660b7a45..9af7413f90a05ed8f2fd3e57634b73bd35a7b645 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 Tue Jul 5 17:33:51 2022 -%DIF ADD ../Configuration.tex Fri Jul 8 20:34:17 2022 +%DIF DEL PreviousConfiguration.tex Thu Jul 7 13:40:40 2022 +%DIF ADD ../Configuration.tex Sat Jul 9 09:49:03 2022 \usepackage{lmodern} \usepackage{amssymb,amsmath} @@ -6946,7 +6946,7 @@ will report that SIP has a non-standard value, however protection will be functi \subsection{AudioDxe}\label{uefiaudio} -High Definition Audio support driver in UEFI firmware for most Intel and some other analog audio controllers. +High Definition Audio \DIFaddbegin \DIFadd{(HDA) }\DIFaddend 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. @@ -6954,12 +6954,38 @@ for known issues. \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 -on most Apple hardware, and possibly some others) may be specified in \texttt{UEFI/Drivers/Arguments}: +section, but \DIFdelbegin \DIFdel{if required the following additonal configuration options (which are needed to produce sound +on most Apple hardware, and possibly some others) + may be specified in }%DIFDELCMD < \texttt{%%% +\DIFdel{UEFI/Drivers/Arguments}%DIFDELCMD < \MBLOCKRIGHTBRACE%%% +\DIFdel{: +}\DIFdelend \DIFaddbegin \DIFadd{in addition some of the following configuration options may be required in order +to allow AudioDxe to correctly drive certain devices. All options are specified as text strings, +separated by space if more than one option is required, in the }\texttt{\DIFadd{Arguments}} \DIFadd{property for +the driver within the }\texttt{\DIFadd{UEFI/Drivers}} \DIFadd{section: +}\DIFaddend \begin{itemize} \tightlist - \item \texttt{-{}-gpio-setup} - Default value is \texttt{0} (GPIO setup disabled) if argument is not provided, + \item \DIFaddbegin \texttt{\DIFadd{-}{}\DIFadd{-force-device}} \DIFadd{- String value, no default. }\medskip + + \DIFadd{When this option is present and has a value (e.g. }\texttt{\DIFadd{-}{}\DIFadd{-force-device=PciRoot(0x0)/Pci(0x1f,0x3)}}\DIFadd{), it + forces AudioDxe to connect to the specified PCI device, even if the device does not report itself as + an HDA audio controller. +} + + \DIFadd{During driver connection, AudioDxe automatically provides audio services on all supported codecs of + all available HDA controllers. However, if the relevant controller is misreporting its identity + (typically, it will be reporting itself as a legacy audio device instead of an HDA controller) + then this argument may be required. +} + + \DIFadd{Applies if the audio device can be made to work in macOS, but shows no sign of being detected by AudioDxe + (e.g. when including }\texttt{\DIFadd{DEBUG\_INFO}} \DIFadd{in }\texttt{\DIFadd{DisplayLevel}} \DIFadd{and using a DEBUG build of AudioDxe, + no controller and codec layout information is displayed during the }\texttt{\DIFadd{Connecting drivers...}} + \DIFadd{phase of OpenCore log). }\medskip + + \item \DIFaddend \texttt{-{}-gpio-setup} - Default value is \texttt{0} (GPIO setup disabled) if argument is not provided, or \texttt{7} (all GPIO setup stages stages enabled) if the argument is provided with no value. \medskip Available values, which may be combined by adding, are: \medskip diff --git a/Docs/Errata/Errata.pdf b/Docs/Errata/Errata.pdf index 5b43a14775f17b25ad6ae2f4764cafd5bfb57a08..3ce2cd2f21578cb6f8ac96390043c0984d4d0e39 100644 Binary files a/Docs/Errata/Errata.pdf and b/Docs/Errata/Errata.pdf differ diff --git a/Platform/OpenLinuxBoot/OpenLinuxBoot.c b/Platform/OpenLinuxBoot/OpenLinuxBoot.c index 761e6fb398144b620caca3f6e20049a151585a5c..37779f88cacf668c166902be39dd45408a12f142 100644 --- a/Platform/OpenLinuxBoot/OpenLinuxBoot.c +++ b/Platform/OpenLinuxBoot/OpenLinuxBoot.c @@ -23,7 +23,7 @@ UINTN gLinuxBootFlags = LINUX_BOOT_ALL & ~(LINUX_BOOT_ADD_DEBUG_INFO | LINUX_BOOT_LOG_VERBOSE | LINUX_BOOT_ADD_RW); -OC_FLEX_ARRAY *mParsedLoadOptions; +STATIC OC_FLEX_ARRAY *mParsedLoadOptions; OC_PICKER_CONTEXT *gPickerContext; OC_FLEX_ARRAY *gLoaderEntries; diff --git a/Staging/AudioDxe/AudioDxe.c b/Staging/AudioDxe/AudioDxe.c index 84451e579204d84096271bb38a4a84cfa2f6b2db..b37b640038f2d8c7dba4a19289422471790d430a 100644 --- a/Staging/AudioDxe/AudioDxe.c +++ b/Staging/AudioDxe/AudioDxe.c @@ -32,9 +32,17 @@ #include #include -UINTN gGpioSetupStageMask = GPIO_SETUP_STAGE_NONE; -UINTN gGpioPinMask = GPIO_PIN_MASK_AUTO; -BOOLEAN gRestoreNoSnoop = FALSE; +UINTN + gGpioSetupStageMask = GPIO_SETUP_STAGE_NONE; + +UINTN + gGpioPinMask = GPIO_PIN_MASK_AUTO; + +BOOLEAN + gRestoreNoSnoop = FALSE; + +EFI_DEVICE_PATH_PROTOCOL * + gForcedControllerDevicePath = NULL; /** HdaController Driver Binding. @@ -71,6 +79,7 @@ AudioDxeInit ( { EFI_STATUS Status; EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; + CHAR16 *DevicePathName; OC_FLEX_ARRAY *ParsedLoadOptions; // @@ -107,6 +116,13 @@ AudioDxeInit ( )); } + DevicePathName = NULL; + OcParsedVarsGetUnicodeStr (ParsedLoadOptions, L"--force-device", &DevicePathName); + if (DevicePathName != NULL) { + DEBUG ((DEBUG_INFO, "HDA: Force binding to %s\n", DevicePathName)); + gForcedControllerDevicePath = ConvertTextToDevicePath (DevicePathName); + } + OcFlexArrayFree (&ParsedLoadOptions); } else if (Status != EFI_NOT_FOUND) { return Status; diff --git a/Staging/AudioDxe/AudioDxe.h b/Staging/AudioDxe/AudioDxe.h index 5bd2879a636f7b6f63831f2d1e3103629cf7e8d7..fa9e5fe5a0badcf2f27989fe2ad91ebb8c0996ff 100644 --- a/Staging/AudioDxe/AudioDxe.h +++ b/Staging/AudioDxe/AudioDxe.h @@ -85,10 +85,31 @@ extern EFI_AUDIO_DECODE_PROTOCOL gEfiAudioDecodeProtocol; #define GPIO_PIN_MASK_AUTO 0 ///< Auto: use all reported available pins. // -// Stored parsed config. +// Setup stage mask. // -extern UINTN gGpioSetupStageMask; -extern UINTN gGpioPinMask; -extern BOOLEAN gRestoreNoSnoop; +extern +UINTN + gGpioSetupStageMask; + +// +// GPIO pin mask. +// +extern +UINTN + gGpioPinMask; + +// +// Whether to restore NOSNOOPEN at exit. +// +extern +BOOLEAN + gRestoreNoSnoop; + +// +// Forced device path for HDA controller (ignore advertised class/subclass). +// +extern +EFI_DEVICE_PATH_PROTOCOL * + gForcedControllerDevicePath; #endif // EFI_AUDIODXE_H diff --git a/Staging/AudioDxe/AudioDxe.inf b/Staging/AudioDxe/AudioDxe.inf index 326850eec64d6729a325e623c1a620b685a93099..4885d348003d620ebdad62a1008af9e3e4522369 100644 --- a/Staging/AudioDxe/AudioDxe.inf +++ b/Staging/AudioDxe/AudioDxe.inf @@ -43,6 +43,7 @@ MemoryAllocationLib OcBootManagementLib OcDeviceMiscLib + OcDevicePathLib OcFlexArrayLib OcHdaDevicesLib OcMp3Lib diff --git a/Staging/AudioDxe/HdaController/HdaController.c b/Staging/AudioDxe/HdaController/HdaController.c index d4a0b8962ea8f6df9c946f740864494f4e45b6a4..cf441ff06ed6a67c4ce63ed1b16535e1bda5c41a 100644 --- a/Staging/AudioDxe/HdaController/HdaController.c +++ b/Staging/AudioDxe/HdaController/HdaController.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -991,9 +992,10 @@ HdaControllerDriverBindingSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) { - EFI_STATUS Status; - EFI_PCI_IO_PROTOCOL *PciIo; - PCI_CLASSCODE HdaClassReg; + EFI_STATUS Status; + EFI_PCI_IO_PROTOCOL *PciIo; + PCI_CLASSCODE HdaClassReg; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; // // Open PCI I/O protocol. If this fails, it's not a PCI device. @@ -1011,6 +1013,23 @@ HdaControllerDriverBindingSupported ( return Status; } + // + // For use when the device is misreporting its class or subclass, so ignore these. + // + if (gForcedControllerDevicePath != NULL) { + Status = EFI_UNSUPPORTED; + + DevicePath = DevicePathFromHandle (ControllerHandle); + + if ( (DevicePath != NULL) + && IsDevicePathEqual (DevicePath, gForcedControllerDevicePath)) + { + Status = EFI_SUCCESS; + } + + return Status; + } + // // Read class code from PCI. //