From 168776537163cefa0fde5d857d67ba21c61a6bb9 Mon Sep 17 00:00:00 2001 From: YanLiang Date: Tue, 22 May 2018 19:57:31 +0800 Subject: [PATCH] DM USB: xHCI: add write function for extended capability registers. Some xHCI extended capabilities are writable. This patch adds the writing function for excap. Change-Id: Ie8b144b47ffa261f97d0461bf97b0c4d312a9333 Signed-off-by: Liang Yang Reviewed-by: Xiaoguang Wu Reviewed-by: Yu Wang Reviewed-by: Kevin Tian --- devicemodel/hw/pci/xhci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/devicemodel/hw/pci/xhci.c b/devicemodel/hw/pci/xhci.c index 534088475..acc02735a 100755 --- a/devicemodel/hw/pci/xhci.c +++ b/devicemodel/hw/pci/xhci.c @@ -958,6 +958,17 @@ pci_xhci_portregs_write(struct pci_xhci_vdev *xdev, } } +static void +pci_xhci_excap_write(struct pci_xhci_vdev *xdev, uint64_t offset, + uint64_t value) +{ + /* TODO: The default extended capabilities are readonly. Need implement + * related write operations once writable capabilities get supported in + * future. + */ + UPRINTF(LWRN, "write invalid offset 0x%lx\r\n", offset); +} + struct xhci_dev_ctx * pci_xhci_get_dev_ctx(struct pci_xhci_vdev *xdev, uint32_t slot) { @@ -2732,6 +2743,8 @@ pci_xhci_write(struct vmctx *ctx, pci_xhci_dbregs_write(xdev, offset, value); else if (offset < xdev->excapoff) pci_xhci_rtsregs_write(xdev, offset, value); + else if (offset < xdev->regsend) + pci_xhci_excap_write(xdev, offset, value); else UPRINTF(LWRN, "write invalid offset %ld\r\n", offset);