Skip to content

Commit c129afe

Browse files
Simone Lombardobinarymaster
authored andcommitted
[AC97] Addendum to 8467a4d
1 parent 8467a4d commit c129afe

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

drivers/wdm/audio/drivers/ac97/ac97.inf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ExcludeFromSelect = *
5858
%ac97_GB.DeviceDesc%=ac97, PCI\VEN_8086&DEV_27DE
5959
%ac97_6300ESB.DeviceDesc%=ac97, PCI\VEN_8086&DEV_25A6
6060
%ac97_63xxESB.DeviceDesc%=ac97, PCI\VEN_8086&DEV_2698
61-
%ac97_63xxESB.DeviceDesc%=ac97, PCI\VEN_10de&DEV_01b1
61+
%ac97_xbox.DeviceDesc%=ac97, PCI\VEN_10de&DEV_01b1
6262

6363
;; This section enables installing on x64 systems
6464

@@ -353,6 +353,7 @@ ac97_FB.DeviceDesc="Intel 82801FB/FBM/FR/FW/FRW AC'97 Audio Controller"
353353
ac97_GB.DeviceDesc="Intel 82801GB/GR/GDH/GBM/GHM AC'97 Audio Controller"
354354
ac97_6300ESB.DeviceDesc="Intel 6300ESB AC'97 Audio Controller"
355355
ac97_63xxESB.DeviceDesc="Intel 631xESB/632xESB AC'97 Audio Controller"
356+
ac97_xbox.DeviceDesc="XBOX WM9709 AC'97 Audio Controller"
356357
ac97.DeviceDesc="Intel 82801 AC'97 Audio Controller"
357358

358359
ac97.Wave.szPname="AC'97 Sound Card"

drivers/wdm/audio/drivers/ac97/common.cpp

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,8 @@ tAC97Registers CAC97AdapterCommon::m_stAC97Registers[] =
6565
{0xBB80, SHREG_NOCACHE, NULL, 0}, // AC97REG_LFE_SAMPLERATE
6666
{0xBB80, SHREG_NOCACHE, NULL, 0}, // AC97REG_RECORD_SAMPLERATE
6767
{0xBB80, SHREG_NOCACHE, NULL, 0}, // AC97REG_MIC_SAMPLERATE
68-
#ifdef SARCH_XBOX
69-
{0x8080, SHREG_INVALID, L"CenterLFEVolume", 0x0000}, // AC97REG_CENTER_LFE_VOLUME
70-
{0x8080, SHREG_INVALID, L"SurroundVolume", 0x0000}, // AC97REG_SURROUND_VOLUME
71-
#else
7268
{0x8080, SHREG_INIT, L"CenterLFEVolume", 0x0000}, // AC97REG_CENTER_LFE_VOLUME
7369
{0x8080, SHREG_INIT, L"SurroundVolume", 0x0000}, // AC97REG_SURROUND_VOLUME
74-
#endif
7570
{0x0000, SHREG_NOCACHE, NULL, 0} // AC97REG_RESERVED2
7671

7772
// We leave the other values blank. There would be a huge gap with 31
@@ -245,7 +240,7 @@ STDMETHODIMP_(NTSTATUS) CAC97AdapterCommon::Init
245240
//
246241
// Restore the AC97 registers now.
247242
//
248-
#if (DBG)
243+
#if (DBG) && !defined(SARCH_XBOX)
249244
DumpConfig ();
250245
#endif
251246
ntStatus = SetAC97Default ();
@@ -588,7 +583,9 @@ NTSTATUS CAC97AdapterCommon::InitAC97 (void)
588583
//
589584
WriteCodecRegister (AC97REG_RESET, 0x00, 0xFFFF);
590585

586+
#ifdef SARCH_XBOX
591587
ntStatus = PowerUpCodec ();
588+
#endif
592589
}
593590
else
594591
{
@@ -684,23 +681,24 @@ NTSTATUS CAC97AdapterCommon::ProbeHWConfig (void)
684681
return ntStatus;
685682

686683
//
687-
// Master volume is one of the supported registers on an AC97
684+
// This gives us information about the AC97 CoDec
688685
//
689-
ntStatus = ReadCodecRegister (AC97REG_MASTER_VOLUME, &wCodecReg);
686+
ntStatus = ReadCodecRegister (AC97REG_RESET, &wCodecID);
690687
if (!NT_SUCCESS (ntStatus))
691688
return ntStatus;
692689

693-
// Default is x8000.
694-
if (wCodecReg != 0x8000)
695-
return STATUS_NO_SUCH_DEVICE;
696-
690+
#ifndef SARCH_XBOX
697691
//
698-
// This gives us information about the AC97 CoDec
692+
// Master volume is one of the supported registers on an AC97
699693
//
700-
ntStatus = ReadCodecRegister (AC97REG_RESET, &wCodecID);
701-
if (!NT_SUCCESS (ntStatus))
694+
ntStatus = ReadCodecRegister(AC97REG_MASTER_VOLUME, &wCodecReg);
695+
if (!NT_SUCCESS(ntStatus))
702696
return ntStatus;
703697

698+
// Default is x8000.
699+
if (wCodecReg != 0x8000)
700+
return STATUS_NO_SUCH_DEVICE;
701+
704702
//
705703
// Fill out the configuration stuff.
706704
//
@@ -1074,6 +1072,7 @@ NTSTATUS CAC97AdapterCommon::ProbeHWConfig (void)
10741072

10751073
if (GetPinConfig (PINC_CENTER_LFE_PRESENT))
10761074
Check6thBitSupport (AC97REG_CENTER_LFE_VOLUME, NODEC_6BIT_CENTER_LFE_VOLUME);
1075+
#endif
10771076

10781077
//
10791078
// We read these registers because they are dependent on the codec.
@@ -1595,6 +1594,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::PowerChangeState
15951594
DOUT (DBG_POWER, ("Changing state to D%d.", (ULONG)NewState.DeviceState -
15961595
(ULONG)PowerDeviceD0));
15971596

1597+
#ifndef SARCH_XBOX
15981598
//
15991599
// Switch on new state.
16001600
//
@@ -1695,6 +1695,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::PowerChangeState
16951695
// cache property accesses and when to permit the driver from accessing
16961696
// the hardware.
16971697
//
1698+
#endif
16981699
m_PowerState = NewState.DeviceState;
16991700
DOUT (DBG_POWER, ("Entering D%d", (ULONG)m_PowerState -
17001701
(ULONG)PowerDeviceD0));
@@ -1815,6 +1816,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18151816
sizeof(WORD), PoolTag);
18161817
if (NULL != KeyInfo)
18171818
{
1819+
#ifndef SARCH_XBOX
18181820
// loop through all mixer settings
18191821
for (AC97Register i = AC97REG_RESET; i <= AC97REG_RESERVED2;
18201822
i = (AC97Register)(i + 1))
@@ -1858,6 +1860,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18581860
}
18591861
}
18601862
}
1863+
#endif
18611864

18621865
// we want to return status success even if the last QueryValueKey
18631866
// failed.
@@ -1880,6 +1883,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18801883
}
18811884

18821885

1886+
#ifndef SARCH_XBOX
18831887
// in case we did not query the registry (cause of lack of resources)
18841888
// restore default values and return insufficient resources.
18851889
if (!NT_SUCCESS (ntStatus))
@@ -1894,6 +1898,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18941898
}
18951899
}
18961900
}
1901+
#endif
18971902

18981903
return ntStatus;
18991904
}
@@ -2100,6 +2105,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::ReadChannelConfigDefault
21002105
sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
21012106
sizeof(DWORD),
21022107
&ulResultLength );
2108+
#ifndef SARCH_XBOX
21032109
if (NT_SUCCESS (ntStatus))
21042110
{
21052111
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo =
@@ -2129,6 +2135,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::ReadChannelConfigDefault
21292135
}
21302136
}
21312137
}
2138+
#endif
21322139

21332140
// free the key info
21342141
ExFreePoolWithTag (KeyInfo,PoolTag);

drivers/wdm/audio/drivers/ac97/stream.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ STDMETHODIMP_(NTSTATUS) CMiniportStream::SetFormat
429429
Miniport->AdapterCommon->WriteBMControlRegister (GLOB_CNT, dwControlReg);
430430
}
431431

432+
#ifndef SARCH_XBOX
432433
//
433434
// Check for rate support by hardware. If it is supported, then update
434435
// hardware registers else return not implemented and audio stack will
@@ -467,6 +468,7 @@ STDMETHODIMP_(NTSTATUS) CMiniportStream::SetFormat
467468
ProgramSampleRate (AC97REG_LFE_SAMPLERATE, TempRate);
468469
}
469470
}
471+
#endif
470472

471473
if (NT_SUCCESS (ntStatus))
472474
{

0 commit comments

Comments
 (0)