Message ID | 1593008176-9629-3-git-send-email-sai.pavan.boddu@xilinx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Make hcd-xhci independent of pci hooks | expand |
Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> writes: > Move pci specific devices to new file. This set the environment to move all > pci specific hooks in hcd-xhci.c to hcd-xhci-pci.c. > > Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> > --- > hw/usb/hcd-xhci-pci.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ > hw/usb/hcd-xhci.c | 32 ++------------------------ > hw/usb/hcd-xhci.h | 2 ++ > 3 files changed, 68 insertions(+), 30 deletions(-) > create mode 100644 hw/usb/hcd-xhci-pci.c > > diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c > new file mode 100644 > index 0000000..26af683 > --- /dev/null > +++ b/hw/usb/hcd-xhci-pci.c > @@ -0,0 +1,64 @@ > +/* > + * USB xHCI controller with PCI system bus emulation Scratch "system". > + * > + * Copyright (c) 2011 Securiforest > + * Date: 2011-05-11 ; Author: Hector Martin <hector@marcansoft.com> Let's use the opportunity to drop the "Date: " part, because we don't have it anywhere else. > + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 > + * Date: 2020-03-01; Author: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> And no new "Date: " parts, please. > + * Moved the pci specific content for hcd-xhci.c to hcd-xhci-pci.c > + * > + * This library is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2 of the License, or (at your option) any later version. > + * > + * This library is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this library; if not, see <http://www.gnu.org/licenses/>. > + */ [...]
On 6/25/20 10:06 AM, Markus Armbruster wrote: > Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> writes: > >> Move pci specific devices to new file. This set the environment to move all >> pci specific hooks in hcd-xhci.c to hcd-xhci-pci.c. >> >> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> >> --- >> hw/usb/hcd-xhci-pci.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ >> hw/usb/hcd-xhci.c | 32 ++------------------------ >> hw/usb/hcd-xhci.h | 2 ++ >> 3 files changed, 68 insertions(+), 30 deletions(-) >> create mode 100644 hw/usb/hcd-xhci-pci.c >> >> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c >> new file mode 100644 >> index 0000000..26af683 >> --- /dev/null >> +++ b/hw/usb/hcd-xhci-pci.c >> @@ -0,0 +1,64 @@ >> +/* >> + * USB xHCI controller with PCI system bus emulation > > Scratch "system". > >> + * >> + * Copyright (c) 2011 Securiforest >> + * Date: 2011-05-11 ; Author: Hector Martin <hector@marcansoft.com> > > Let's use the opportunity to drop the "Date: " part, because we don't > have it anywhere else. Good opportunity to suggest the SPDX tags again :P /* * SPDX-FileCopyrightText: 2011 Securiforest * SPDX-FileContributor: Hector Martin <hector@marcansoft.com> * SPDX-FileCopyrightText: 2020 Xilinx Inc. * SPDX-FileContributor: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> * SPDX-License-Identifier: GPL-2.0-or-later */ https://spdx.org/rdf/ontology/spdx-2-0-rc/dataproperties/fileContributor___-1635717172.html > >> + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 >> + * Date: 2020-03-01; Author: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> > > And no new "Date: " parts, please. > >> + * Moved the pci specific content for hcd-xhci.c to hcd-xhci-pci.c >> + * >> + * This library is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2 of the License, or (at your option) any later version. >> + * >> + * This library is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with this library; if not, see <http://www.gnu.org/licenses/>. >> + */ > [...] >
HI Philippe, > -----Original Message----- > From: Philippe Mathieu-Daudé <philmd@redhat.com> > Sent: Thursday, June 25, 2020 1:48 PM > To: Markus Armbruster <armbru@redhat.com>; Sai Pavan Boddu > <saipava@xilinx.com>; Thomas Huth <thuth@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com>; Peter Maydell > <peter.maydell@linaro.org>; Eduardo Habkost <ehabkost@redhat.com>; > qemu-devel@nongnu.org; Alistair Francis <alistair.francis@wdc.com>; > 'Marc-André Lureau' <marcandre.lureau@redhat.com>; Ying Fang > <fangying1@huawei.com>; Paolo Bonzini <pbonzini@redhat.com> > Subject: Re: [PATCH v2 2/3] usb/hcd-xhci: Move qemu-xhci device to hcd- > xhci-pci.c > > On 6/25/20 10:06 AM, Markus Armbruster wrote: > > Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> writes: > > > >> Move pci specific devices to new file. This set the environment to > >> move all pci specific hooks in hcd-xhci.c to hcd-xhci-pci.c. > >> > >> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> > >> --- > >> hw/usb/hcd-xhci-pci.c | 64 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > >> hw/usb/hcd-xhci.c | 32 ++------------------------ > >> hw/usb/hcd-xhci.h | 2 ++ > >> 3 files changed, 68 insertions(+), 30 deletions(-) create mode > >> 100644 hw/usb/hcd-xhci-pci.c > >> > >> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c new file > >> mode 100644 index 0000000..26af683 > >> --- /dev/null > >> +++ b/hw/usb/hcd-xhci-pci.c > >> @@ -0,0 +1,64 @@ > >> +/* > >> + * USB xHCI controller with PCI system bus emulation > > > > Scratch "system". > > > >> + * > >> + * Copyright (c) 2011 Securiforest > >> + * Date: 2011-05-11 ; Author: Hector Martin <hector@marcansoft.com> > > > > Let's use the opportunity to drop the "Date: " part, because we don't > > have it anywhere else. > > Good opportunity to suggest the SPDX tags again :P > > /* > * SPDX-FileCopyrightText: 2011 Securiforest > * SPDX-FileContributor: Hector Martin <hector@marcansoft.com> > * SPDX-FileCopyrightText: 2020 Xilinx Inc. > * SPDX-FileContributor: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> > * SPDX-License-Identifier: GPL-2.0-or-later */ [Sai Pavan Boddu] I would include this in V4, Forgot them in V3. Thanks, Sai Pavan > > https://spdx.org/rdf/ontology/spdx-2-0- > rc/dataproperties/fileContributor___-1635717172.html > > > > >> + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 > >> + * Date: 2020-03-01; Author: Sai Pavan Boddu > >> + <sai.pavan.boddu@xilinx.com> > > > > And no new "Date: " parts, please. > > > >> + * Moved the pci specific content for hcd-xhci.c to hcd-xhci-pci.c > >> + * > >> + * This library is free software; you can redistribute it and/or > >> + * modify it under the terms of the GNU Lesser General Public > >> + * License as published by the Free Software Foundation; either > >> + * version 2 of the License, or (at your option) any later version. > >> + * > >> + * This library is distributed in the hope that it will be useful, > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > GNU > >> + * Lesser General Public License for more details. > >> + * > >> + * You should have received a copy of the GNU Lesser General Public > >> + * License along with this library; if not, see > <http://www.gnu.org/licenses/>. > >> + */ > > [...] > >
On 20/07/2020 10.00, Sai Pavan Boddu wrote: > HI Philippe, > >> -----Original Message----- >> From: Philippe Mathieu-Daudé <philmd@redhat.com> >> Sent: Thursday, June 25, 2020 1:48 PM >> To: Markus Armbruster <armbru@redhat.com>; Sai Pavan Boddu >> <saipava@xilinx.com>; Thomas Huth <thuth@redhat.com> >> Cc: Gerd Hoffmann <kraxel@redhat.com>; Peter Maydell >> <peter.maydell@linaro.org>; Eduardo Habkost <ehabkost@redhat.com>; >> qemu-devel@nongnu.org; Alistair Francis <alistair.francis@wdc.com>; >> 'Marc-André Lureau' <marcandre.lureau@redhat.com>; Ying Fang >> <fangying1@huawei.com>; Paolo Bonzini <pbonzini@redhat.com> >> Subject: Re: [PATCH v2 2/3] usb/hcd-xhci: Move qemu-xhci device to hcd- >> xhci-pci.c >> >> On 6/25/20 10:06 AM, Markus Armbruster wrote: >>> Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> writes: >>> >>>> Move pci specific devices to new file. This set the environment to >>>> move all pci specific hooks in hcd-xhci.c to hcd-xhci-pci.c. >>>> >>>> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> >>>> --- >>>> hw/usb/hcd-xhci-pci.c | 64 >> +++++++++++++++++++++++++++++++++++++++++++++++++++ >>>> hw/usb/hcd-xhci.c | 32 ++------------------------ >>>> hw/usb/hcd-xhci.h | 2 ++ >>>> 3 files changed, 68 insertions(+), 30 deletions(-) create mode >>>> 100644 hw/usb/hcd-xhci-pci.c >>>> >>>> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c new file >>>> mode 100644 index 0000000..26af683 >>>> --- /dev/null >>>> +++ b/hw/usb/hcd-xhci-pci.c >>>> @@ -0,0 +1,64 @@ >>>> +/* >>>> + * USB xHCI controller with PCI system bus emulation >>> >>> Scratch "system". >>> >>>> + * >>>> + * Copyright (c) 2011 Securiforest >>>> + * Date: 2011-05-11 ; Author: Hector Martin <hector@marcansoft.com> >>> >>> Let's use the opportunity to drop the "Date: " part, because we don't >>> have it anywhere else. >> >> Good opportunity to suggest the SPDX tags again :P >> >> /* >> * SPDX-FileCopyrightText: 2011 Securiforest >> * SPDX-FileContributor: Hector Martin <hector@marcansoft.com> >> * SPDX-FileCopyrightText: 2020 Xilinx Inc. >> * SPDX-FileContributor: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> >> * SPDX-License-Identifier: GPL-2.0-or-later */ > [Sai Pavan Boddu] I would include this in V4, Forgot them in V3. > > Thanks, > Sai Pavan >> >> https://spdx.org/rdf/ontology/spdx-2-0- >> rc/dataproperties/fileContributor___-1635717172.html >> >>> >>>> + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 >>>> + * Date: 2020-03-01; Author: Sai Pavan Boddu >>>> + <sai.pavan.boddu@xilinx.com> >>> >>> And no new "Date: " parts, please. >>> >>>> + * Moved the pci specific content for hcd-xhci.c to hcd-xhci-pci.c >>>> + * >>>> + * This library is free software; you can redistribute it and/or >>>> + * modify it under the terms of the GNU Lesser General Public >>>> + * License as published by the Free Software Foundation; either >>>> + * version 2 of the License, or (at your option) any later version. And while you're at it: There was never a "version 2" of the Lesser GPL. In version 2.0, it was still called "Library" GPL. So it is quite likely that version 2.1 is meant here instead. Thomas
Hi Thomas, > -----Original Message----- > From: Thomas Huth <thuth@redhat.com> > Sent: Monday, July 20, 2020 1:37 PM > To: Sai Pavan Boddu <saipava@xilinx.com>; Philippe Mathieu-Daudé > <philmd@redhat.com>; Markus Armbruster <armbru@redhat.com> > Cc: Gerd Hoffmann <kraxel@redhat.com>; Peter Maydell > <peter.maydell@linaro.org>; Eduardo Habkost <ehabkost@redhat.com>; > qemu-devel@nongnu.org; Alistair Francis <alistair.francis@wdc.com>; > 'Marc-André Lureau' <marcandre.lureau@redhat.com>; Ying Fang > <fangying1@huawei.com>; Paolo Bonzini <pbonzini@redhat.com> > Subject: Re: [PATCH v2 2/3] usb/hcd-xhci: Move qemu-xhci device to hcd- > xhci-pci.c > > On 20/07/2020 10.00, Sai Pavan Boddu wrote: > > HI Philippe, > > > >> -----Original Message----- > >> From: Philippe Mathieu-Daudé <philmd@redhat.com> > >> Sent: Thursday, June 25, 2020 1:48 PM > >> To: Markus Armbruster <armbru@redhat.com>; Sai Pavan Boddu > >> <saipava@xilinx.com>; Thomas Huth <thuth@redhat.com> > >> Cc: Gerd Hoffmann <kraxel@redhat.com>; Peter Maydell > >> <peter.maydell@linaro.org>; Eduardo Habkost <ehabkost@redhat.com>; > >> qemu-devel@nongnu.org; Alistair Francis <alistair.francis@wdc.com>; > >> 'Marc-André Lureau' <marcandre.lureau@redhat.com>; Ying Fang > >> <fangying1@huawei.com>; Paolo Bonzini <pbonzini@redhat.com> > >> Subject: Re: [PATCH v2 2/3] usb/hcd-xhci: Move qemu-xhci device to > >> hcd- xhci-pci.c > >> > >> On 6/25/20 10:06 AM, Markus Armbruster wrote: > >>> Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> writes: > >>> > >>>> Move pci specific devices to new file. This set the environment to > >>>> move all pci specific hooks in hcd-xhci.c to hcd-xhci-pci.c. > >>>> > >>>> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> > >>>> --- > >>>> hw/usb/hcd-xhci-pci.c | 64 > >> +++++++++++++++++++++++++++++++++++++++++++++++++++ > >>>> hw/usb/hcd-xhci.c | 32 ++------------------------ > >>>> hw/usb/hcd-xhci.h | 2 ++ > >>>> 3 files changed, 68 insertions(+), 30 deletions(-) create mode > >>>> 100644 hw/usb/hcd-xhci-pci.c > >>>> > >>>> diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c new file > >>>> mode 100644 index 0000000..26af683 > >>>> --- /dev/null > >>>> +++ b/hw/usb/hcd-xhci-pci.c > >>>> @@ -0,0 +1,64 @@ > >>>> +/* > >>>> + * USB xHCI controller with PCI system bus emulation > >>> > >>> Scratch "system". > >>> > >>>> + * > >>>> + * Copyright (c) 2011 Securiforest > >>>> + * Date: 2011-05-11 ; Author: Hector Martin > >>>> + <hector@marcansoft.com> > >>> > >>> Let's use the opportunity to drop the "Date: " part, because we > >>> don't have it anywhere else. > >> > >> Good opportunity to suggest the SPDX tags again :P > >> > >> /* > >> * SPDX-FileCopyrightText: 2011 Securiforest > >> * SPDX-FileContributor: Hector Martin <hector@marcansoft.com> > >> * SPDX-FileCopyrightText: 2020 Xilinx Inc. > >> * SPDX-FileContributor: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> > >> * SPDX-License-Identifier: GPL-2.0-or-later */ > > [Sai Pavan Boddu] I would include this in V4, Forgot them in V3. > > > > Thanks, > > Sai Pavan > >> > >> https://spdx.org/rdf/ontology/spdx-2-0- > >> rc/dataproperties/fileContributor___-1635717172.html > >> > >>> > >>>> + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 > >>>> + * Date: 2020-03-01; Author: Sai Pavan Boddu > >>>> + <sai.pavan.boddu@xilinx.com> > >>> > >>> And no new "Date: " parts, please. > >>> > >>>> + * Moved the pci specific content for hcd-xhci.c to hcd-xhci-pci.c > >>>> + * > >>>> + * This library is free software; you can redistribute it and/or > >>>> + * modify it under the terms of the GNU Lesser General Public > >>>> + * License as published by the Free Software Foundation; either > >>>> + * version 2 of the License, or (at your option) any later version. > > And while you're at it: There was never a "version 2" of the Lesser GPL. > In version 2.0, it was still called "Library" GPL. So it is quite likely that version > 2.1 is meant here instead. [Sai Pavan Boddu] I have less knowledge here. But indeed I don’t find LGPL 2.0 https://www.gnu.org/licenses/licenses.html#LicenseURLs BTW, I still see our repository use combination of GPL and LGPL. Is there any general rule to follow at high level. Regards, Sai Pavan > > Thomas
Hi, On 22/07/2020 09.49, Sai Pavan Boddu wrote: [...] >>>>>> + * This library is free software; you can redistribute it and/or >>>>>> + * modify it under the terms of the GNU Lesser General Public >>>>>> + * License as published by the Free Software Foundation; either >>>>>> + * version 2 of the License, or (at your option) any later version. >> >> And while you're at it: There was never a "version 2" of the Lesser GPL. >> In version 2.0, it was still called "Library" GPL. So it is quite likely that version >> 2.1 is meant here instead. > [Sai Pavan Boddu] I have less knowledge here. But indeed I don’t find LGPL 2.0 https://www.gnu.org/licenses/licenses.html#LicenseURLs You can find version 2.0 here, for example: https://www.gnu.org/licenses/old-licenses/old-licenses.html#LGPL ... but as I said, v2.0 is called "Library" GPL instead of "Lesser" GPL. > BTW, I still see our repository use combination of GPL and LGPL. Is there any general rule to follow at high level. As long as the license is a standard license that is compatible with the GPLv2 or any later version, you should be fine. See the LICENSE file in the top directory of the sources for details. As a general rule, I'd say either use "GPLv2 or later" (see the file COPYING in the main directory) or "LGPLv2.1 or later" (see COPYING.LIB in the main directory) for new code, unless you contribute to the tcg/ folder where MIT or BSD is preferred instead. Thomas
Thomas Huth <thuth@redhat.com> writes: > Hi, > > On 22/07/2020 09.49, Sai Pavan Boddu wrote: > [...] >>>>>>> + * This library is free software; you can redistribute it and/or >>>>>>> + * modify it under the terms of the GNU Lesser General Public >>>>>>> + * License as published by the Free Software Foundation; either >>>>>>> + * version 2 of the License, or (at your option) any later version. >>> >>> And while you're at it: There was never a "version 2" of the Lesser GPL. >>> In version 2.0, it was still called "Library" GPL. So it is quite likely that version >>> 2.1 is meant here instead. >> [Sai Pavan Boddu] I have less knowledge here. But indeed I don’t find LGPL 2.0 https://www.gnu.org/licenses/licenses.html#LicenseURLs > > You can find version 2.0 here, for example: > > https://www.gnu.org/licenses/old-licenses/old-licenses.html#LGPL > > ... but as I said, v2.0 is called "Library" GPL instead of "Lesser" GPL. > >> BTW, I still see our repository use combination of GPL and LGPL. Is there any general rule to follow at high level. > > As long as the license is a standard license that is compatible with the > GPLv2 or any later version, you should be fine. See the LICENSE file in > the top directory of the sources for details. > > As a general rule, I'd say either use "GPLv2 or later" (see the file > COPYING in the main directory) or "LGPLv2.1 or later" (see COPYING.LIB > in the main directory) for new code, unless you contribute to the tcg/ > folder where MIT or BSD is preferred instead. Please use "GPLv2 or later". If you believe you have a compelling reason for using a different license (compatible with GPLv2, of course), then explain yourself in the commit message.
diff --git a/hw/usb/hcd-xhci-pci.c b/hw/usb/hcd-xhci-pci.c new file mode 100644 index 0000000..26af683 --- /dev/null +++ b/hw/usb/hcd-xhci-pci.c @@ -0,0 +1,64 @@ +/* + * USB xHCI controller with PCI system bus emulation + * + * Copyright (c) 2011 Securiforest + * Date: 2011-05-11 ; Author: Hector Martin <hector@marcansoft.com> + * Based on usb-ohci.c, emulates Renesas NEC USB 3.0 + * Date: 2020-03-01; Author: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> + * Moved the pci specific content for hcd-xhci.c to hcd-xhci-pci.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ +#include "qemu/osdep.h" +#include "hw/pci/pci.h" +#include "hw/qdev-properties.h" +#include "hw/pci/msi.h" +#include "hw/pci/msix.h" +#include "hcd-xhci.h" +#include "trace.h" +#include "qapi/error.h" + +static void qemu_xhci_class_init(ObjectClass *klass, void *data) +{ + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->vendor_id = PCI_VENDOR_ID_REDHAT; + k->device_id = PCI_DEVICE_ID_REDHAT_XHCI; + k->revision = 0x01; +} + +static void qemu_xhci_instance_init(Object *obj) +{ + XHCIState *xhci = XHCI(obj); + + xhci->msi = ON_OFF_AUTO_OFF; + xhci->msix = ON_OFF_AUTO_AUTO; + xhci->numintrs = MAXINTRS; + xhci->numslots = MAXSLOTS; + xhci_set_flag(xhci, XHCI_FLAG_SS_FIRST); +} + +static const TypeInfo qemu_xhci_info = { + .name = TYPE_QEMU_XHCI, + .parent = TYPE_XHCI, + .class_init = qemu_xhci_class_init, + .instance_init = qemu_xhci_instance_init, +}; + +static void xhci_register_types(void) +{ + type_register_static(&qemu_xhci_info); +} + +type_init(xhci_register_types) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index fa6ce98..d340518 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -429,12 +429,12 @@ static const char *ep_state_name(uint32_t state) ARRAY_SIZE(ep_state_names)); } -static bool xhci_get_flag(XHCIState *xhci, enum xhci_flags bit) +bool xhci_get_flag(XHCIState *xhci, enum xhci_flags bit) { return xhci->flags & (1 << bit); } -static void xhci_set_flag(XHCIState *xhci, enum xhci_flags bit) +void xhci_set_flag(XHCIState *xhci, enum xhci_flags bit) { xhci->flags |= (1 << bit); } @@ -3727,37 +3727,9 @@ static const TypeInfo xhci_info = { }, }; -static void qemu_xhci_class_init(ObjectClass *klass, void *data) -{ - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->vendor_id = PCI_VENDOR_ID_REDHAT; - k->device_id = PCI_DEVICE_ID_REDHAT_XHCI; - k->revision = 0x01; -} - -static void qemu_xhci_instance_init(Object *obj) -{ - XHCIState *xhci = XHCI(obj); - - xhci->msi = ON_OFF_AUTO_OFF; - xhci->msix = ON_OFF_AUTO_AUTO; - xhci->numintrs = MAXINTRS; - xhci->numslots = MAXSLOTS; - xhci_set_flag(xhci, XHCI_FLAG_SS_FIRST); -} - -static const TypeInfo qemu_xhci_info = { - .name = TYPE_QEMU_XHCI, - .parent = TYPE_XHCI, - .class_init = qemu_xhci_class_init, - .instance_init = qemu_xhci_instance_init, -}; - static void xhci_register_types(void) { type_register_static(&xhci_info); - type_register_static(&qemu_xhci_info); } type_init(xhci_register_types) diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h index 18bed7e..ca03481 100644 --- a/hw/usb/hcd-xhci.h +++ b/hw/usb/hcd-xhci.h @@ -232,4 +232,6 @@ struct XHCIState { bool nec_quirks; }; +bool xhci_get_flag(XHCIState *xhci, enum xhci_flags bit); +void xhci_set_flag(XHCIState *xhci, enum xhci_flags bit); #endif
Move pci specific devices to new file. This set the environment to move all pci specific hooks in hcd-xhci.c to hcd-xhci-pci.c. Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> --- hw/usb/hcd-xhci-pci.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-xhci.c | 32 ++------------------------ hw/usb/hcd-xhci.h | 2 ++ 3 files changed, 68 insertions(+), 30 deletions(-) create mode 100644 hw/usb/hcd-xhci-pci.c