Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 #include <linux/pci.h>
0003 #include <linux/usb.h>
0004 #include <linux/usb/ehci_def.h>
0005 #include <linux/usb/hcd.h>
0006 #include <asm/xen/hypercall.h>
0007 #include <xen/interface/physdev.h>
0008 #include <xen/xen.h>
0009 
0010 static int xen_dbgp_op(struct usb_hcd *hcd, int op)
0011 {
0012 #ifdef CONFIG_PCI
0013     const struct device *ctrlr = hcd_to_bus(hcd)->controller;
0014 #endif
0015     struct physdev_dbgp_op dbgp;
0016 
0017     if (!xen_initial_domain())
0018         return 0;
0019 
0020     dbgp.op = op;
0021 
0022 #ifdef CONFIG_PCI
0023     if (dev_is_pci(ctrlr)) {
0024         const struct pci_dev *pdev = to_pci_dev(ctrlr);
0025 
0026         dbgp.u.pci.seg = pci_domain_nr(pdev->bus);
0027         dbgp.u.pci.bus = pdev->bus->number;
0028         dbgp.u.pci.devfn = pdev->devfn;
0029         dbgp.bus = PHYSDEVOP_DBGP_BUS_PCI;
0030     } else
0031 #endif
0032         dbgp.bus = PHYSDEVOP_DBGP_BUS_UNKNOWN;
0033 
0034     return HYPERVISOR_physdev_op(PHYSDEVOP_dbgp_op, &dbgp);
0035 }
0036 
0037 int xen_dbgp_reset_prep(struct usb_hcd *hcd)
0038 {
0039     return xen_dbgp_op(hcd, PHYSDEVOP_DBGP_RESET_PREPARE);
0040 }
0041 
0042 int xen_dbgp_external_startup(struct usb_hcd *hcd)
0043 {
0044     return xen_dbgp_op(hcd, PHYSDEVOP_DBGP_RESET_DONE);
0045 }
0046 
0047 #ifndef CONFIG_EARLY_PRINTK_DBGP
0048 #include <linux/export.h>
0049 EXPORT_SYMBOL_GPL(xen_dbgp_reset_prep);
0050 EXPORT_SYMBOL_GPL(xen_dbgp_external_startup);
0051 #endif