Change the way hwquirks are processed. Add a pointer to the needed function on quirk struct, so it can be executed at any point of the code

This commit is contained in:
Sam Demeulemeester 2022-06-05 14:36:56 +02:00
parent e154320790
commit fa563a8cb2
3 changed files with 9 additions and 1 deletions

View File

@ -54,6 +54,7 @@ void quirks_init(void)
quirk.type = QUIRK_TYPE_NONE; quirk.type = QUIRK_TYPE_NONE;
quirk.root_vid = pci_config_read16(0, 0, 0, 0); quirk.root_vid = pci_config_read16(0, 0, 0, 0);
quirk.root_did = pci_config_read16(0, 0, 0, 2); quirk.root_did = pci_config_read16(0, 0, 0, 2);
quirk.process = NULL;
// ------------------------ // ------------------------
// -- ASUS TUSL2-C Quirk -- // -- ASUS TUSL2-C Quirk --
@ -66,7 +67,7 @@ void quirks_init(void)
if (pci_config_read16(0, 0, 0, 0x2E) == 0x8027) { // TUSL2-C if (pci_config_read16(0, 0, 0, 0x2E) == 0x8027) { // TUSL2-C
quirk.id = QUIRK_TUSL2; quirk.id = QUIRK_TUSL2;
quirk.type |= QUIRK_TYPE_SMBUS; quirk.type |= QUIRK_TYPE_SMBUS;
asus_tusl2_configure_mux(); quirk.process = asus_tusl2_configure_mux;
} }
} }
} }

View File

@ -10,6 +10,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h>
#define QUIRK_TYPE_NONE 0b00000000 #define QUIRK_TYPE_NONE 0b00000000
#define QUIRK_TYPE_USB 0b00000001 #define QUIRK_TYPE_USB 0b00000001
@ -28,6 +29,7 @@ typedef struct {
uint8_t type; uint8_t type;
uint16_t root_vid; uint16_t root_vid;
uint16_t root_did; uint16_t root_did;
void (*process)(void);
} quirk_t; } quirk_t;
extern quirk_t quirk; extern quirk_t quirk;

View File

@ -12,6 +12,7 @@
#include "smbus.h" #include "smbus.h"
#include "smbios.h" #include "smbios.h"
#include "jedec_id.h" #include "jedec_id.h"
#include "hwquirks.h"
#define LINE_SPD 13 #define LINE_SPD 13
#define MAX_SPD_SLOT 8 #define MAX_SPD_SLOT 8
@ -153,6 +154,10 @@ void print_smbus_startup_info(void) {
ram.freq = 0; ram.freq = 0;
curspd.isValid = false; curspd.isValid = false;
if (quirk.type == QUIRK_TYPE_SMBUS) {
quirk.process();
}
index = find_smb_controller(); index = find_smb_controller();
if (index == -1) { if (index == -1) {