Add External L2 detection for ALi Aladdin V Chipset (#87)

This commit is contained in:
Sam Demeulemeester 2022-06-06 19:56:04 +02:00
parent 9ed7e22091
commit 6cd356f831
5 changed files with 48 additions and 10 deletions

View File

@ -216,12 +216,12 @@ static void global_init(void)
pci_init();
quirks_init();
membw_init();
smbios_init();
quirks_init();
badram_init();
config_init();

View File

@ -25,6 +25,7 @@
#include "pmem.h"
#include "vmem.h"
#include "memsize.h"
#include "hwquirks.h"
#include "cpuinfo.h"
@ -1089,6 +1090,10 @@ void cpuinfo_init(void)
void membw_init(void)
{
if (quirk.type & QUIRK_TYPE_MEM_SIZE) {
quirk.process();
}
if(enable_bench) {
measure_memory_bandwidth();
}

View File

@ -12,6 +12,7 @@
#include "io.h"
#include "pci.h"
#include "unistd.h"
#include "cpuinfo.h"
quirk_t quirk;
@ -44,6 +45,25 @@ static void asus_tusl2_configure_mux(void)
outb(0xAA, 0x2E);
}
static void get_m1541_l2_cache_size(void)
{
if (l2_cache != 0) {
return;
}
// Check if L2 cache is enabled with L2CC-2 Register[0]
if ((pci_config_read8(0, 0, 0, 0x42) & 1) == 0) {
return;
}
// Get L2 Cache Size with L2CC-1 Register[3:2]
uint8_t reg = (pci_config_read8(0, 0, 0, 0x41) >> 2) & 3;
if (reg == 0b00) { l2_cache = 256; }
if (reg == 0b01) { l2_cache = 512; }
if (reg == 0b10) { l2_cache = 1024; }
}
// ---------------------
// -- Public function --
// ---------------------
@ -56,6 +76,17 @@ void quirks_init(void)
quirk.root_did = pci_config_read16(0, 0, 0, 2);
quirk.process = NULL;
// -------------------------
// -- ALi Aladdin V Quirk --
// -------------------------
// As on many Socket 7 Motherboard, the L2 cache is external and must
// be detected by a proprietary way based on chipset registers
if (quirk.root_vid == 0x10B9 && quirk.root_did == 0x1541) { // ALi Aladdin V (M1541)
quirk.id = QUIRK_ALI_ALADDIN_V;
quirk.type |= QUIRK_TYPE_MEM_SIZE;
quirk.process = get_m1541_l2_cache_size;
}
// ------------------------
// -- ASUS TUSL2-C Quirk --
// ------------------------

View File

@ -12,16 +12,18 @@
#include <stdint.h>
#include <stddef.h>
#define QUIRK_TYPE_NONE 0b00000000
#define QUIRK_TYPE_USB 0b00000001
#define QUIRK_TYPE_SMP 0b00000010
#define QUIRK_TYPE_SMBIOS 0b00000100
#define QUIRK_TYPE_SMBUS 0b00001000
#define QUIRK_TYPE_TIMER 0b00010000
#define QUIRK_TYPE_NONE (1 << 0)
#define QUIRK_TYPE_USB (1 << 1)
#define QUIRK_TYPE_SMP (1 << 2)
#define QUIRK_TYPE_SMBIOS (1 << 3)
#define QUIRK_TYPE_SMBUS (1 << 4)
#define QUIRK_TYPE_TIMER (1 << 5)
#define QUIRK_TYPE_MEM_SIZE (1 << 6)
typedef enum {
QUIRK_NONE,
QUIRK_TUSL2
QUIRK_TUSL2,
QUIRK_ALI_ALADDIN_V
} quirk_id_t;
typedef struct {

View File

@ -154,7 +154,7 @@ void print_smbus_startup_info(void) {
ram.freq = 0;
curspd.isValid = false;
if (quirk.type == QUIRK_TYPE_SMBUS) {
if (quirk.type & QUIRK_TYPE_SMBUS) {
quirk.process();
}