func: static int usb_xhci_post_load(void *opaque, int version_id) XHCIState * xhci = opaque ; PCIDevice * pci_dev = PCI_DEVICE ( xhci ) ; XHCISlot * slot ; XHCIEPContext * epctx ; dma_addr_t dcbaap , pctx ; uint32_t slot_ctx [ 4 ] ; uint32_t ep_ctx [ 5 ] ; int slotid , epid , state , intr ; dcbaap = xhci_addr64 ( xhci -> dcbaap_low , xhci -> dcbaap_high ); static inline dma_addr_t xhci_addr64(uint32_t low, uint32_t high) if ( sizeof ( dma_addr_t ) == 4 )  return low ; return low | ( ( ( dma_addr_t ) high << 16 ) << 16 ) ; for (slotid = 1; slotid <= xhci->numslots; slotid++) slot = & xhci -> slots [ slotid - 1 ]; if ( ! slot -> addressed )  slot -> ctx = xhci_mask64 ( ldq_le_pci_dma ( pci_dev , dcbaap + 8 * slotid ) ); static inline dma_addr_t xhci_mask64(uint64_t addr) if ( sizeof ( dma_addr_t ) == 4 )  return addr & 0xffffffff ; return addr ; slot -> uport = xhci_lookup_uport ( xhci , slot_ctx ); static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx) USBPort * uport ; char path [ 32 ] ; int i , pos , port ; port = ( slot_ctx [ 1 ] >> 16 ) & 0xFF; if ( port < 1 || port > xhci -> numports )  return NULL ; if ( strcmp ( uport -> path , path ) == 0 )  return uport ; return NULL ; if ( ! slot -> uport )  slot -> enabled = 0; slot -> addressed = 0; for (epid = 1; epid <= 31; epid++) pctx = slot -> ctx + 32 * epid; state = ep_ctx [ 0 ] & EP_STATE_MASK; if ( state == EP_DISABLED )  epctx = xhci_alloc_epctx ( xhci , slotid , epid ); static XHCIEPContext *xhci_alloc_epctx(XHCIState unsigned int unsigned int epid) XHCIEPContext * epctx ; int i ; epctx = g_new0 ( XHCIEPContext , 1 ); epctx -> xhci = xhci; epctx -> slotid = slotid; epctx -> epid = epid; for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) epctx -> transfers [ i ] . xhci = xhci; epctx -> transfers [ i ] . slotid = slotid; epctx -> transfers [ i ] . epid = epid; epctx -> kick_timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , xhci_ep_kick_timer , epctx ); return epctx ; xhci_init_epctx ( epctx , pctx , ep_ctx ); static void xhci_init_epctx(XHCIEPContext dma_addr_t pctx, uint32_t *ctx) dma_addr_t dequeue ; dequeue = xhci_addr64 ( ctx [ 2 ] & ~0xf , ctx [ 3 ] ); static inline dma_addr_t xhci_addr64(uint32_t low, uint32_t high) if ( sizeof ( dma_addr_t ) == 4 )  return low ; return low | ( ( ( dma_addr_t ) high << 16 ) << 16 ) ; epctx -> type = ( ctx [ 1 ] >> EP_TYPE_SHIFT ) & EP_TYPE_MASK; epctx -> pctx = pctx; epctx -> max_psize = ctx [ 1 ] >> 16; epctx -> max_psize *= 1 + ( ( ctx [ 1 ] >> 8 ) & 0xff ); epctx -> max_pstreams = ( ctx [ 0 ] >> 10 ) & epctx -> xhci -> max_pstreams_mask; epctx -> lsa = ( ctx [ 0 ] >> 15 ) & 1; if ( epctx -> max_pstreams )  xhci_alloc_streams ( epctx , dequeue ); static void xhci_alloc_streams(XHCIEPContext *epctx, dma_addr_t base) assert ( epctx -> pstreams == NULL ); 