- fixed behaviour of "enable changed" port status bit

- improved error message
- TODO: fix UHCI with Windows XP guest (device not recognized)
This commit is contained in:
Volker Ruppert 2011-12-30 17:29:43 +00:00
parent 2a0d989755
commit 5f0ec6c805

View File

@ -469,10 +469,12 @@ void bx_usb_uhci_c::write(Bit32u address, Bit32u value, unsigned io_len)
if (BX_UHCI_THIS hub.usb_port[i].device != NULL) {
DEV_usb_send_msg(BX_UHCI_THIS hub.usb_port[i].device, USB_MSG_RESET);
}
BX_UHCI_THIS hub.usb_port[i].connect_changed = 1;
if (BX_UHCI_THIS hub.usb_port[i].enabled) {
BX_UHCI_THIS hub.usb_port[i].able_changed = 1;
BX_UHCI_THIS hub.usb_port[i].enabled = 0;
}
}
BX_UHCI_THIS hub.usb_port[i].connect_changed = 1;
BX_UHCI_THIS hub.usb_port[i].enabled = 0;
BX_UHCI_THIS hub.usb_port[i].able_changed = 1;
}
}
@ -591,9 +593,9 @@ void bx_usb_uhci_c::write(Bit32u address, Bit32u value, unsigned io_len)
if (!BX_UHCI_THIS hub.usb_port[port].enabled && (value & (1<<2)))
BX_UHCI_THIS hub.usb_port[port].able_changed = 0;
else
BX_UHCI_THIS hub.usb_port[port].able_changed = (value & (1<<3)) ? 0 : BX_UHCI_THIS hub.usb_port[port].able_changed;
if ((value & (1<<3)) != 0) BX_UHCI_THIS hub.usb_port[port].able_changed = 0;
BX_UHCI_THIS hub.usb_port[port].enabled = (value & (1<<2)) ? 1 : 0;
BX_UHCI_THIS hub.usb_port[port].connect_changed = (value & (1<<1)) ? 0 : BX_UHCI_THIS hub.usb_port[port].connect_changed;
if ((value & (1<<1)) != 0) BX_UHCI_THIS hub.usb_port[port].connect_changed = 0;
// if port reset, reset function(s)
//TODO: only reset items on the downstream...
@ -825,12 +827,12 @@ bx_bool bx_usb_uhci_c::DoTransfer(Bit32u address, Bit32u queue_num, struct TD *t
// check TD to make sure it is valid
// A max length 0x500 to 0x77E is illegal
if (((td->dword2 >> 21) >= 0x500) && ((td->dword2 >> 21) != 0x7FF)) {
BX_ERROR(("error at 11111111111"));
return 1; // error = consistency check failure
if ((maxlen >= 0x500) && (maxlen != 0x7FF)) {
BX_ERROR(("invalid max. length value 0x%04x", maxlen ));
return 0; // error = consistency check failure
}
//if (td->dword0 & 0x8) return 1; // error = reserved bits in dword0 set
// if (td->dword0 & 0x8) return 1; // error = reserved bit in dword0 set
// other error checks here
// the device should remain in a stall state until the next setup packet is recieved
@ -1043,7 +1045,6 @@ void bx_usb_uhci_c::usb_set_connect_status(Bit8u port, int type, bx_bool connect
}
BX_UHCI_THIS hub.usb_port[port].status = 1;
BX_UHCI_THIS hub.usb_port[port].connect_changed = 1;
BX_UHCI_THIS hub.usb_port[port].able_changed = 1;
// if in suspend state, signal resume
if (BX_UHCI_THIS hub.usb_command.suspend) {
@ -1066,8 +1067,10 @@ void bx_usb_uhci_c::usb_set_connect_status(Bit8u port, int type, bx_bool connect
} else {
BX_UHCI_THIS hub.usb_port[port].status = 0;
BX_UHCI_THIS hub.usb_port[port].connect_changed = 1;
BX_UHCI_THIS hub.usb_port[port].enabled = 0;
BX_UHCI_THIS hub.usb_port[port].able_changed = 1;
if (BX_UHCI_THIS hub.usb_port[port].enabled) {
BX_UHCI_THIS hub.usb_port[port].able_changed = 1;
BX_UHCI_THIS hub.usb_port[port].enabled = 0;
}
BX_UHCI_THIS hub.usb_port[port].low_speed = 0;
BX_UHCI_THIS hub.usb_port[port].line_dminus = 0;
BX_UHCI_THIS hub.usb_port[port].line_dplus = 0;