Skip to content

Commit b023612

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

File tree

6 files changed

+35
-11
lines changed

6 files changed

+35
-11
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ pub(crate) struct HwConfigA {
173173
#[allow(missing_docs)]
174174
#[derive(Debug, Copy, Clone)]
175175
pub(crate) struct HwConfigB {
176+
pub(crate) unk_454: u32,
176177
pub(crate) unk_4e0: u64,
177178
pub(crate) unk_534: u32,
178179
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: 24 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,26 @@ 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(IOMapping::new(
19+
match chip_id {
20+
0x6020 => 0x28e460000,
21+
_ => 0x28e478000,
22+
},
23+
0x4000,
24+
0x4000,
25+
false,
26+
)), // AnalogTempSensorControllerRegs
27+
None, // PMPDoorbell
28+
Some(IOMapping::new(0x404e08000, 0x8000, 0x8000, true)), // MetrologySensorRegs
29+
None, // GMGIFAFRegs
2230
Some(IOMapping::new(
2331
0x200000000,
2432
mcc_count * 0xd8000,
2533
0xd8000,
2634
true,
2735
)), // MCache registers
28-
Some(IOMapping::new(0x28e118000, 0x4000, 0x4000, false)), // AICBankedRegisters
29-
None, // PMGRScratch
36+
Some(IOMapping::new(0x28e118000, 0x4000, 0x4000, false)), // AICBankedRegisters
37+
None, // PMGRScratch
3038
None, // NIA Special agent idle register die 0
3139
None, // NIA Special agent idle register die 1
3240
None, // CRE registers
@@ -79,6 +87,7 @@ pub(crate) const HWCONFIG_T6022: super::HwConfig = HwConfig {
7987
unk_e24: 125,
8088
},
8189
db: HwConfigB {
90+
unk_454: 1,
8291
unk_4e0: 4,
8392
unk_534: 0,
8493
unk_ab8: 0, // Unused
@@ -136,7 +145,7 @@ pub(crate) const HWCONFIG_T6022: super::HwConfig = HwConfig {
136145
fast_sensor_mask: [0x40005000c000d00, 0x40005000c000d00],
137146
fast_sensor_mask_alt: [0x140015001d001d00, 0x140015001d001d00],
138147
fast_die0_sensor_present: 0, // Unused
139-
io_mappings: &iomaps(16),
148+
io_mappings: &iomaps(0x6022, 16),
140149
sram_base: Some(0x404d60000),
141150
sram_size: Some(0x20000),
142151
};
@@ -150,7 +159,7 @@ pub(crate) const HWCONFIG_T6021: super::HwConfig = HwConfig {
150159
max_num_clusters: 4,
151160
fast_sensor_mask: [0x40005000c000d00, 0],
152161
fast_sensor_mask_alt: [0x140015001d001d00, 0],
153-
io_mappings: &iomaps(8),
162+
io_mappings: &iomaps(0x6021, 8),
154163
..HWCONFIG_T6022
155164
};
156165

@@ -159,9 +168,14 @@ pub(crate) const HWCONFIG_T6020: super::HwConfig = HwConfig {
159168
gpu_variant: GpuVariant::S,
160169
gpu_core: GpuCore::G14S,
161170

171+
db: HwConfigB {
172+
unk_454: 0,
173+
..HWCONFIG_T6021.db
174+
},
175+
162176
max_num_clusters: 2,
163177
fast_sensor_mask: [0xc000d00, 0],
164178
fast_sensor_mask_alt: [0x1d001d00, 0],
165-
io_mappings: &iomaps(4),
179+
io_mappings: &iomaps(0x6020, 4),
166180
..HWCONFIG_T6021
167181
};

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
@@ -493,7 +493,7 @@ impl<'a> InitDataBuilder::ver<'a> {
493493
unkptr_38: U64(0xffffffa0_11800000),
494494
// TODO: yuv matrices
495495
chip_id: cfg.chip_id,
496-
unk_454: 0x1,
496+
unk_454: cfg.db.unk_454,
497497
unk_458: 0x1,
498498
unk_460: 0x1,
499499
unk_464: 0x1,
@@ -607,6 +607,12 @@ impl<'a> InitDataBuilder::ver<'a> {
607607
}
608608
}
609609

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

0 commit comments

Comments
 (0)