1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * xHCI host controller sideband support 4 * 5 * Copyright (c) 2023, Intel Corporation. 6 * 7 * Author: Mathias Nyman <mathias.nyman@linux.intel.com> 8 */ 9 10 #ifndef __LINUX_XHCI_SIDEBAND_H 11 #define __LINUX_XHCI_SIDEBAND_H 12 13 #include <linux/scatterlist.h> 14 #include <linux/usb.h> 15 16 #define EP_CTX_PER_DEV 31 /* FIMXME defined twice, from xhci.h */ 17 18 struct xhci_sideband; 19 20 /** 21 * struct xhci_sideband - representation of a sideband accessed usb device. 22 * @xhci: The xhci host controller the usb device is connected to 23 * @vdev: the usb device accessed via sideband 24 * @eps: array of endpoints controlled via sideband 25 * @ir: event handling and buffer for sideband accessed device 26 * 27 * FIXME usb device accessed via sideband Keeping track of sideband accessed usb devices. 28 */ 29 30 struct xhci_sideband { 31 struct xhci_hcd *xhci; 32 struct xhci_virt_device *vdev; 33 struct xhci_virt_ep *eps[EP_CTX_PER_DEV]; 34 struct xhci_interrupter *ir; 35 struct mutex mutex; 36 }; 37 38 struct xhci_sideband * 39 xhci_sideband_register(struct usb_device *udev); 40 void 41 xhci_sideband_unregister(struct xhci_sideband *sb); 42 int 43 xhci_sideband_add_endpoint(struct xhci_sideband *sb, 44 struct usb_host_endpoint *host_ep); 45 int 46 xhci_sideband_remove_endpoint(struct xhci_sideband *sb, 47 struct usb_host_endpoint *host_ep); 48 int 49 xhci_sideband_stop_endpoint(struct xhci_sideband *sb, 50 struct usb_host_endpoint *host_ep); 51 struct sg_table * 52 xhci_sideband_get_endpoint_buffer(struct xhci_sideband *sb, 53 struct usb_host_endpoint *host_ep); 54 struct sg_table * 55 xhci_sideband_get_event_buffer(struct xhci_sideband *sb); 56 57 int xhci_sideband_enable_interrupt(struct xhci_sideband *sb, u32 imod_interval); 58 59 int 60 xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg, 61 int intr_num, bool ip_autoclear); 62 63 void 64 xhci_sideband_remove_interrupter(struct xhci_sideband *sb); 65 66 int 67 xhci_sideband_interrupter_id(struct xhci_sideband *sb); 68 69 #endif /* __LINUX_XHCI_SIDEBAND_H */ 70 71