From 185ae809257e5bba9c040ad36e3f4a9d1999a60b Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Fri, 2 Dec 2016 17:30:16 +0000 Subject: [PATCH] Some USB code changes by Ben Lunt - USB xHCI NAK handling fix by Ben. Now openSUSE 13.2 boots without hang with hub connected to an xHCI port. - Updated Ben's email address and year in some copyright headers. --- bochs/iodev/usb/uhci_core.h | 2 +- bochs/iodev/usb/usb_common.h | 2 +- bochs/iodev/usb/usb_hid.cc | 4 ++-- bochs/iodev/usb/usb_hid.h | 4 ++-- bochs/iodev/usb/usb_ohci.cc | 2 +- bochs/iodev/usb/usb_ohci.h | 4 ++-- bochs/iodev/usb/usb_printer.cc | 2 +- bochs/iodev/usb/usb_printer.h | 4 ++-- bochs/iodev/usb/usb_uhci.h | 4 ++-- bochs/iodev/usb/usb_xhci.cc | 8 ++++++-- bochs/iodev/usb/usb_xhci.h | 2 +- 11 files changed, 21 insertions(+), 17 deletions(-) diff --git a/bochs/iodev/usb/uhci_core.h b/bochs/iodev/usb/uhci_core.h index 2fdfebe15..5eaf18f4b 100644 --- a/bochs/iodev/usb/uhci_core.h +++ b/bochs/iodev/usb/uhci_core.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // 2009-2016 The Bochs Project // // This library is free software; you can redistribute it and/or diff --git a/bochs/iodev/usb/usb_common.h b/bochs/iodev/usb/usb_common.h index fcf9f5f88..942c52de1 100644 --- a/bochs/iodev/usb/usb_common.h +++ b/bochs/iodev/usb/usb_common.h @@ -5,7 +5,7 @@ // Generic USB emulation code // // Copyright (c) 2005 Fabrice Bellard -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // 2009-2016 The Bochs Project // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/bochs/iodev/usb/usb_hid.cc b/bochs/iodev/usb/usb_hid.cc index ab6ae2db9..ce7964c05 100644 --- a/bochs/iodev/usb/usb_hid.cc +++ b/bochs/iodev/usb/usb_hid.cc @@ -3,7 +3,7 @@ ///////////////////////////////////////////////////////////////////////// // // USB HID emulation support (mouse and tablet) ported from QEMU -// USB keypad emulation based on code by Benjamin D Lunt (fys at frontiernet net) +// USB keypad emulation based on code by Benjamin D Lunt (fys [at] fysnet [dot] net) // // Copyright (c) 2005 Fabrice Bellard // Copyright (c) 2007 OpenMoko, Inc. (andrew@openedhand.com) @@ -29,7 +29,7 @@ ///////////////////////////////////////////////////////////////////////// // Portions of this file contain code released under the LGPL. // -// Copyright (C) 2004/2005 Benjamin D Lunt (fys at frontiernet net) +// Copyright (C) 2004-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/bochs/iodev/usb/usb_hid.h b/bochs/iodev/usb/usb_hid.h index ff7a034ca..a557d177f 100644 --- a/bochs/iodev/usb/usb_hid.h +++ b/bochs/iodev/usb/usb_hid.h @@ -3,11 +3,11 @@ ///////////////////////////////////////////////////////////////////////// // // USB HID emulation support (mouse and tablet) ported from QEMU -// USB keypad emulation based on code by Benjamin D Lunt (fys at frontiernet net) +// USB keypad emulation based on code by Benjamin D Lunt (fys [at] fysnet [dot] net) // // Copyright (c) 2005 Fabrice Bellard // Copyright (c) 2007 OpenMoko, Inc. (andrew@openedhand.com) -// Copyright (C) 2009-2012 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 diff --git a/bochs/iodev/usb/usb_ohci.cc b/bochs/iodev/usb/usb_ohci.cc index d1708a133..5dc608886 100644 --- a/bochs/iodev/usb/usb_ohci.cc +++ b/bochs/iodev/usb/usb_ohci.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // 2009-2016 The Bochs Project // // This library is free software; you can redistribute it and/or diff --git a/bochs/iodev/usb/usb_ohci.h b/bochs/iodev/usb/usb_ohci.h index 8bb902cbf..a765ab339 100644 --- a/bochs/iodev/usb/usb_ohci.h +++ b/bochs/iodev/usb/usb_ohci.h @@ -2,8 +2,8 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) -// 2009-2015 The Bochs Project +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) +// 2009-2016 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/bochs/iodev/usb/usb_printer.cc b/bochs/iodev/usb/usb_printer.cc index 551855da6..bf91f3bfa 100644 --- a/bochs/iodev/usb/usb_printer.cc +++ b/bochs/iodev/usb/usb_printer.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // 2009-2016 The Bochs Project // // This library is free software; you can redistribute it and/or diff --git a/bochs/iodev/usb/usb_printer.h b/bochs/iodev/usb/usb_printer.h index 8887d99f1..34aee86c8 100644 --- a/bochs/iodev/usb/usb_printer.h +++ b/bochs/iodev/usb/usb_printer.h @@ -2,8 +2,8 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) -// 2009-2012 The Bochs Project +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) +// 2009-2016 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/bochs/iodev/usb/usb_uhci.h b/bochs/iodev/usb/usb_uhci.h index 06bd10002..5603053e8 100644 --- a/bochs/iodev/usb/usb_uhci.h +++ b/bochs/iodev/usb/usb_uhci.h @@ -2,8 +2,8 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2009 Benjamin D Lunt (fys at frontiernet net) -// 2009-2015 The Bochs Project +// Copyright (C) 2009-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) +// 2009-2016 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/bochs/iodev/usb/usb_xhci.cc b/bochs/iodev/usb/usb_xhci.cc index ce359a1a6..147b49810 100644 --- a/bochs/iodev/usb/usb_xhci.cc +++ b/bochs/iodev/usb/usb_xhci.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2010-2014 Benjamin D Lunt (fys [at] fysnet [dot] net) +// Copyright (C) 2010-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // 2011-2016 The Bochs Project // // This library is free software; you can redistribute it and/or @@ -2097,6 +2097,11 @@ void bx_usb_xhci_c::process_transfer_ring(const int slot, const int ep) if (ret == USB_RET_ASYNC) { BX_ERROR(("Async packet handling not implemented yet")); } + usb_packet_cleanup(&packet); + + // if the device NAK'ed, we retire the TD and halt the ep + if (ret == USB_RET_NAK) + break; // 4.10.1 paragraph 4 // 4.10.1.1 @@ -2109,7 +2114,6 @@ void bx_usb_xhci_c::process_transfer_ring(const int slot, const int ep) write_event_TRB(int_target, org_addr, TRB_SET_COMP_CODE(comp_code) | bytes_not_transferred, TRB_SET_SLOT(slot) | TRB_SET_EP(ep) | TRB_SET_TYPE(TRANS_EVENT), 1); } - usb_packet_cleanup(&packet); } } diff --git a/bochs/iodev/usb/usb_xhci.h b/bochs/iodev/usb/usb_xhci.h index 0de52b847..80be41c24 100644 --- a/bochs/iodev/usb/usb_xhci.h +++ b/bochs/iodev/usb/usb_xhci.h @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2010-2014 Benjamin D Lunt (fys [at] fysnet [dot] net) +// Copyright (C) 2010-2016 Benjamin D Lunt (fys [at] fysnet [dot] net) // 2011-2016 The Bochs Project // // This library is free software; you can redistribute it and/or