Skip to content

Commit

Permalink
drm/asahi: hw,initdata: Initdata fixes for G14S
Browse files Browse the repository at this point in the history
Signed-off-by: Asahi Lina <lina@asahilina.net>
  • Loading branch information
asahilina authored and jannau committed Dec 21, 2024
1 parent a44560d commit d487713
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/asahi/hw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ pub(crate) struct HwConfigA {
#[allow(missing_docs)]
#[derive(Debug, Copy, Clone)]
pub(crate) struct HwConfigB {
pub(crate) unk_454: u32,
pub(crate) unk_4e0: u64,
pub(crate) unk_534: u32,
pub(crate) unk_ab8: u32,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/asahi/hw/t600x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub(crate) const HWCONFIG_T6002: super::HwConfig = HwConfig {
unk_e24: 125,
},
db: HwConfigB {
unk_454: 1,
unk_4e0: 4,
unk_534: 1,
unk_ab8: 0x2084,
Expand Down
29 changes: 19 additions & 10 deletions drivers/gpu/drm/asahi/hw/t602x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::f32;

use super::*;

const fn iomaps(mcc_count: usize) -> [Option<IOMapping>; 24] {
const fn iomaps(chip_id: u32, mcc_count: usize) -> [Option<IOMapping>; 24] {
[
Some(IOMapping::new(0x404d00000, 0x144000, 0x144000, true)), // Fender
Some(IOMapping::new(0x20e100000, 0x4000, 0x4000, false)), // AICTimer
Expand All @@ -15,18 +15,21 @@ const fn iomaps(mcc_count: usize) -> [Option<IOMapping>; 24] {
None, // UVD
None, // unused
None, // DisplayUnderrunWA
Some(IOMapping::new(0x28e478000, 0x4000, 0x4000, false)), // AnalogTempSensorControllerRegs
None, // PMPDoorbell
Some(IOMapping::new(0x404e08000, 0x8000, 0x8000, true)), // MetrologySensorRegs
None, // GMGIFAFRegs
Some(match chip_id {
0x6020 => IOMapping::new(0x28e460000, 0x4000, 0x4000, false),
_ => IOMapping::new(0x28e478000, 0x8000, 0x4000, false),
}), // AnalogTempSensorControllerRegs
None, // PMPDoorbell
Some(IOMapping::new(0x404e08000, 0x8000, 0x8000, true)), // MetrologySensorRegs
None, // GMGIFAFRegs
Some(IOMapping::new(
0x200000000,
mcc_count * 0xd8000,
0xd8000,
true,
)), // MCache registers
Some(IOMapping::new(0x28e118000, 0x4000, 0x4000, false)), // AICBankedRegisters
None, // PMGRScratch
Some(IOMapping::new(0x28e118000, 0x4000, 0x4000, false)), // AICBankedRegisters
None, // PMGRScratch
None, // NIA Special agent idle register die 0
None, // NIA Special agent idle register die 1
None, // CRE registers
Expand Down Expand Up @@ -79,6 +82,7 @@ pub(crate) const HWCONFIG_T6022: super::HwConfig = HwConfig {
unk_e24: 125,
},
db: HwConfigB {
unk_454: 1,
unk_4e0: 4,
unk_534: 0,
unk_ab8: 0, // Unused
Expand Down Expand Up @@ -136,7 +140,7 @@ pub(crate) const HWCONFIG_T6022: super::HwConfig = HwConfig {
fast_sensor_mask: [0x40005000c000d00, 0x40005000c000d00],
fast_sensor_mask_alt: [0x140015001d001d00, 0x140015001d001d00],
fast_die0_sensor_present: 0, // Unused
io_mappings: &iomaps(16),
io_mappings: &iomaps(0x6022, 16),
sram_base: Some(0x404d60000),
sram_size: Some(0x20000),
};
Expand All @@ -150,7 +154,7 @@ pub(crate) const HWCONFIG_T6021: super::HwConfig = HwConfig {
max_num_clusters: 4,
fast_sensor_mask: [0x40005000c000d00, 0],
fast_sensor_mask_alt: [0x140015001d001d00, 0],
io_mappings: &iomaps(8),
io_mappings: &iomaps(0x6021, 8),
..HWCONFIG_T6022
};

Expand All @@ -159,9 +163,14 @@ pub(crate) const HWCONFIG_T6020: super::HwConfig = HwConfig {
gpu_variant: GpuVariant::S,
gpu_core: GpuCore::G14S,

db: HwConfigB {
unk_454: 0,
..HWCONFIG_T6021.db
},

max_num_clusters: 2,
fast_sensor_mask: [0xc000d00, 0],
fast_sensor_mask_alt: [0x1d001d00, 0],
io_mappings: &iomaps(4),
io_mappings: &iomaps(0x6020, 4),
..HWCONFIG_T6021
};
1 change: 1 addition & 0 deletions drivers/gpu/drm/asahi/hw/t8103.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub(crate) const HWCONFIG: super::HwConfig = HwConfig {
unk_e24: 112,
},
db: HwConfigB {
unk_454: 1,
unk_4e0: 0,
unk_534: 0,
unk_ab8: 0x48,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/asahi/hw/t8112.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub(crate) const HWCONFIG: super::HwConfig = HwConfig {
unk_e24: 125,
},
db: HwConfigB {
unk_454: 1,
unk_4e0: 4,
unk_534: 0,
unk_ab8: 0x2048,
Expand Down
8 changes: 7 additions & 1 deletion drivers/gpu/drm/asahi/initdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ impl<'a> InitDataBuilder::ver<'a> {
unkptr_38: U64(0xffffffa0_11800000),
// TODO: yuv matrices
chip_id: cfg.chip_id,
unk_454: 0x1,
unk_454: cfg.db.unk_454,
unk_458: 0x1,
unk_460: 0x1,
unk_464: 0x1,
Expand Down Expand Up @@ -608,6 +608,12 @@ impl<'a> InitDataBuilder::ver<'a> {
}
}

// Special case override for T602x
#[ver(G == G14X)]
if dyncfg.id.gpu_rev_id == hw::GpuRevisionID::B1 {
raw.gpu_rev_id = hw::GpuRevisionID::B0 as u32;
}

Ok(())
},
)
Expand Down

0 comments on commit d487713

Please sign in to comment.