提交 79f08291 编写于 作者: M MikeBeaton

AudioDxe: Add --force-device option

上级 7bfa8ae6
......@@ -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
......
5c72b1716d2046e9e507ea1ae35d860c
c35488bf631b9f319ae8c4059e1415f9
......@@ -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
......
\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
......
......@@ -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;
......
......@@ -32,9 +32,17 @@
#include <Library/OcBootManagementLib.h>
#include <Library/OcFlexArrayLib.h>
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;
......
......@@ -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
......@@ -43,6 +43,7 @@
MemoryAllocationLib
OcBootManagementLib
OcDeviceMiscLib
OcDevicePathLib
OcFlexArrayLib
OcHdaDevicesLib
OcMp3Lib
......
......@@ -28,6 +28,7 @@
#include <Library/OcGuardLib.h>
#include <Library/OcDeviceMiscLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcHdaDevicesLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
......@@ -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.
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册