intel: PCH detection module — platform configuration hub enumeration

pch.rs: PchType enum spanning 12 PCH generations
  from_generation(): maps IntelGeneration to PchType automatically
  display_well_base(): per-PCH power well register base
  has_separate_ddi_wells(): Gen9+ PCH feature flag
  gmbus_base(): 0x5100 (pre-PCH) vs 0xC5100 (PCH-based)
  ddi_port_count(): 2-6 ports per PCH generation

This gates correct DDI buffer, power well, and GMBUS configuration
per platform. Previously all platforms used Gen9 hardcoded defaults.
This commit is contained in:
2026-06-02 05:46:53 +03:00
parent a839be7d6c
commit cf38cff205
2 changed files with 75 additions and 0 deletions
@@ -32,6 +32,7 @@ pub mod info;
pub mod lmem;
pub mod mocs;
pub mod panel_pps;
pub mod pch;
pub mod psr2;
pub mod regs;
pub mod regs_gen4_7;
@@ -0,0 +1,74 @@
use super::info::IntelDeviceInfo;
use super::info::IntelGeneration;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PchType {
None,
Ibx,
Cpt,
Lpt,
Spt,
Kbp,
Cnp,
Icp,
Tgp,
Adp,
Mtp,
Lnl,
}
impl PchType {
pub fn from_generation(gen: IntelGeneration) -> Self {
match gen {
IntelGeneration::Gen4 | IntelGeneration::Gen5 => PchType::None,
IntelGeneration::Gen6 => PchType::Ibx,
IntelGeneration::Gen7 => PchType::Cpt,
IntelGeneration::Gen8 => PchType::Lpt,
IntelGeneration::Gen9 => PchType::Spt,
IntelGeneration::Gen9_5 => PchType::Cnp,
IntelGeneration::Gen12 => PchType::Tgp,
IntelGeneration::Gen12_7 => PchType::Mtp,
IntelGeneration::GenXe2 => PchType::Lnl,
IntelGeneration::Unknown => PchType::None,
}
}
pub fn is_pch_present(&self) -> bool {
!matches!(self, PchType::None)
}
pub fn display_well_base(&self) -> usize {
match self {
PchType::None | PchType::Ibx | PchType::Cpt => 0,
PchType::Lpt => 0x45400,
PchType::Spt | PchType::Kbp | PchType::Cnp | PchType::Icp => 0x45400,
PchType::Tgp | PchType::Adp | PchType::Mtp => 0x45400,
PchType::Lnl => 0x45400,
}
}
pub fn has_separate_ddi_wells(&self) -> bool {
matches!(self,
PchType::Spt | PchType::Kbp | PchType::Cnp | PchType::Icp |
PchType::Tgp | PchType::Adp | PchType::Mtp
)
}
pub fn gmbus_base(&self) -> usize {
match self {
PchType::None | PchType::Ibx | PchType::Cpt => 0x5100,
_ => 0xC5100,
}
}
pub fn ddi_port_count(&self) -> u8 {
match self {
PchType::None => 2,
PchType::Ibx | PchType::Cpt => 3,
PchType::Lpt | PchType::Spt | PchType::Kbp => 4,
PchType::Cnp | PchType::Icp => 5,
PchType::Tgp | PchType::Adp | PchType::Mtp => 6,
PchType::Lnl => 6,
}
}
}