mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
Kernel: Report AC'97 vendor and device ID
This commit is contained in:
parent
9fcd3f7920
commit
4f91616759
2 changed files with 14 additions and 9 deletions
|
@ -78,10 +78,20 @@ UNMAP_AFTER_INIT ErrorOr<void> AC97::initialize()
|
||||||
dbgln_if(AC97_DEBUG, "AC97 @ {}: mixer base: {:#04x}", pci_address(), m_io_mixer_base.get());
|
dbgln_if(AC97_DEBUG, "AC97 @ {}: mixer base: {:#04x}", pci_address(), m_io_mixer_base.get());
|
||||||
dbgln_if(AC97_DEBUG, "AC97 @ {}: bus base: {:#04x}", pci_address(), m_io_bus_base.get());
|
dbgln_if(AC97_DEBUG, "AC97 @ {}: bus base: {:#04x}", pci_address(), m_io_bus_base.get());
|
||||||
|
|
||||||
enable_pin_based_interrupts();
|
// Read out AC'97 codec revision and vendor
|
||||||
PCI::enable_bus_mastering(pci_address());
|
auto extended_audio_id = m_io_mixer_base.offset(NativeAudioMixerRegister::ExtendedAudioID).in<u16>();
|
||||||
|
m_codec_revision = static_cast<AC97Revision>(((extended_audio_id & ExtendedAudioMask::Revision) >> 10) & 0b11);
|
||||||
|
dbgln_if(AC97_DEBUG, "AC97 @ {}: codec revision {:#02b}", pci_address(), to_underlying(m_codec_revision));
|
||||||
|
if (m_codec_revision == AC97Revision::Reserved)
|
||||||
|
return ENOTSUP;
|
||||||
|
|
||||||
|
// Report vendor / device ID
|
||||||
|
u32 vendor_id = m_io_mixer_base.offset(NativeAudioMixerRegister::VendorID1).in<u16>() << 16 | m_io_mixer_base.offset(NativeAudioMixerRegister::VendorID2).in<u16>();
|
||||||
|
dbgln("AC97 @ {}: Vendor ID: {:#8x}", pci_address(), vendor_id);
|
||||||
|
|
||||||
// Bus cold reset, enable interrupts
|
// Bus cold reset, enable interrupts
|
||||||
|
enable_pin_based_interrupts();
|
||||||
|
PCI::enable_bus_mastering(pci_address());
|
||||||
auto control = m_io_bus_base.offset(NativeAudioBusRegister::GlobalControl).in<u32>();
|
auto control = m_io_bus_base.offset(NativeAudioBusRegister::GlobalControl).in<u32>();
|
||||||
control |= GlobalControlFlag::GPIInterruptEnable;
|
control |= GlobalControlFlag::GPIInterruptEnable;
|
||||||
control |= GlobalControlFlag::AC97ColdReset;
|
control |= GlobalControlFlag::AC97ColdReset;
|
||||||
|
@ -90,13 +100,6 @@ UNMAP_AFTER_INIT ErrorOr<void> AC97::initialize()
|
||||||
// Reset mixer
|
// Reset mixer
|
||||||
m_io_mixer_base.offset(NativeAudioMixerRegister::Reset).out<u16>(1);
|
m_io_mixer_base.offset(NativeAudioMixerRegister::Reset).out<u16>(1);
|
||||||
|
|
||||||
// Read out AC'97 codec revision
|
|
||||||
auto extended_audio_id = m_io_mixer_base.offset(NativeAudioMixerRegister::ExtendedAudioID).in<u16>();
|
|
||||||
m_codec_revision = static_cast<AC97Revision>(((extended_audio_id & ExtendedAudioMask::Revision) >> 10) & 0b11);
|
|
||||||
dbgln_if(AC97_DEBUG, "AC97 @ {}: codec revision {:#02b}", pci_address(), to_underlying(m_codec_revision));
|
|
||||||
if (m_codec_revision == AC97Revision::Reserved)
|
|
||||||
return ENOTSUP;
|
|
||||||
|
|
||||||
// Enable variable and double rate PCM audio if supported
|
// Enable variable and double rate PCM audio if supported
|
||||||
auto extended_audio_status_control_register = m_io_mixer_base.offset(NativeAudioMixerRegister::ExtendedAudioStatusControl);
|
auto extended_audio_status_control_register = m_io_mixer_base.offset(NativeAudioMixerRegister::ExtendedAudioStatusControl);
|
||||||
auto extended_audio_status = extended_audio_status_control_register.in<u16>();
|
auto extended_audio_status = extended_audio_status_control_register.in<u16>();
|
||||||
|
|
|
@ -40,6 +40,8 @@ private:
|
||||||
ExtendedAudioID = 0x28,
|
ExtendedAudioID = 0x28,
|
||||||
ExtendedAudioStatusControl = 0x2a,
|
ExtendedAudioStatusControl = 0x2a,
|
||||||
PCMFrontDACRate = 0x2c,
|
PCMFrontDACRate = 0x2c,
|
||||||
|
VendorID1 = 0x7c,
|
||||||
|
VendorID2 = 0x7e,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ExtendedAudioMask : u16 {
|
enum ExtendedAudioMask : u16 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue