Skip to content

Commit d617863

Browse files
simonelombardobinarymaster
authored andcommitted
[AC97] Addendum to 8467a4d
1 parent 68c4ca3 commit d617863

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-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: 28 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+
#ifndef SARCH_XBOX
591587
ntStatus = PowerUpCodec ();
588+
#endif
592589
}
593590
else
594591
{
@@ -670,7 +667,9 @@ NTSTATUS CAC97AdapterCommon::ProbeHWConfig (void)
670667
PAGED_CODE ();
671668

672669
NTSTATUS ntStatus = STATUS_SUCCESS;
670+
#ifndef SARCH_XBOX
673671
DWORD dwGlobalStatus;
672+
#endif
674673
WORD wCodecID;
675674
WORD wCodecReg;
676675

@@ -684,23 +683,24 @@ NTSTATUS CAC97AdapterCommon::ProbeHWConfig (void)
684683
return ntStatus;
685684

686685
//
687-
// Master volume is one of the supported registers on an AC97
686+
// This gives us information about the AC97 CoDec
688687
//
689-
ntStatus = ReadCodecRegister (AC97REG_MASTER_VOLUME, &wCodecReg);
688+
ntStatus = ReadCodecRegister (AC97REG_RESET, &wCodecID);
690689
if (!NT_SUCCESS (ntStatus))
691690
return ntStatus;
692691

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

700+
// Default is x8000.
701+
if (wCodecReg != 0x8000)
702+
return STATUS_NO_SUCH_DEVICE;
703+
704704
//
705705
// Fill out the configuration stuff.
706706
//
@@ -1074,6 +1074,7 @@ NTSTATUS CAC97AdapterCommon::ProbeHWConfig (void)
10741074

10751075
if (GetPinConfig (PINC_CENTER_LFE_PRESENT))
10761076
Check6thBitSupport (AC97REG_CENTER_LFE_VOLUME, NODEC_6BIT_CENTER_LFE_VOLUME);
1077+
#endif
10771078

10781079
//
10791080
// We read these registers because they are dependent on the codec.
@@ -1568,7 +1569,9 @@ STDMETHODIMP_(void) CAC97AdapterCommon::PowerChangeState
15681569
{
15691570
PAGED_CODE ();
15701571

1572+
#ifndef SARCH_XBOX
15711573
NTSTATUS ntStatus = STATUS_SUCCESS;
1574+
#endif
15721575

15731576
DOUT (DBG_PRINT, ("[CAC97AdapterCommon::PowerChangeNotify]"));
15741577

@@ -1595,6 +1598,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::PowerChangeState
15951598
DOUT (DBG_POWER, ("Changing state to D%d.", (ULONG)NewState.DeviceState -
15961599
(ULONG)PowerDeviceD0));
15971600

1601+
#ifndef SARCH_XBOX
15981602
//
15991603
// Switch on new state.
16001604
//
@@ -1695,6 +1699,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::PowerChangeState
16951699
// cache property accesses and when to permit the driver from accessing
16961700
// the hardware.
16971701
//
1702+
#endif
16981703
m_PowerState = NewState.DeviceState;
16991704
DOUT (DBG_POWER, ("Entering D%d", (ULONG)m_PowerState -
17001705
(ULONG)PowerDeviceD0));
@@ -1779,7 +1784,9 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
17791784
PREGISTRYKEY SettingsKey;
17801785
UNICODE_STRING sKeyName;
17811786
ULONG ulDisposition;
1787+
#ifndef SARCH_XBOX
17821788
ULONG ulResultLength;
1789+
#endif
17831790
PVOID KeyInfo = NULL;
17841791

17851792
DOUT (DBG_PRINT, ("[CAC97AdapterCommon::SetAC97Default]"));
@@ -1815,6 +1822,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18151822
sizeof(WORD), PoolTag);
18161823
if (NULL != KeyInfo)
18171824
{
1825+
#ifndef SARCH_XBOX
18181826
// loop through all mixer settings
18191827
for (AC97Register i = AC97REG_RESET; i <= AC97REG_RESERVED2;
18201828
i = (AC97Register)(i + 1))
@@ -1858,6 +1866,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18581866
}
18591867
}
18601868
}
1869+
#endif
18611870

18621871
// we want to return status success even if the last QueryValueKey
18631872
// failed.
@@ -1880,6 +1889,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18801889
}
18811890

18821891

1892+
#ifndef SARCH_XBOX
18831893
// in case we did not query the registry (cause of lack of resources)
18841894
// restore default values and return insufficient resources.
18851895
if (!NT_SUCCESS (ntStatus))
@@ -1894,6 +1904,7 @@ NTSTATUS CAC97AdapterCommon::SetAC97Default (void)
18941904
}
18951905
}
18961906
}
1907+
#endif
18971908

18981909
return ntStatus;
18991910
}
@@ -2100,6 +2111,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::ReadChannelConfigDefault
21002111
sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
21012112
sizeof(DWORD),
21022113
&ulResultLength );
2114+
#ifndef SARCH_XBOX
21032115
if (NT_SUCCESS (ntStatus))
21042116
{
21052117
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo =
@@ -2129,6 +2141,7 @@ STDMETHODIMP_(void) CAC97AdapterCommon::ReadChannelConfigDefault
21292141
}
21302142
}
21312143
}
2144+
#endif
21322145

21332146
// free the key info
21342147
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)