diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c index f3f081016..689c8f0eb 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c @@ -859,9 +859,8 @@ int xhci_usbh_pipe_alloc(usbh_pipe_t *pipe, const struct usbh_endpoint_cfg *ep_c struct usbh_hubport *hport = ep_cfg->hport; struct xhci_endpoint *ppipe = usb_align(XHCI_RING_SIZE, sizeof(struct xhci_endpoint)); struct xhci_slot *slot; - uintptr_t ring_vir; - uintptr_t ring_phy; - size_t len; + size_t len; + struct usb_mem_page ring_page; if (NULL == ppipe) { return -ENOMEM; @@ -882,15 +881,15 @@ int xhci_usbh_pipe_alloc(usbh_pipe_t *pipe, const struct usbh_endpoint_cfg *ep_c /* Allocate xHCI ring */ len = sizeof(*ppipe->ep_reqs); - rc = naive_mmap(&ring_vir, &ring_phy, len, false); + rc = usb_alloc_mem_data_page(&ring_page); if(rc != 0){ - USB_LOG_ERR("XHCI %s could not allocate xhci device context\n", xhci->name ); + USB_LOG_ERR("XHCI %s could not allocate xhci ring\n", xhci->name ); rc = -ENOMEM; goto failed; } - ppipe->ep_reqs_vir = ring_vir; - ppipe->ep_reqs_phy = ring_phy; - ppipe->ep_reqs = (struct xhci_ring *)ring_vir; + ppipe->ep_reqs_vir = ring_page.vir_addr; + ppipe->ep_reqs_phy = ring_page.phy_addr; + ppipe->ep_reqs = (struct xhci_ring *)ppipe->ep_reqs_vir; memset ( ppipe->ep_reqs, 0, len ); if (ppipe->address == 0) { /* if try to allocate ctrl ep, open device first */