Fix illegal PIIX4 SMBus modes

This commit is contained in:
RichardG867
2021-01-12 20:13:15 -03:00
parent 625c02e4e5
commit aba9e0dac9
2 changed files with 4 additions and 4 deletions

View File

@@ -127,7 +127,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv)
smbus_addr = (dev->addr >> 1); smbus_addr = (dev->addr >> 1);
read = dev->addr & 0x01; read = dev->addr & 0x01;
cmd = (val >> 2) & 0xf; cmd = (dev->ctl >> 2) & 0xf;
smbus_piix4_log("SMBus PIIX4: addr=%02X read=%d protocol=%X cmd=%02X data0=%02X data1=%02X\n", smbus_addr, read, cmd, dev->cmd, dev->data0, dev->data1); smbus_piix4_log("SMBus PIIX4: addr=%02X read=%d protocol=%X cmd=%02X data0=%02X data1=%02X\n", smbus_addr, read, cmd, dev->cmd, dev->data0, dev->data1);
/* Raise DEV_ERR if no device is at this address, or if the device returned NAK when starting the transfer. */ /* Raise DEV_ERR if no device is at this address, or if the device returned NAK when starting the transfer. */
@@ -264,7 +264,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv)
/* block write [data0] bytes */ /* block write [data0] bytes */
for (i = 0; i < dev->data0; i++) { for (i = 0; i < dev->data0; i++) {
if (!i2c_write(i2c_smbus, smbus_addr, dev->data[i & SMBUS_PIIX4_BLOCK_DATA_MASK])) if (!i2c_write(i2c_smbus, smbus_addr, dev->data[i & SMBUS_PIIX4_BLOCK_DATA_MASK]))
break; break; /* write NAK behavior is unknown */
} }
timer_bytes += i; timer_bytes += i;

View File

@@ -316,10 +316,10 @@ poll_thread(void *arg)
struct in_addr dhcp = { .s_addr = htonl(0x0a00020f) }; /* 10.0.2.15 */ struct in_addr dhcp = { .s_addr = htonl(0x0a00020f) }; /* 10.0.2.15 */
struct in_addr dns = { .s_addr = htonl(0x0a000203) }; /* 10.0.2.3 */ struct in_addr dns = { .s_addr = htonl(0x0a000203) }; /* 10.0.2.3 */
struct in_addr bind = { .s_addr = htonl(0x00000000) }; /* 0.0.0.0 */ struct in_addr bind = { .s_addr = htonl(0x00000000) }; /* 0.0.0.0 */
struct in6_addr ipv6dummy; /* contents don't matter; we're not using IPv6 */ struct in6_addr ipv6_dummy; /* contents don't matter; we're not using IPv6 */
/* Initialize SLiRP. */ /* Initialize SLiRP. */
slirp->slirp = slirp_init(0, 1, net, mask, host, 0, ipv6dummy, 0, ipv6dummy, NULL, NULL, NULL, NULL, dhcp, dns, ipv6dummy, NULL, NULL, &slirp_cb, arg); slirp->slirp = slirp_init(0, 1, net, mask, host, 0, ipv6_dummy, 0, ipv6_dummy, NULL, NULL, NULL, NULL, dhcp, dns, ipv6_dummy, NULL, NULL, &slirp_cb, arg);
if (!slirp->slirp) { if (!slirp->slirp) {
slirp_log("SLiRP: initialization failed\n"); slirp_log("SLiRP: initialization failed\n");
return; return;