The last Dell laptop I had used a three-wire PSU that locked you in to
buying only Dell-branded power bricks. There's a lockout chip on the
brick that communicates with the motherboard and if it detects it's not
Dell OEM it prevents the battery from charging at full speed and
throttles the processor. down to 400MHz.
the way it does this is the BIOS flips a bit in the processor register
set called BD_PROCHOT which is a flag from the motherboard temperature
sensor, and fools the processor into thinking the temperature sensor on
the motherboard is saying the system is overheating. It does this if it
doesn't receive the proper readout from the power supply brick.
fortunately it's easy to flip it back by running a program or script on
startup, with root access, and then everything works fine again lol.
this is some hopefully cross-platform C code that does just that:
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define BUFSIZE (64)
int get_msr_value(uint64_t* reg_value) {
const char* cmd = "rdmsr -u 0x1FC";
char cmd_buf[BUFSIZE];
FILE* fp;
if ((fp = popen(cmd, "r")) == NULL) {
printf("Error opening pipe!\n");
return -1;
}
cmd_buf[strcspn(fgets(cmd_buf, BUFSIZE, fp), "\n")] = 0;
*reg_value = atoi(cmd_buf);
if (pclose(fp)) {
printf("Command not found or exited with error status\n");
return -1;
}
return 0;
}
int main(void) {
const char* cmd = "wrmsr -a 0x1FC";
char* concat_cmd;
int ret;
uint64_t* reg_value = &(uint64_t){0};
if ((ret = get_msr_value(reg_value))) {
return ret;
}
printf("Old register value: %lu\n", *reg_value);
*reg_value = *reg_value & 0xFFFFFFFE; // clear bit 0
printf("New register value: %lu\n", *reg_value);
if (asprintf(&concat_cmd, "%s %i", cmd, *reg_value) == -1)
return -1;
printf("Executing: %s\n", concat_cmd);
system(concat_cmd);
free(concat_cmd);
return 0;
}