Skip to content

Commit d487713

Browse files
asahilinajannau
authored andcommitted
drm/asahi: hw,initdata: Initdata fixes for G14S
Signed-off-by: Asahi Lina <[email protected]>
1 parent a44560d commit d487713

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

drivers/gpu/drm/asahi/hw/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ pub(crate) struct HwConfigA {
171171
#[allow(missing_docs)]
172172
#[derive(Debug, Copy, Clone)]
173173
pub(crate) struct HwConfigB {
174+
pub(crate) unk_454: u32,
174175
pub(crate) unk_4e0: u64,
175176
pub(crate) unk_534: u32,
176177
pub(crate) unk_ab8: u32,

drivers/gpu/drm/asahi/hw/t600x.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub(crate) const HWCONFIG_T6002: super::HwConfig = HwConfig {
7979
unk_e24: 125,
8080
},
8181
db: HwConfigB {
82+
unk_454: 1,
8283
unk_4e0: 4,
8384
unk_534: 1,
8485
unk_ab8: 0x2084,

drivers/gpu/drm/asahi/hw/t602x.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::f32;
66

77
use super::*;
88

9-
const fn iomaps(mcc_count: usize) -> [Option<IOMapping>; 24] {
9+
const fn iomaps(chip_id: u32, mcc_count: usize) -> [Option<IOMapping>; 24] {
1010
[
1111
Some(IOMapping::new(0x404d00000, 0x144000, 0x144000, true)), // Fender
1212
Some(IOMapping::new(0x20e100000, 0x4000, 0x4000, false)), // AICTimer
@@ -15,18 +15,21 @@ const fn iomaps(mcc_count: usize) -> [Option<IOMapping>; 24] {
1515
None, // UVD
1616
None, // unused
1717
None, // DisplayUnderrunWA
18-
Some(IOMapping::new(0x28e478000, 0x4000, 0x4000, false)), // AnalogTempSensorControllerRegs
19-
None, // PMPDoorbell
20-
Some(IOMapping::new(0x404e08000, 0x8000, 0x8000, true)), // MetrologySensorRegs
21-
None, // GMGIFAFRegs
18+
Some(match chip_id {
19+
0x6020 => IOMapping::new(0x28e460000, 0x4000, 0x4000, false),
20+
_ => IOMapping::new(0x28e478000, 0x8000, 0x4000, false),
21+
}), // AnalogTempSensorControllerRegs
22+
None, // PMPDoorbell
23+
Some(IOMapping::new(0x404e08000, 0x8000, 0x8000, true)), // MetrologySensorRegs
24+
None, // GMGIFAFRegs
2225
Some(IOMapping::new(
2326
0x200000000,
2427
mcc_count * 0xd8000,
2528
0xd8000,
2629
true,
2730
)), // MCache registers
28-
Some(IOMapping::new(0x28e118000, 0x4000, 0x4000, false)), // AICBankedRegisters
29-
None, // PMGRScratch
31+
Some(IOMapping::new(0x28e118000, 0x4000, 0x4000, false)), // AICBankedRegisters
32+
None, // PMGRScratch
3033
None, // NIA Special agent idle register die 0
3134
None, // NIA Special agent idle register die 1
3235
None, // CRE registers
@@ -79,6 +82,7 @@ pub(crate) const HWCONFIG_T6022: super::HwConfig = HwConfig {
7982
unk_e24: 125,
8083
},
8184
db: HwConfigB {
85+
unk_454: 1,
8286
unk_4e0: 4,
8387
unk_534: 0,
8488
unk_ab8: 0, // Unused
@@ -136,7 +140,7 @@ pub(crate) const HWCONFIG_T6022: super::HwConfig = HwConfig {
136140
fast_sensor_mask: [0x40005000c000d00, 0x40005000c000d00],
137141
fast_sensor_mask_alt: [0x140015001d001d00, 0x140015001d001d00],
138142
fast_die0_sensor_present: 0, // Unused
139-
io_mappings: &iomaps(16),
143+
io_mappings: &iomaps(0x6022, 16),
140144
sram_base: Some(0x404d60000),
141145
sram_size: Some(0x20000),
142146
};
@@ -150,7 +154,7 @@ pub(crate) const HWCONFIG_T6021: super::HwConfig = HwConfig {
150154
max_num_clusters: 4,
151155
fast_sensor_mask: [0x40005000c000d00, 0],
152156
fast_sensor_mask_alt: [0x140015001d001d00, 0],
153-
io_mappings: &iomaps(8),
157+
io_mappings: &iomaps(0x6021, 8),
154158
..HWCONFIG_T6022
155159
};
156160

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

166+
db: HwConfigB {
167+
unk_454: 0,
168+
..HWCONFIG_T6021.db
169+
},
170+
162171
max_num_clusters: 2,
163172
fast_sensor_mask: [0xc000d00, 0],
164173
fast_sensor_mask_alt: [0x1d001d00, 0],
165-
io_mappings: &iomaps(4),
174+
io_mappings: &iomaps(0x6020, 4),
166175
..HWCONFIG_T6021
167176
};

drivers/gpu/drm/asahi/hw/t8103.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub(crate) const HWCONFIG: super::HwConfig = HwConfig {
3939
unk_e24: 112,
4040
},
4141
db: HwConfigB {
42+
unk_454: 1,
4243
unk_4e0: 0,
4344
unk_534: 0,
4445
unk_ab8: 0x48,

drivers/gpu/drm/asahi/hw/t8112.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub(crate) const HWCONFIG: super::HwConfig = HwConfig {
3939
unk_e24: 125,
4040
},
4141
db: HwConfigB {
42+
unk_454: 1,
4243
unk_4e0: 4,
4344
unk_534: 0,
4445
unk_ab8: 0x2048,

drivers/gpu/drm/asahi/initdata.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl<'a> InitDataBuilder::ver<'a> {
494494
unkptr_38: U64(0xffffffa0_11800000),
495495
// TODO: yuv matrices
496496
chip_id: cfg.chip_id,
497-
unk_454: 0x1,
497+
unk_454: cfg.db.unk_454,
498498
unk_458: 0x1,
499499
unk_460: 0x1,
500500
unk_464: 0x1,
@@ -608,6 +608,12 @@ impl<'a> InitDataBuilder::ver<'a> {
608608
}
609609
}
610610

611+
// Special case override for T602x
612+
#[ver(G == G14X)]
613+
if dyncfg.id.gpu_rev_id == hw::GpuRevisionID::B1 {
614+
raw.gpu_rev_id = hw::GpuRevisionID::B0 as u32;
615+
}
616+
611617
Ok(())
612618
},
613619
)

0 commit comments

Comments
 (0)