Added USB device method 'find_device' required for EHCI. No functional changes yet.

This commit is contained in:
Volker Ruppert 2016-08-20 14:20:07 +00:00
parent f303bd4912
commit 5458e66f85
5 changed files with 39 additions and 5 deletions

View File

@ -6,7 +6,7 @@
//
// Copyright (c) 2005 Fabrice Bellard
// Copyright (C) 2009-2015 Benjamin D Lunt (fys at fysnet net)
// 2009-2015 The Bochs Project
// 2009-2016 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -445,4 +445,13 @@ void usb_device_c::set_debug_mode()
setonoff(LOGLEV_DEBUG, ACT_REPORT);
}
usb_device_c* usb_device_c::find_device(Bit8u addr)
{
if (addr == d.addr) {
return this;
} else {
return NULL;
}
}
#endif // BX_SUPPORT_PCI && BX_SUPPORT_PCIUSB

View File

@ -6,7 +6,7 @@
//
// Copyright (c) 2005 Fabrice Bellard
// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net)
// 2009-2014 The Bochs Project
// 2009-2016 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -163,6 +163,7 @@ public:
virtual bx_bool init() {return 1;}
virtual const char* get_info() {return NULL;}
virtual usb_device_c* find_device(Bit8u addr);
virtual int handle_packet(USBPacket *p);
virtual void handle_reset() {}

View File

@ -1122,7 +1122,9 @@ usb_device_c *bx_usb_ehci_c::find_device(Bit8u addr)
BX_DEBUG(("Port %d not enabled", i));
continue;
}
// TODO: dev = usb_find_device(i, addr);
if (BX_EHCI_THIS hub.usb_port[i].device != NULL) {
dev = BX_EHCI_THIS hub.usb_port[i].device->find_device(addr);
}
if (dev != NULL) {
return dev;
}

View File

@ -5,7 +5,7 @@
// USB hub emulation support (ported from QEMU)
//
// Copyright (C) 2005 Fabrice Bellard
// Copyright (C) 2009-2015 The Bochs Project
// Copyright (C) 2009-2016 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -706,4 +706,25 @@ void usb_hub_device_c::restore_handler(bx_list_c *conf)
init_device(i, (bx_list_c*)SIM->get_param(pname, hub.config));
}
usb_device_c* usb_hub_device_c::find_device(Bit8u addr)
{
int i;
usb_device_c *dev, *dev2;
if (addr == d.addr) {
return this;
} else {
for (i = 0; i < hub.n_ports; i++) {
dev = hub.usb_port[i].device;
if ((dev != NULL) && (hub.usb_port[i].PortStatus & PORT_STAT_ENABLE)) {
dev2 = dev->find_device(addr);
if (dev2 != NULL) {
return dev2;
}
}
}
return NULL;
}
}
#endif // BX_SUPPORT_PCI && BX_SUPPORT_PCIUSB

View File

@ -5,7 +5,7 @@
// USB hub emulation support (ported from QEMU)
//
// Copyright (C) 2005 Fabrice Bellard
// Copyright (C) 2009-2015 The Bochs Project
// Copyright (C) 2009-2016 The Bochs Project
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -37,6 +37,7 @@ public:
usb_hub_device_c(Bit8u ports);
virtual ~usb_hub_device_c(void);
virtual usb_device_c* find_device(Bit8u addr);
virtual int handle_packet(USBPacket *p);
virtual void handle_reset();
virtual int handle_control(int request, int value, int index, int length, Bit8u *data);