Skip to content

Instantly share code, notes, and snippets.

@Th3Fanbus
Created August 2, 2020 11:35
Show Gist options
  • Save Th3Fanbus/e01265a1f1c5b75360edb6c92b5ceeaa to your computer and use it in GitHub Desktop.
Save Th3Fanbus/e01265a1f1c5b75360edb6c92b5ceeaa to your computer and use it in GitHub Desktop.
int smbus_stub(int slv_addr, int reg, int length, unsigned char *b)
{
struct mrc_params *p = wrapper_params;
unsigned char *spd_data;
switch (slv_addr) {
case FAKE_SPD_ADDR_CH0:
spd_data = p->mainboard.dram_data[0];
break;
case FAKE_SPD_ADDR_CH1:
spd_data = p->mainboard.dram_data[1];
break;
default:
/* No faking SMBus transaction. */
return 0;
}
if (spd_data == NULL)
return -1;
/* Copy the data out of memory. */
memcpy(b, &spd_data[reg], length);
return length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment