Check both Super IO addresses, initialize configuration registers

This commit is contained in:
Adam Honse
2020-02-17 12:31:06 -06:00
parent ef026a9582
commit 06e02abb77
3 changed files with 33 additions and 14 deletions

View File

@@ -28,8 +28,18 @@ MSIRGBController::MSIRGBController(int sioaddr)
if((enable & MSI_SIO_RGB_ENABLE_MASK) != MSI_SIO_RGB_ENABLE_MASK)
{
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_ENABLE, MSI_SIO_RGB_ENABLE_MASK);
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_ENABLE, MSI_SIO_RGB_ENABLE_MASK & (enable & !MSI_SIO_RGB_ENABLE_MASK));
}
/*-----------------------------------------------------*\
| Lighting enabled, no pulsing or blinking |
\*-----------------------------------------------------*/
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_1, 0x00);
/*-----------------------------------------------------*\
| Lighting enabled, RGB non-inverted, header on |
\*-----------------------------------------------------*/
superio_outb(msi_sioaddr, MSI_SIO_RGB_REG_CFG_3, 0xE2);
}
MSIRGBController::~MSIRGBController()

View File

@@ -19,6 +19,7 @@
enum
{
MSI_SIO_RGB_REG_ENABLE = 0xE0,
MSI_SIO_RGB_REG_CFG_1 = 0xE4,
MSI_SIO_RGB_REG_RED_1_0 = 0xF0,
MSI_SIO_RGB_REG_RED_3_2 = 0xF1,
MSI_SIO_RGB_REG_RED_5_4 = 0xF2,
@@ -31,6 +32,8 @@ enum
MSI_SIO_RGB_REG_BLUE_3_2 = 0xF9,
MSI_SIO_RGB_REG_BLUE_5_4 = 0xFA,
MSI_SIO_RGB_REG_BLUE_7_6 = 0xFB,
MSI_SIO_RGB_REG_CFG_2 = 0xFE,
MSI_SIO_RGB_REG_CFG_3 = 0xFF,
};
#define MSI_SIO_RGB_ENABLE_MASK 0xE0

View File

@@ -16,21 +16,27 @@
void DetectMSIRGBControllers(std::vector<RGBController*> &rgb_controllers)
{
int sioaddr = 0x2E;
superio_enter(sioaddr);
int sio_addrs[2] = {0x2E, 0x4E};
int val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) | superio_inb(sioaddr, SIO_REG_DEVID + 1);
printf("Super IO DevID: %04X", val);
switch (val & SIO_ID_MASK)
for(int sioaddr_idx = 0; sioaddr_idx < 2; sioaddr_idx++)
{
case SIO_NCT6795_ID:
case SIO_NCT6797_ID:
MSIRGBController* new_msi = new MSIRGBController(sioaddr);
RGBController_MSIRGB* new_rgb = new RGBController_MSIRGB(new_msi);
int sioaddr = sio_addrs[sioaddr_idx];
superio_enter(sioaddr);
rgb_controllers.push_back(new_rgb);
break;
int val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) | superio_inb(sioaddr, SIO_REG_DEVID + 1);
printf("Super IO DevID: %04X", val);
switch (val & SIO_ID_MASK)
{
case SIO_NCT6795_ID:
case SIO_NCT6797_ID:
MSIRGBController* new_msi = new MSIRGBController(sioaddr);
RGBController_MSIRGB* new_rgb = new RGBController_MSIRGB(new_msi);
rgb_controllers.push_back(new_rgb);
break;
}
}
} /* DetectMSIRGBControllers() */