AudioDxe: Add --use-conn-none option to enable additional output channels

Closes https://github.com/acidanthera/bugtracker/issues/2281
This commit is contained in:
Mike Beaton 2023-05-20 09:22:16 +01:00
parent ae9e724381
commit cbe2b43cdb
13 changed files with 129 additions and 94 deletions

View File

@ -9,7 +9,8 @@ OpenCore Changelog
- Made `Builtin` text renderer ignore UI Scale, when required to ensure that text mode reaches minimum supported size of 80x25
- Added save and restore of text and graphics mode round tools and failed boot entries
- Updated out-of-range cursor handling to work round minor display issue in memtest86
- Add optional `--enable-mouse-click` argument to `CrScreenshotDxe` driver to additionally respond on mouse click
- Added optional `--enable-mouse-click` argument to `CrScreenshotDxe` driver to additionally respond on mouse click
- Added `--use-conn-none` option to `AudioDxe` driver to discover additional usable output channels on some systems
#### v0.9.2
- Added `DisableIoMapperMapping` quirk, thx @CaseySJ

View File

@ -1 +1 @@
a54a2bb132146d90046911c0bf3ea798
f926c9a3fc0eaf349a76ca4af8bbba55

Binary file not shown.

View File

@ -7098,6 +7098,16 @@ the driver within the \texttt{UEFI/Drivers} section:
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
\item \texttt{-{}-use-conn-none} - Boolean flag, enabled if present. \medskip
On some sound cards enabling this option will enable additional usable audio channels (e.g.
the bass or treble speaker of a pair, where only one is found without it).
\medskip
\emph{Note}: Enabling this option may increase the available channels, in which case any
custom setting of \texttt{AudioOutMask} may need to be changed to match the new channel list.
\medskip
\end{itemize}
\subsection{OpenVariableRuntimeDxe}\label{emunvram}

Binary file not shown.

View File

@ -1,7 +1,7 @@
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Wed May 10 20:45:31 2023
%DIF ADD ../Configuration.tex Sat May 20 00:57:56 2023
%DIF ADD ../Configuration.tex Sat May 20 08:58:22 2023
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
@ -7085,14 +7085,14 @@ the driver within the \texttt{UEFI/Drivers} section:
Amount of time in milliseconds to wait for all widgets to come fully on, applied per codec
during driver connection phase. In most systems this should not be needed and a faster boot
will be achieved by using \texttt{Audio} section \texttt{SetupDelay} if any audio setup delay
is required. Where required, values of up to one second may be needed\DIFaddbegin \DIFadd{. }\medskip
is required. Where required, values of up to one second may be needed. \medskip
\item \texttt{\DIFadd{-}{}\DIFadd{-force-codec}} \DIFadd{- Integer value, no default. }\medskip
\item \DIFaddbegin \texttt{\DIFadd{-}{}\DIFadd{-force-codec}} \DIFadd{- Integer value, no default. }\medskip
\DIFadd{Force use of an audio codec, this value should be equal to }\texttt{\DIFadd{Audio}} \DIFadd{section }\texttt{\DIFadd{AudioCodec}}\DIFadd{.
Can result in faster boot especially when used in conjuction with }\texttt{\DIFadd{-}{}\DIFadd{-force-device}}\DIFaddend . \medskip
Can result in faster boot especially when used in conjuction with }\DIFaddend \texttt{-{}-force-device}\DIFaddbegin \DIFadd{. }\medskip
\item \texttt{-{}-force-device} - String value, no default. \medskip
\item \texttt{\DIFadd{-}{}\DIFadd{-force-device}} \DIFaddend - 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
@ -7160,7 +7160,17 @@ the driver within the \texttt{UEFI/Drivers} section:
be reversed on exit in order to avoid breaking sound in Windows or Linux. 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
some other systems\DIFaddbegin \DIFadd{. }\medskip
\item \texttt{\DIFadd{-}{}\DIFadd{-use-conn-none}} \DIFadd{- Boolean flag, enabled if present. }\medskip
\DIFadd{On some sound cards enabling this option will enable additional usable audio channels (e.g.
the bass or treble speaker of a pair, where only one is found without it).
}\medskip
\emph{\DIFadd{Note}}\DIFadd{: Enabling this option may increase the available channels, in which case any
custom setting of }\texttt{\DIFadd{AudioOutMask}} \DIFadd{may need to be changed to match the new channel list}\DIFaddend .
\medskip
\end{itemize}
\subsection{OpenVariableRuntimeDxe}\label{emunvram}

Binary file not shown.

View File

@ -32,27 +32,6 @@
#include <Library/OcBootManagementLib.h>
#include <Library/OcFlexArrayLib.h>
UINTN
gGpioSetupStageMask = GPIO_SETUP_STAGE_NONE;
UINTN
gGpioPinMask = GPIO_PIN_MASK_AUTO;
BOOLEAN
gRestoreNoSnoop = FALSE;
EFI_DEVICE_PATH_PROTOCOL *
gForcedControllerDevicePath = NULL;
UINTN
gCodecSetupDelay = 0;
BOOLEAN
gUseForcedCodec = FALSE;
UINTN
gForcedCodec = 0;
/**
HdaController Driver Binding.
**/
@ -131,6 +110,8 @@ AudioDxeInit (
gUseForcedCodec = TRUE;
}
gCodecUseConnNoneNode = OcHasParsedVar (ParsedLoadOptions, L"--use-conn-none", OcStringFormatUnicode);
OcFlexArrayFree (&ParsedLoadOptions);
} else if (Status != EFI_NOT_FOUND) {
return Status;
@ -138,12 +119,15 @@ AudioDxeInit (
DEBUG ((
DEBUG_INFO,
"HDA: GPIO setup stages 0x%X GPIO pin mask 0x%X%a Restore NSNPEN %d Force device %s Setup delay %u\n",
"HDA: GPIO stages 0x%X mask 0x%X%a; Restore NSNPEN %d; Force device %s codec %u(%u); Conn none %u; Delay %u\n",
gGpioSetupStageMask,
gGpioPinMask,
gGpioPinMask == 0 ? " (auto)" : "",
gRestoreNoSnoop,
DevicePathName,
gUseForcedCodec,
gForcedCodec,
gCodecUseConnNoneNode,
gCodecSetupDelay
));

View File

@ -68,67 +68,4 @@ extern EFI_AUDIO_DECODE_PROTOCOL gEfiAudioDecodeProtocol;
// REF: MdeModulePkg/Core/Dxe/Event/Timer.c
#define TPL_DXE_CORE_TIMER (TPL_HIGH_LEVEL - 1)
// GPIO setup stages.
#define GPIO_SETUP_STAGE_DATA BIT0
#define GPIO_SETUP_STAGE_DIRECTION BIT1
#define GPIO_SETUP_STAGE_ENABLE BIT2
#define GPIO_SETUP_STAGE_NONE 0
#define GPIO_SETUP_STAGE_ALL ( \
GPIO_SETUP_STAGE_DATA | \
GPIO_SETUP_STAGE_DIRECTION | \
GPIO_SETUP_STAGE_ENABLE \
)
// GPIO setup pin mask.
#define GPIO_PIN_MASK_AUTO 0 ///< Auto: use all reported available pins.
//
// Setup stage mask.
//
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;
//
// Time to wait in microseconds per codec for all widgets to fully come on.
//
extern
UINTN
gCodecSetupDelay;
//
// Whether to use forced codec.
//
extern BOOLEAN
gUseForcedCodec;
//
// Forced codec number.
//
extern UINTN
gForcedCodec;
#endif // EFI_AUDIODXE_H

View File

@ -30,6 +30,24 @@
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
UINTN
gGpioSetupStageMask = GPIO_SETUP_STAGE_NONE;
UINTN
gGpioPinMask = GPIO_PIN_MASK_AUTO;
UINTN
gCodecSetupDelay = 0;
BOOLEAN
gUseForcedCodec = FALSE;
UINTN
gForcedCodec = 0;
BOOLEAN
gCodecUseConnNoneNode = FALSE;
EFI_STATUS
EFIAPI
HdaCodecProbeWidget (
@ -933,7 +951,7 @@ HdaCodecParsePorts (
// If this is a pin complex but it has no connection to a port, also ignore it.
// If the default association for the pin complex is zero, also ignore it.
if ((HdaWidget->Type != HDA_WIDGET_TYPE_PIN_COMPLEX) ||
(HDA_VERB_GET_CONFIGURATION_DEFAULT_PORT_CONN (HdaWidget->DefaultConfiguration) == HDA_CONFIG_DEFAULT_PORT_CONN_NONE) ||
(!gCodecUseConnNoneNode && (HDA_VERB_GET_CONFIGURATION_DEFAULT_PORT_CONN (HdaWidget->DefaultConfiguration) == HDA_CONFIG_DEFAULT_PORT_CONN_NONE)) ||
(HDA_VERB_GET_CONFIGURATION_DEFAULT_ASSOCIATION (HdaWidget->DefaultConfiguration) == 0))
{
DEBUG ((

View File

@ -366,4 +366,59 @@ HdaCodecDriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
);
// GPIO setup stages.
#define GPIO_SETUP_STAGE_DATA BIT0
#define GPIO_SETUP_STAGE_DIRECTION BIT1
#define GPIO_SETUP_STAGE_ENABLE BIT2
#define GPIO_SETUP_STAGE_NONE 0
#define GPIO_SETUP_STAGE_ALL ( \
GPIO_SETUP_STAGE_DATA | \
GPIO_SETUP_STAGE_DIRECTION | \
GPIO_SETUP_STAGE_ENABLE \
)
// GPIO setup pin mask.
#define GPIO_PIN_MASK_AUTO 0 ///< Auto: use all reported available pins.
//
// Setup stage mask.
//
extern
UINTN
gGpioSetupStageMask;
//
// GPIO pin mask.
//
extern
UINTN
gGpioPinMask;
//
// Time to wait in microseconds per codec for all widgets to fully come on.
//
extern
UINTN
gCodecSetupDelay;
//
// Whether to use forced codec.
//
extern BOOLEAN
gUseForcedCodec;
//
// Forced codec number.
//
extern UINTN
gForcedCodec;
//
// Whether to attempt to output on CONN_NONE nodes.
//
extern BOOLEAN
gCodecUseConnNoneNode;
#endif

View File

@ -34,6 +34,12 @@
#include <Library/OcStringLib.h>
#include <Library/PcdLib.h>
BOOLEAN
gRestoreNoSnoop = FALSE;
EFI_DEVICE_PATH_PROTOCOL *
gForcedControllerDevicePath = NULL;
VOID
EFIAPI
HdaControllerStreamOutputPollTimerHandler (

View File

@ -618,4 +618,18 @@ HdaControllerStreamAbort (
IN HDA_STREAM *HdaStream
);
//
// 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