nvbios/power/base_clock: partly parse the entries for version 0x20
@@ -895,11 +895,26 @@ int envy_bios_parse_power_base_clock(struct envy_bios *bios) {
bce->offset = bc->offset + bc->hlen + i * (bc->rlen + (bc->selen * bc->secount));
bios_u8(bios, bce->offset, &bce->pstate);
+
+ if (bc->version == 0x10) {
bios_u16(bios, bce->offset + 0x1, &bce->reqPower);
bios_u16(bios, bce->offset + 0x3, &bce->reqSlowdownPower);
+ }
+
bce->clock = malloc(bc->secount * sizeof(uint16_t));
- for (j = 0; j < bc->secount; j++)
- bios_u16(bios, bce->offset + bc->rlen + j, &bce->clock[j]);
+ for (j = 0; j < bc->secount; j++) {
+ uint32_t suboffset = bce->offset + bc->rlen + j * bc->selen;
+ uint16_t clock;
+ switch (bc->version) {
+ case 0x10:
+ bios_u16(bios, suboffset, &bce->clock[j]);
+ break;
+ case 0x20:
+ bios_u16(bios, suboffset + 0x2, &clock);
+ bce->clock[j] = clock * 4;
+ break;
+ }
+ }
}
return 0;
@@ -970,7 +985,7 @@ void envy_bios_print_power_base_clock(struct envy_bios *bios, FILE *out, unsigne
if (!bce || bce->pstate == 0x0 || bce->pstate == 0xff)
continue;
- if (bc->version == 0x10) {
+ if (bc->version >= 0x10 && bc->version <= 0x20) {
fprintf(out, "-- entry %i, pstate = %x, reqPower = %i mW, reqSlowdownPower = %i mW",
i, bce->pstate, bce->reqPower * 10, bce->reqSlowdownPower * 10);
for (j = 0; j < bc->secount; j++)
