Print this page
8368 remove warlock leftovers from usr/src/uts


 184 
 185         TAVOR_TNF_ENTER(tavor_rsrc_alloc);
 186 
 187         ASSERT(state != NULL);
 188         ASSERT(hdl != NULL);
 189 
 190         rsrc_pool = &state->ts_rsrc_hdl[rsrc];
 191         ASSERT(rsrc_pool != NULL);
 192 
 193         /*
 194          * Allocate space for the object used to track the resource handle
 195          */
 196         flag = (sleepflag == TAVOR_SLEEP) ? KM_SLEEP : KM_NOSLEEP;
 197         tmp_rsrc_hdl = (tavor_rsrc_t *)kmem_cache_alloc(state->ts_rsrc_cache,
 198             flag);
 199         if (tmp_rsrc_hdl == NULL) {
 200                 TNF_PROBE_0(tavor_rsrc_alloc_kmca_fail, TAVOR_TNF_ERROR, "");
 201                 TAVOR_TNF_EXIT(tavor_rsrc_alloc);
 202                 return (DDI_FAILURE);
 203         }
 204         _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*tmp_rsrc_hdl))
 205 
 206         /*
 207          * Set rsrc_hdl type.  This is later used by the tavor_rsrc_free call
 208          * to know what type of resource is being freed.
 209          */
 210         tmp_rsrc_hdl->rsrc_type = rsrc;
 211 
 212         /*
 213          * Depending on resource type, call the appropriate alloc routine
 214          */
 215         switch (rsrc_pool->rsrc_type) {
 216         case TAVOR_IN_MBOX:
 217         case TAVOR_OUT_MBOX:
 218         case TAVOR_INTR_IN_MBOX:
 219         case TAVOR_INTR_OUT_MBOX:
 220                 status = tavor_rsrc_mbox_alloc(rsrc_pool, num, tmp_rsrc_hdl);
 221                 break;
 222 
 223         case TAVOR_QPC:
 224         case TAVOR_CQC:


2498 tavor_rsrc_pdhdl_alloc(tavor_rsrc_pool_info_t *pool_info, uint_t sleepflag,
2499     tavor_rsrc_t *hdl)
2500 {
2501         tavor_pdhdl_t   addr;
2502         void            *tmpaddr;
2503         int             flag, status;
2504 
2505         TAVOR_TNF_ENTER(tavor_rsrc_pdhdl_alloc);
2506 
2507         ASSERT(pool_info != NULL);
2508         ASSERT(hdl != NULL);
2509 
2510         /* Allocate the software handle */
2511         status = tavor_rsrc_swhdl_alloc(pool_info, sleepflag, hdl);
2512         if (status != DDI_SUCCESS) {
2513                 TNF_PROBE_0(tavor_rsrc_pdhdl_alloc_fail, TAVOR_TNF_ERROR, "");
2514                 TAVOR_TNF_EXIT(tavor_rsrc_pdhdl_alloc);
2515                 return (DDI_FAILURE);
2516         }
2517         addr = (tavor_pdhdl_t)hdl->tr_addr;
2518         _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*addr))
2519 
2520         /* Allocate a PD number for the handle */
2521         flag = (sleepflag == TAVOR_SLEEP) ? VM_SLEEP : VM_NOSLEEP;
2522         tmpaddr = vmem_alloc(pool_info->rsrc_vmp, 1, flag);
2523         if (tmpaddr == NULL) {
2524                 /* No more PD number entries available */
2525                 tavor_rsrc_swhdl_free(pool_info, hdl);
2526                 TNF_PROBE_0(tavor_rsrc_pdhdl_alloc_vma_fail,
2527                     TAVOR_TNF_ERROR, "");
2528                 TAVOR_TNF_EXIT(tavor_rsrc_pdhdl_alloc);
2529                 return (DDI_FAILURE);
2530         }
2531         addr->pd_pdnum = (uint32_t)(uintptr_t)tmpaddr;
2532         addr->pd_rsrcp = hdl;
2533         hdl->tr_indx   = addr->pd_pdnum;
2534 
2535         TAVOR_TNF_EXIT(tavor_rsrc_pdhdl_alloc);
2536         return (DDI_SUCCESS);
2537 }
2538 




 184 
 185         TAVOR_TNF_ENTER(tavor_rsrc_alloc);
 186 
 187         ASSERT(state != NULL);
 188         ASSERT(hdl != NULL);
 189 
 190         rsrc_pool = &state->ts_rsrc_hdl[rsrc];
 191         ASSERT(rsrc_pool != NULL);
 192 
 193         /*
 194          * Allocate space for the object used to track the resource handle
 195          */
 196         flag = (sleepflag == TAVOR_SLEEP) ? KM_SLEEP : KM_NOSLEEP;
 197         tmp_rsrc_hdl = (tavor_rsrc_t *)kmem_cache_alloc(state->ts_rsrc_cache,
 198             flag);
 199         if (tmp_rsrc_hdl == NULL) {
 200                 TNF_PROBE_0(tavor_rsrc_alloc_kmca_fail, TAVOR_TNF_ERROR, "");
 201                 TAVOR_TNF_EXIT(tavor_rsrc_alloc);
 202                 return (DDI_FAILURE);
 203         }

 204 
 205         /*
 206          * Set rsrc_hdl type.  This is later used by the tavor_rsrc_free call
 207          * to know what type of resource is being freed.
 208          */
 209         tmp_rsrc_hdl->rsrc_type = rsrc;
 210 
 211         /*
 212          * Depending on resource type, call the appropriate alloc routine
 213          */
 214         switch (rsrc_pool->rsrc_type) {
 215         case TAVOR_IN_MBOX:
 216         case TAVOR_OUT_MBOX:
 217         case TAVOR_INTR_IN_MBOX:
 218         case TAVOR_INTR_OUT_MBOX:
 219                 status = tavor_rsrc_mbox_alloc(rsrc_pool, num, tmp_rsrc_hdl);
 220                 break;
 221 
 222         case TAVOR_QPC:
 223         case TAVOR_CQC:


2497 tavor_rsrc_pdhdl_alloc(tavor_rsrc_pool_info_t *pool_info, uint_t sleepflag,
2498     tavor_rsrc_t *hdl)
2499 {
2500         tavor_pdhdl_t   addr;
2501         void            *tmpaddr;
2502         int             flag, status;
2503 
2504         TAVOR_TNF_ENTER(tavor_rsrc_pdhdl_alloc);
2505 
2506         ASSERT(pool_info != NULL);
2507         ASSERT(hdl != NULL);
2508 
2509         /* Allocate the software handle */
2510         status = tavor_rsrc_swhdl_alloc(pool_info, sleepflag, hdl);
2511         if (status != DDI_SUCCESS) {
2512                 TNF_PROBE_0(tavor_rsrc_pdhdl_alloc_fail, TAVOR_TNF_ERROR, "");
2513                 TAVOR_TNF_EXIT(tavor_rsrc_pdhdl_alloc);
2514                 return (DDI_FAILURE);
2515         }
2516         addr = (tavor_pdhdl_t)hdl->tr_addr;

2517 
2518         /* Allocate a PD number for the handle */
2519         flag = (sleepflag == TAVOR_SLEEP) ? VM_SLEEP : VM_NOSLEEP;
2520         tmpaddr = vmem_alloc(pool_info->rsrc_vmp, 1, flag);
2521         if (tmpaddr == NULL) {
2522                 /* No more PD number entries available */
2523                 tavor_rsrc_swhdl_free(pool_info, hdl);
2524                 TNF_PROBE_0(tavor_rsrc_pdhdl_alloc_vma_fail,
2525                     TAVOR_TNF_ERROR, "");
2526                 TAVOR_TNF_EXIT(tavor_rsrc_pdhdl_alloc);
2527                 return (DDI_FAILURE);
2528         }
2529         addr->pd_pdnum = (uint32_t)(uintptr_t)tmpaddr;
2530         addr->pd_rsrcp = hdl;
2531         hdl->tr_indx   = addr->pd_pdnum;
2532 
2533         TAVOR_TNF_EXIT(tavor_rsrc_pdhdl_alloc);
2534         return (DDI_SUCCESS);
2535 }
2536