Compare commits

...
Author SHA1 Message Date
Adam Honse 4c06be5e98 Update I801 sniffer to support multiple read/write sizes 2020-06-01 23:36:10 -05:00
Adam Honse 80fe5c14ff Sniffer loop for i801 SMBUS 2019-06-30 13:04:14 -05:00
+126 -3
View File
@@ -555,16 +555,139 @@ void DumpAuraRegisters(AuraController * controller)
* Main function. Detects busses and Aura controllers, then opens the main window *
* *
\******************************************************************************************/
/* I801 SMBus address offsets */
#define SMBHSTSTS (0 + i801_smba)
#define SMBHSTCNT (2 + i801_smba)
#define SMBHSTCMD (3 + i801_smba)
#define SMBHSTADD (4 + i801_smba)
#define SMBHSTDAT0 (5 + i801_smba)
#define SMBHSTDAT1 (6 + i801_smba)
#define SMBBLKDAT (7 + i801_smba)
#define SMBPEC (8 + i801_smba) /* ICH3 and later */
#define SMBAUXSTS (12 + i801_smba) /* ICH4 and later */
#define SMBAUXCTL (13 + i801_smba) /* ICH4 and later */
#define SMBSLVSTS (16 + i801_smba) /* ICH3 and later */
#define SMBSLVCMD (17 + i801_smba) /* ICH3 and later */
#define SMBNTFDADD (20 + i801_smba) /* ICH3 and later */
int main(int argc, char *argv[])
{
DetectI2CBusses();
DetectAuraControllers();
int i801_smba = ((i2c_smbus_i801*)busses[0])->i801_smba;
while(1)
{
while ((Inp32(SMBHSTSTS) & 0x02) != 0)
{
for (int i = 0; i < 5000; i++);
}
while ((Inp32(SMBHSTSTS) & 0x02) == 0)
{
for (int i = 0; i < 5000; i++);
}
{
unsigned char addr = Inp32(SMBHSTADD);
unsigned char size = Inp32(SMBHSTCNT);
unsigned char cmnd = Inp32(SMBHSTCMD);
unsigned char dat0 = Inp32(SMBHSTDAT0);
unsigned char dat1 = Inp32(SMBHSTDAT1);
if (addr & 1)
{
switch (size & 0x1C)
{
case I801_QUICK:
printf("Read %02x from address %02x \n",
dat0,
addr >> 1);
break;
case I801_BYTE_DATA:
printf("Read %02x from %02x, address %02x \n",
dat0,
cmnd,
addr >> 1);
break;
case I801_WORD_DATA:
printf("Read %02x %02x from %02x, address %02x \n",
dat0,
dat1,
cmnd,
addr >> 1);
break;
case I801_BLOCK_DATA:
printf("Read block of length %02x from %02x, address %02x, contents: ",
dat0,
cmnd,
addr >> 1);
// Read SMBHSTCNT to reset SMBBLKDAT read pointer
Inp32(SMBHSTCNT);
for (int byte = 0; byte < dat0; byte++)
{
printf("%02x ", Inp32(SMBBLKDAT));
}
printf("\n");
break;
}
}
else
{
switch (size & 0x1C)
{
case I801_QUICK:
printf("Wrote %02x to address %02x \n",
dat0,
addr >> 1);
break;
case I801_BYTE_DATA:
printf("Wrote %02x to %02x, address %02x \n",
dat0,
cmnd,
addr >> 1);
break;
case I801_WORD_DATA:
printf("Wrote %02x %02x to %02x, address %02x \n",
dat0,
dat1,
cmnd,
addr >> 1);
break;
case I801_BLOCK_DATA:
printf("Wrote block of length %02x to %02x, address %02x, contents: ",
dat0,
cmnd,
addr >> 1);
// Read SMBHSTCNT to reset SMBBLKDAT read pointer
Inp32(SMBHSTCNT);
for (int byte = 0; byte < dat0; byte++)
{
printf("%02x ", Inp32(SMBBLKDAT));
}
printf("\n");
break;
}
}
}
}
#if WIN32
OpenAuraSDKDialog dlg(busses, controllers);
dlg.DoModal();
//OpenAuraSDKDialog dlg(busses, controllers);
//dlg.DoModal();
return 0;