mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
reset HDA after use
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
98b3d37277
commit
0f5da727e0
@ -7068,6 +7068,7 @@ GetDevices ()
|
||||
}
|
||||
if (gSettings.ResetHDA) {
|
||||
//Slice method from VoodooHDA
|
||||
//PCI_HDA_TCSEL_OFFSET = 0x44
|
||||
UINT8 Value = 0;
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x44, 1, &Value);
|
||||
|
||||
@ -7816,14 +7817,28 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
}
|
||||
|
||||
// HDA
|
||||
else if (gSettings.HDAInjection &&
|
||||
(Pci.Hdr.ClassCode[2] == PCI_CLASS_MEDIA) &&
|
||||
else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_MEDIA) &&
|
||||
((Pci.Hdr.ClassCode[1] == PCI_CLASS_MEDIA_HDA) ||
|
||||
(Pci.Hdr.ClassCode[1] == PCI_CLASS_MEDIA_AUDIO))) {
|
||||
// HDMI injection inside
|
||||
TmpDirty = setup_hda_devprop (PciIo, &PCIdevice, Entry->OSVersion);
|
||||
StringDirty |= TmpDirty;
|
||||
}
|
||||
if (gSettings.HDAInjection ) {
|
||||
TmpDirty = setup_hda_devprop (PciIo, &PCIdevice, Entry->OSVersion);
|
||||
StringDirty |= TmpDirty;
|
||||
}
|
||||
if (gSettings.ResetHDA) {
|
||||
|
||||
//PCI_HDA_TCSEL_OFFSET = 0x44
|
||||
UINT8 Value = 0;
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x44, 1, &Value);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Value &= 0xf8;
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x44, 1, &Value);
|
||||
}
|
||||
}
|
||||
|
||||
//LPC
|
||||
else if ((Pci.Hdr.ClassCode[2] == PCI_CLASS_BRIDGE) &&
|
||||
@ -7831,7 +7846,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
{
|
||||
if (gSettings.LpcTune) {
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon);
|
||||
MsgLog ("Initial PmCon value=%hX\n", PmCon);
|
||||
MsgLog ("Initial PmCon value=%hX\n", PmCon);
|
||||
|
||||
if (gSettings.EnableC6) {
|
||||
PmCon |= 1 << 11;
|
||||
@ -7868,7 +7883,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint16, GEN_PMCON_1, 1, &PmCon);
|
||||
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,GEN_PMCON_1, 1, &PmCon);
|
||||
MsgLog ("Set PmCon value=%hX\n", PmCon);
|
||||
MsgLog ("Set PmCon value=%hX\n", PmCon);
|
||||
|
||||
}
|
||||
Rcba = 0;
|
||||
|
@ -1168,15 +1168,15 @@ VOID ApplyInputs(VOID)
|
||||
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
|
||||
UINT8 TmpIndex;
|
||||
if (OldChosenAudio > AudioNum) {
|
||||
DBG("crasy OldChosenAudio = %lld\n", OldChosenAudio);
|
||||
// DBG("crasy OldChosenAudio = %lld\n", OldChosenAudio);
|
||||
OldChosenAudio = 0;
|
||||
}
|
||||
TmpIndex = OldChosenAudio & 0x2F;
|
||||
DBG("Chosen output %u:%ls_%s\n", TmpIndex, AudioList[TmpIndex].Name,
|
||||
AudioOutputNames[AudioList[TmpIndex].Device]);
|
||||
// DBG("Chosen output %u:%ls_%s\n", TmpIndex, AudioList[TmpIndex].Name,
|
||||
// AudioOutputNames[AudioList[TmpIndex].Device]);
|
||||
|
||||
DevicePath = DevicePathFromHandle(AudioList[TmpIndex].Handle);
|
||||
DBG("choosen sound devicepath=%ls\n", DevicePathToStr(DevicePath));
|
||||
// DBG("choosen sound devicepath=%ls\n", DevicePathToStr(DevicePath));
|
||||
if (DevicePath != NULL) {
|
||||
SetNvramVariable(L"Clover.SoundDevice", &gEfiAppleBootGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
@ -1184,13 +1184,13 @@ VOID ApplyInputs(VOID)
|
||||
SetNvramVariable(L"Clover.SoundIndex", &gEfiAppleBootGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
1, (UINT8 *)&TmpIndex);
|
||||
DBG(" sound written to nvram variables\n");
|
||||
// DBG(" sound written to nvram variables\n");
|
||||
}
|
||||
}
|
||||
i++; //120
|
||||
if (InputItems[i].Valid) {
|
||||
DefaultAudioVolume = (UINT8)StrDecimalToUintn(InputItems[i].SValue);
|
||||
DBG(" set output volume to %d\n", DefaultAudioVolume);
|
||||
// DBG(" set output volume to %d\n", DefaultAudioVolume);
|
||||
if (DefaultAudioVolume > 100) {
|
||||
// correct wrong input
|
||||
DefaultAudioVolume = 90;
|
||||
|
Loading…
Reference in New Issue
Block a user