File drivers/gpu/alga/amd/atombios/vram.c changed (mode: 100644) (index daec212..1c192fe) |
... |
... |
static long regs_addr_cpy(struct atombios *atb, struct reg_tbl_partial *reg_tbl, |
51 |
51 |
|
|
52 |
52 |
reg_idxs_sz = get_unaligned_le16(®_tbl->idxs_sz); |
reg_idxs_sz = get_unaligned_le16(®_tbl->idxs_sz); |
53 |
53 |
/* remove the terminating REG_IDX_MISC_TERMINATOR element */ |
/* remove the terminating REG_IDX_MISC_TERMINATOR element */ |
54 |
|
regs_n = reg_idxs_sz / sizeof(struct reg_idx) - 1; |
|
|
54 |
|
regs_n = reg_idxs_sz / sizeof(*reg_idx) - 1; |
55 |
55 |
if (regs_n > REGS_N_MAX) { |
if (regs_n > REGS_N_MAX) { |
56 |
56 |
dev_err(atb->adev.dev, "atombios:vram_info too many memory controller registers\n"); |
dev_err(atb->adev.dev, "atombios:vram_info too many memory controller registers\n"); |
57 |
57 |
return -ATB_ERR; |
return -ATB_ERR; |
58 |
58 |
} |
} |
59 |
59 |
|
|
60 |
60 |
/* point to the first struct reg_idx of the array in the tbl */ |
/* point to the first struct reg_idx of the array in the tbl */ |
61 |
|
reg_idx = (struct reg_idx*)((u8*)reg_tbl + sizeof(reg_tbl)); |
|
|
61 |
|
reg_idx = (struct reg_idx*)((u8*)reg_tbl + sizeof(*reg_tbl)); |
62 |
62 |
reg = 0; |
reg = 0; |
63 |
63 |
while (reg < regs_n) { |
while (reg < regs_n) { |
64 |
64 |
if (reg_idx->misc & REG_IDX_MISC_TERMINATOR) |
if (reg_idx->misc & REG_IDX_MISC_TERMINATOR) |
65 |
65 |
break; |
break; |
66 |
66 |
|
|
67 |
67 |
atb_mc_reg_tbl->addrs[reg] = (u32)( |
atb_mc_reg_tbl->addrs[reg] = (u32)( |
68 |
|
get_unaligned_le16( ®_idx->idx) |
|
|
68 |
|
get_unaligned_le16(®_idx->idx) |
69 |
69 |
<< 2); |
<< 2); |
70 |
70 |
regs_val_location[reg] = reg_idx->misc |
regs_val_location[reg] = reg_idx->misc |
71 |
71 |
& REG_IDX_MISC_REG_VAL_LOCATION; |
& REG_IDX_MISC_REG_VAL_LOCATION; |
|
... |
... |
static void regs_vals_cpy(struct atb_mc_reg_tbl *atb_mc_reg_tbl, |
90 |
90 |
for (reg = 0; reg < atb_mc_reg_tbl->addrs_n; ++reg) { |
for (reg = 0; reg < atb_mc_reg_tbl->addrs_n; ++reg) { |
91 |
91 |
if (regs_val_location[reg] == REG_IDX_MISC_REG_VAL_FROM_TBL) { |
if (regs_val_location[reg] == REG_IDX_MISC_REG_VAL_FROM_TBL) { |
92 |
92 |
atb_mc_reg_tbl->sets[set_idx].vals[reg] |
atb_mc_reg_tbl->sets[set_idx].vals[reg] |
93 |
|
= get_unaligned_le32(&cur_reg_val); |
|
|
93 |
|
= get_unaligned_le32(cur_reg_val); |
94 |
94 |
++cur_reg_val; |
++cur_reg_val; |
95 |
95 |
} else if (regs_val_location[reg] |
} else if (regs_val_location[reg] |
96 |
|
== REG_IDX_MISC_REG_VAL_EQU_PREV) { |
|
|
96 |
|
== REG_IDX_MISC_REG_VAL_FROM_PREV_VAL) { |
97 |
97 |
atb_mc_reg_tbl->sets[set_idx].vals[reg] |
atb_mc_reg_tbl->sets[set_idx].vals[reg] |
98 |
|
= atb_mc_reg_tbl->sets[set_idx - 1].vals[reg]; |
|
|
98 |
|
= atb_mc_reg_tbl->sets[set_idx].vals[reg - 1]; |
99 |
99 |
} |
} |
100 |
100 |
} |
} |
101 |
101 |
} |
} |
|
... |
... |
static long sets_cpy(struct atombios *atb, struct reg_tbl_partial *reg_tbl, |
111 |
111 |
u32 set_misc; |
u32 set_misc; |
112 |
112 |
|
|
113 |
113 |
reg_idxs_sz = get_unaligned_le16(®_tbl->idxs_sz); |
reg_idxs_sz = get_unaligned_le16(®_tbl->idxs_sz); |
114 |
|
set = (struct reg_set_partial*)((u8*)reg_tbl + sizeof(reg_tbl) |
|
|
114 |
|
set = (struct reg_set_partial*)((u8*)reg_tbl + sizeof(*reg_tbl) |
115 |
115 |
+ reg_idxs_sz); |
+ reg_idxs_sz); |
116 |
116 |
set_sz = get_unaligned_le16(®_tbl->set_sz); |
set_sz = get_unaligned_le16(®_tbl->set_sz); |
117 |
117 |
|
|
|
... |
... |
static long sets_cpy(struct atombios *atb, struct reg_tbl_partial *reg_tbl, |
141 |
141 |
set = (struct reg_set_partial*)((u8*)set + set_sz); |
set = (struct reg_set_partial*)((u8*)set + set_sz); |
142 |
142 |
} |
} |
143 |
143 |
if (set_misc != REG_SET_MISC_TERMINATOR) { |
if (set_misc != REG_SET_MISC_TERMINATOR) { |
144 |
|
dev_err(atb->adev.dev, "atombios:vram_info corrupted set of memory controller register values\n"); |
|
|
144 |
|
dev_err(atb->adev.dev, "atombios:vram_info corrupted sets of memory controller register values\n"); |
145 |
145 |
return -ATB_ERR; |
return -ATB_ERR; |
146 |
146 |
} |
} |
147 |
147 |
atb_mc_reg_tbl->sets_n = set_idx; |
atb_mc_reg_tbl->sets_n = set_idx; |
|
... |
... |
long atb_vram_info(struct atombios *atb, struct atb_mc_reg_tbl *atb_mc_reg_tbl) |
175 |
175 |
s4 = atb->adev.rr32(atb->adev.dev, S4); |
s4 = atb->adev.rr32(atb->adev.dev, S4); |
176 |
176 |
module_idx = (u8)((s4 >> 16) & 0xff); |
module_idx = (u8)((s4 >> 16) & 0xff); |
177 |
177 |
|
|
178 |
|
if (module_idx >= info->modules_n) { |
|
179 |
|
dev_err(atb->adev.dev, "atombios:vram_info invalid module index\n"); |
|
180 |
|
return -ATB_ERR; |
|
181 |
|
} |
|
182 |
|
|
|
183 |
178 |
of = get_unaligned_le16(&info->mem_clk_patch_tbl_of); |
of = get_unaligned_le16(&info->mem_clk_patch_tbl_of); |
184 |
179 |
reg_tbl = (struct reg_tbl_partial*)((u8*)info + of); |
reg_tbl = (struct reg_tbl_partial*)((u8*)info + of); |
185 |
180 |
|
|
File drivers/gpu/alga/amd/si/dyn_pm/dyn_pm.c changed (mode: 100644) (index 4970037..24ed225) |
... |
... |
void dyn_pm_pre_ena(struct pci_dev *dev) |
721 |
721 |
|
|
722 |
722 |
/* |
/* |
723 |
723 |
* during the smc tbls init, in order to compute the dram timings for |
* during the smc tbls init, in order to compute the dram timings for |
724 |
|
* the mc arb, an atombios table is used. But that atombios table is |
|
725 |
|
* actually programming the hw. To be more accurate, that atombios table |
|
|
724 |
|
* the mc arb, an atombios tbl is used. But that atombios tbl is |
|
725 |
|
* actually programming the hw. To be more accurate, that atombios tbl |
726 |
726 |
* is programming the mc arb reg set f0. The mc arb has 4 hw sets of |
* is programming the mc arb reg set f0. The mc arb has 4 hw sets of |
727 |
|
* regs. Then the currently used hw set is switch to f1 to let us |
|
|
727 |
|
* regs. Then the currently used hw set is switched to f1 to let us |
728 |
728 |
* use the hw set f0 to compute dram timings without touching the |
* use the hw set f0 to compute dram timings without touching the |
729 |
729 |
* currently used timings. |
* currently used timings. |
730 |
730 |
* Please amd, fix this with a clean atombios tbl! :) |
* Please amd, fix this with a clean atombios tbl! :) |
File drivers/gpu/alga/amd/si/dyn_pm/smc_tbls.c changed (mode: 100644) (index 8de94b2..3369697) |
... |
... |
static void tbls_cpy(struct ctx *ctx, struct smc_state_tbl *smc_state_tbl, |
117 |
117 |
#ifdef CONFIG_ALGA_AMD_SI_DYN_PM_LOG |
#ifdef CONFIG_ALGA_AMD_SI_DYN_PM_LOG |
118 |
118 |
memset(smc_mc_arb_tbl, 0, sizeof(*smc_mc_arb_tbl)); |
memset(smc_mc_arb_tbl, 0, sizeof(*smc_mc_arb_tbl)); |
119 |
119 |
smc_memcpy_from(ctx->dev, (u8*)smc_mc_arb_tbl, smc_ram_tbl_of, |
smc_memcpy_from(ctx->dev, (u8*)smc_mc_arb_tbl, smc_ram_tbl_of, |
120 |
|
sizeof(*smc_mc_reg_tbl)); |
|
|
120 |
|
sizeof(*smc_mc_arb_tbl)); |
121 |
121 |
smc_mc_arb_tbl_dump(smc_mc_arb_tbl); |
smc_mc_arb_tbl_dump(smc_mc_arb_tbl); |
122 |
122 |
#endif |
#endif |
123 |
123 |
|
|