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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ib/adapters/hermon/hermon_cmd.c
          +++ new/usr/src/uts/common/io/ib/adapters/hermon/hermon_cmd.c
↓ open down ↓ 67 lines elided ↑ open up ↑
  68   68   *    is used to determine whether to wait for an available
  69   69   *    outstanding command (if necessary) or to return error.
  70   70   */
  71   71  int
  72   72  hermon_cmd_post(hermon_state_t *state, hermon_cmd_post_t *cmdpost)
  73   73  {
  74   74          hermon_cmd_t    *cmdptr;
  75   75          int             status, retry_cnt, retry_cnt2, hw_err;
  76   76          uint16_t        token;
  77   77  
  78      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cmdpost))
  79      -
  80   78          /* Determine if we are going to spin until completion */
  81   79          if (cmdpost->cp_flags == HERMON_CMD_NOSLEEP_SPIN) {
  82   80  
  83   81                  /* Write the command to the HCR */
  84   82                  retry_cnt = HCA_PIO_RETRY_CNT;
  85   83                  do {
  86   84                          status = hermon_write_hcr(state, cmdpost, 0, &hw_err);
  87   85                  } while (status == HERMON_CMD_INTERNAL_ERR && retry_cnt-- > 0);
  88   86  
  89   87                  /* Check if there is an error status in hermon_write_hcr() */
↓ open down ↓ 16 lines elided ↑ open up ↑
 106  104  
 107  105          } else {  /* "HERMON_CMD_SLEEP_NOSPIN" */
 108  106                  ASSERT(HERMON_SLEEPFLAG_FOR_CONTEXT() != HERMON_NOSLEEP);
 109  107  
 110  108                  /* NOTE: Expect threads to be waiting in here */
 111  109                  status = hermon_outstanding_cmd_alloc(state, &cmdptr,
 112  110                      cmdpost->cp_flags);
 113  111                  if (status != HERMON_CMD_SUCCESS) {
 114  112                          return (status);
 115  113                  }
 116      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cmdptr))
 117  114  
 118  115                  retry_cnt = HCA_PIO_RETRY_CNT;
 119  116  retry:
 120  117                  /*
 121  118                   * Set status to "HERMON_CMD_INVALID_STATUS".  It is
 122  119                   * appropriate to do this here without the "cmd_comp_lock"
 123  120                   * because this register is overloaded.  Later it will be
 124  121                   * used to indicate - through a change from this invalid
 125  122                   * value to some other value - that the condition variable
 126  123                   * has been signaled.  Once it has, status will then contain
↓ open down ↓ 23 lines elided ↑ open up ↑
 150  147                                  return (status);
 151  148                          }
 152  149                  /* Check if there is a transient internal error */
 153  150                  } else if (retry_cnt2 != HCA_PIO_RETRY_CNT) {
 154  151                          hermon_fm_ereport(state, HCA_IBA_ERR,
 155  152                              HCA_ERR_TRANSIENT);
 156  153                  }
 157  154  
 158  155                  /*
 159  156                   * cv_wait() on the "command_complete" condition variable.
 160      -                 * Note: We have the "__lock_lint" here to workaround warlock.
 161      -                 * Since warlock doesn't know that other parts of the Hermon
 162      -                 * may occasionally call this routine while holding their own
 163      -                 * locks, it complains about this cv_wait.  In reality,
 164      -                 * however, the rest of the driver never calls this routine
 165      -                 * with a lock held unless they pass HERMON_CMD_NOSLEEP.
 166  157                   */
 167      -                _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*cmdptr))
 168  158                  mutex_enter(&cmdptr->cmd_comp_lock);
 169  159                  while (cmdptr->cmd_status == HERMON_CMD_INVALID_STATUS) {
 170      -#ifndef __lock_lint
 171      -                        cv_wait(&cmdptr->cmd_comp_cv, &cmdptr->cmd_comp_lock);
 172  160                          /* NOTE: EXPECT SEVERAL THREADS TO BE WAITING HERE */
 173      -#endif
      161 +                        cv_wait(&cmdptr->cmd_comp_cv, &cmdptr->cmd_comp_lock);
 174  162                  }
 175  163                  mutex_exit(&cmdptr->cmd_comp_lock);
 176      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cmdptr))
 177  164  
 178  165                  /*
 179  166                   * Wake up after command completes (cv_signal).  Read status
 180  167                   * from the command (success, fail, etc.).  It is appropriate
 181  168                   * here (as above) to read the status field without the
 182  169                   * "cmd_comp_lock" because it is no longer being used to
 183  170                   * indicate whether the condition variable has been signaled
 184  171                   * (i.e. at this point we are certain that it already has).
 185  172                   */
 186  173                  status = cmdptr->cmd_status;
↓ open down ↓ 147 lines elided ↑ open up ↑
 334  321                                          hermon_impl_mbox_free(
 335  322                                              &state->hs_in_mblist,
 336  323                                              &mbox_info->mbi_in);
 337  324                                  }
 338  325                                  return (status);
 339  326                          }
 340  327                  }
 341  328          }
 342  329  
 343  330          /* Store appropriate context in mbox_info */
 344      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(mbox_info->mbi_sleep_context))
 345  331          mbox_info->mbi_sleep_context = sleep_context;
 346  332  
 347  333          return (HERMON_CMD_SUCCESS);
 348  334  }
 349  335  
 350  336  
 351  337  /*
 352  338   * hermon_mbox_free()
 353  339   *    Context: Can be called from interrupt or base context.
 354  340   */
 355  341  void
 356  342  hermon_mbox_free(hermon_state_t *state, hermon_mbox_info_t *mbox_info)
 357  343  {
 358  344          /*
 359  345           * The mailbox has to be freed in the same context from which it was
 360  346           * allocated.  The context is stored in the mbox_info at
 361  347           * hermon_mbox_alloc() time.  We check the stored context against the
 362  348           * current context here.
 363  349           */
 364      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(mbox_info->mbi_sleep_context))
 365  350          ASSERT(mbox_info->mbi_sleep_context == HERMON_SLEEPFLAG_FOR_CONTEXT());
 366  351  
 367  352          /* Determine correct mboxlist based on calling context */
 368  353          if (mbox_info->mbi_sleep_context == HERMON_NOSLEEP) {
 369  354                  /* Free the intr "In" mailbox */
 370  355                  if (mbox_info->mbi_alloc_flags & HERMON_ALLOC_INMBOX) {
 371  356                          hermon_impl_mbox_free(&state->hs_in_intr_mblist,
 372  357                              &mbox_info->mbi_in);
 373  358                  }
 374  359  
↓ open down ↓ 221 lines elided ↑ open up ↑
 596  581                  mblist->mbl_pollers--;
 597  582  
 598  583          /* HERMON_SLEEP */
 599  584          } else {
 600  585                  /*
 601  586                   * Grab lock here as we prepare to cv_wait if needed.
 602  587                   */
 603  588                  mutex_enter(&mblist->mbl_lock);
 604  589                  while (mblist->mbl_entries_free == 0) {
 605  590                          /*
 606      -                         * Wait (on cv) for a mailbox to become free.  Note:
 607      -                         * Just as we do above in hermon_cmd_post(), we also
 608      -                         * have the "__lock_lint" here to workaround warlock.
 609      -                         * Warlock doesn't know that other parts of the Hermon
 610      -                         * may occasionally call this routine while holding
 611      -                         * their own locks, so it complains about this cv_wait.
 612      -                         * In reality, however, the rest of the driver never
 613      -                         * calls this routine with a lock held unless they pass
 614      -                         * HERMON_CMD_NOSLEEP.
      591 +                         * Wait (on cv) for a mailbox to become free.
 615  592                           */
 616  593                          mblist->mbl_waiters++;
 617      -#ifndef __lock_lint
 618  594                          cv_wait(&mblist->mbl_cv, &mblist->mbl_lock);
 619      -#endif
 620  595                  }
 621  596          }
 622  597  
 623  598          /* Grab the next available mailbox from list */
 624  599          mbox_ptr = mblist->mbl_mbox;
 625  600          index    = mblist->mbl_head_indx;
 626  601          next     = mbox_ptr[index].mb_next;
 627  602          prev     = mbox_ptr[index].mb_prev;
 628  603  
 629  604          /* Remove it from the mailbox list */
↓ open down ↓ 241 lines elided ↑ open up ↑
 871  846           * next available command.
 872  847           */
 873  848          while (cmd_list->cml_entries_free == 0) {
 874  849                  /* No free commands */
 875  850                  if (cmd_wait == HERMON_NOSLEEP) {
 876  851                          mutex_exit(&cmd_list->cml_lock);
 877  852                          return (HERMON_CMD_INSUFF_RSRC);
 878  853                  }
 879  854  
 880  855                  /*
 881      -                 * Wait (on cv) for a command to become free.  Note: Just
 882      -                 * as we do above in hermon_cmd_post(), we also have the
 883      -                 * "__lock_lint" here to workaround warlock.  Warlock doesn't
 884      -                 * know that other parts of the Hermon may occasionally call
 885      -                 * this routine while holding their own locks, so it complains
 886      -                 * about this cv_wait.  In reality, however, the rest of the
 887      -                 * driver never calls this routine with a lock held unless
 888      -                 * they pass HERMON_CMD_NOSLEEP.
      856 +                 * Wait (on cv) for a command to become free.
 889  857                   */
 890  858                  cmd_list->cml_waiters++;
 891      -#ifndef __lock_lint
 892  859                  cv_wait(&cmd_list->cml_cv, &cmd_list->cml_lock);
 893      -#endif
 894  860          }
 895  861  
 896  862          /* Grab the next available command from the list */
 897  863          head = cmd_list->cml_head_indx;
 898  864          *cmd_ptr = &cmd_list->cml_cmd[head];
 899      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(**cmd_ptr))
 900  865          next = (*cmd_ptr)->cmd_next;
 901  866          prev = (*cmd_ptr)->cmd_prev;
 902  867          (*cmd_ptr)->cmd_status = HERMON_CMD_INVALID_STATUS;
 903  868  
 904  869          /* Remove it from the command list */
 905  870          cmd_list->cml_cmd[next].cmd_prev = prev;
 906  871          cmd_list->cml_cmd[prev].cmd_next = next;
 907  872          cmd_list->cml_head_indx          = next;
 908  873  
 909  874          /* Update the "free" count and return */
↓ open down ↓ 78 lines elided ↑ open up ↑
 988  953  
 989  954          /* initialize the FMA retry loop */
 990  955          hermon_pio_init(fm_loop_cnt, fm_status, fm_test);
 991  956  
 992  957          /*
 993  958           * Grab the "HCR access" lock if the driver is not in
 994  959           * fastreboot. In fastreboot, this function is called
 995  960           * with the single thread but in high interrupt context
 996  961           * (so that this mutex lock cannot be used).
 997  962           */
 998      -#ifdef __lock_lint
 999      -        mutex_enter(&state->hs_cmd_regs.hcr_lock);
1000      -#else
1001  963          if (!HERMON_IN_FASTREBOOT(state)) {
1002  964                  mutex_enter(&state->hs_cmd_regs.hcr_lock);
1003  965          }
1004      -#endif
1005  966          hcr = state->hs_cmd_regs.hcr;
1006  967  
1007  968          /*
1008  969           * First, check the "go" bit to see if any previous hcr usage is
1009  970           * complete.  As long as it is set then we must continue to poll.
1010  971           */
1011  972  
1012  973          countmax = state->hs_cfg_profile->cp_cmd_poll_max;
1013  974          togmask = (state->hs_cmd_toggle & 0x01) << HERMON_HCR_CMD_T_SHFT;
1014  975  
↓ open down ↓ 11 lines elided ↑ open up ↑
1026  987                          break;
1027  988                  }
1028  989                  /* Delay before polling the "go" bit again */
1029  990                  drv_usecwait(state->hs_cfg_profile->cp_cmd_poll_delay);
1030  991  
1031  992                  /*
1032  993                   * If we poll more than the maximum number of times, then
1033  994                   * return a "timeout" error.
1034  995                   */
1035  996                  if (++count > countmax) {
1036      -#ifdef __lock_lint
1037      -                        mutex_exit(&state->hs_cmd_regs.hcr_lock);
1038      -#else
1039  997                          if (!HERMON_IN_FASTREBOOT(state)) {
1040  998                                  mutex_exit(&state->hs_cmd_regs.hcr_lock);
1041  999                          }
1042      -#endif
1043 1000                          cmn_err(CE_NOTE, "write_hcr: cannot start cmd");
1044 1001                          return (HERMON_CMD_TIMEOUT_GOBIT);
1045 1002                  }
1046 1003          }
1047 1004  
1048 1005          /* the FMA retry loop ends. */
1049 1006          hermon_pio_end(state, cmdhdl, pio_error, fm_loop_cnt, fm_status,
1050 1007              fm_test);
1051 1008  
1052 1009          /* check if there is a transient error */
↓ open down ↓ 70 lines elided ↑ open up ↑
1123 1080                                  break;
1124 1081                          }
1125 1082                          /* Delay before polling the "go" bit again */
1126 1083                          drv_usecwait(state->hs_cfg_profile->cp_cmd_poll_delay);
1127 1084  
1128 1085                          /*
1129 1086                           * If we poll more than the maximum number of times,
1130 1087                           * then return a "timeout" error.
1131 1088                           */
1132 1089                          if (++count > countmax) {
1133      -#ifdef __lock_lint
1134      -                                mutex_exit(&state-> hs_cmd_regs.hcr_lock);
1135      -#else
1136 1090                                  if (!HERMON_IN_FASTREBOOT(state)) {
1137 1091                                          mutex_exit(&state->
1138 1092                                              hs_cmd_regs.hcr_lock);
1139 1093                                  }
1140      -#endif
1141 1094                                  cmn_err(CE_NOTE,
1142 1095                                      "write_hcr: cannot complete cmd");
1143 1096                                  return (HERMON_CMD_TIMEOUT_GOBIT);
1144 1097                          }
1145 1098                  }
1146 1099  
1147 1100                  /* Pull out the "status" bits from the HCR */
1148 1101                  status = (hcrreg >> HERMON_HCR_CMD_STATUS_SHFT);
1149 1102  
1150 1103                  /*
↓ open down ↓ 14 lines elided ↑ open up ↑
1165 1118                  if (fm_loop_cnt != HCA_PIO_RETRY_CNT) {
1166 1119                          hw_error = B_TRUE;
1167 1120                  }
1168 1121  
1169 1122          /* END SPIN */
1170 1123          } else {                /* NOSPIN */
1171 1124                  status = HERMON_CMD_SUCCESS;
1172 1125          }
1173 1126  
1174 1127          /* Drop the "HCR access" lock */
1175      -#ifdef __lock_lint
1176      -        mutex_exit(&state->hs_cmd_regs.hcr_lock);
1177      -#else
1178 1128          if (!HERMON_IN_FASTREBOOT(state)) {
1179 1129                  mutex_exit(&state->hs_cmd_regs.hcr_lock);
1180 1130          }
1181      -#endif
1182 1131          if (hw_error == B_TRUE) {
1183 1132                  *hw_err = HCA_PIO_TRANSIENT;
1184 1133          } else {
1185 1134                  *hw_err = HCA_PIO_OK;
1186 1135          }
1187 1136  #ifdef FMA_TEST
1188 1137          if (hermon_test_num == -3) {
1189 1138                  status = HERMON_CMD_INTERNAL_ERR;
1190 1139          }
1191 1140  #endif
1192 1141          return (status);
1193 1142  
1194 1143  pio_error:
1195      -#ifdef __lock_lint
1196      -        mutex_exit(&state->hs_cmd_regs.hcr_lock);
1197      -#else
1198 1144          if (!HERMON_IN_FASTREBOOT(state)) {
1199 1145                  mutex_exit(&state->hs_cmd_regs.hcr_lock);
1200 1146          }
1201      -#endif
1202 1147          hermon_fm_ereport(state, HCA_SYS_ERR, HCA_ERR_NON_FATAL);
1203 1148          *hw_err = HCA_PIO_PERSISTENT;
1204 1149          return (HERMON_CMD_INVALID_STATUS);
1205 1150  }
1206 1151  
1207 1152  
1208 1153  /*
1209 1154   * hermon_outstanding_cmdlist_init()
1210 1155   *    Context: Only called from attach() path context
1211 1156   */
↓ open down ↓ 812 lines elided ↑ open up ↑
2024 1969          hermon_mbox_sync(mbox_info.mbi_out, HERMON_CMD_MADDATA_OFFSET,
2025 1970              size, DDI_DMA_SYNC_FORCPU);
2026 1971  
2027 1972          /*
2028 1973           * Copy GetPortInfo response MAD into "portinfo".  Do any endian
2029 1974           * swapping that may be necessary to flip any of the "portinfo"
2030 1975           * fields
2031 1976           */
2032 1977          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
2033 1978              HERMON_CMD_MADDATA_OFFSET), portinfo, size);
2034      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*portinfo))
2035 1979          HERMON_GETPORTINFO_SWAP(portinfo);
2036 1980  
2037 1981  getportinfo_fail:
2038 1982          /* Free the mailbox */
2039 1983          hermon_mbox_free(state, &mbox_info);
2040 1984          return (status);
2041 1985  }
2042 1986  
2043 1987  /*
2044 1988   * hermon_is_ext_port_counters_supported()
↓ open down ↓ 300 lines elided ↑ open up ↑
2345 2289          hermon_mbox_sync(mbox_info.mbi_out, HERMON_CMD_MADDATA_OFFSET,
2346 2290              size, DDI_DMA_SYNC_FORCPU);
2347 2291  
2348 2292          /*
2349 2293           * Copy GetNodeInfo response MAD into "nodeinfo".  Do any endian
2350 2294           * swapping that may be necessary to flip any of the "nodeinfo"
2351 2295           * fields
2352 2296           */
2353 2297          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
2354 2298              HERMON_CMD_MADDATA_OFFSET), nodeinfo, size);
2355      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*nodeinfo))
2356 2299          HERMON_GETNODEINFO_SWAP(nodeinfo);
2357 2300  
2358 2301  getnodeinfo_fail:
2359 2302          /* Free the mailbox */
2360 2303          hermon_mbox_free(state, &mbox_info);
2361 2304          return (status);
2362 2305  }
2363 2306  
2364 2307  
2365 2308  /*
↓ open down ↓ 118 lines elided ↑ open up ↑
2484 2427          size = sizeof (sm_guidinfo_t);
2485 2428          hermon_mbox_sync(mbox_info.mbi_out, HERMON_CMD_MADDATA_OFFSET,
2486 2429              size, DDI_DMA_SYNC_FORCPU);
2487 2430  
2488 2431          /*
2489 2432           * Copy GetGUIDInfo response MAD into "guidinfo".  Do any endian
2490 2433           * swapping that may be necessary to flip the "guidinfo" fields
2491 2434           */
2492 2435          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
2493 2436              HERMON_CMD_MADDATA_OFFSET), guidinfo, size);
2494      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*guidinfo))
2495 2437          HERMON_GETGUIDINFO_SWAP(guidinfo);
2496 2438  
2497 2439  getguidinfo_fail:
2498 2440          /* Free the mailbox */
2499 2441          hermon_mbox_free(state, &mbox_info);
2500 2442          return (status);
2501 2443  }
2502 2444  
2503 2445  
2504 2446  /*
↓ open down ↓ 51 lines elided ↑ open up ↑
2556 2498          size = sizeof (sm_pkey_table_t);
2557 2499          hermon_mbox_sync(mbox_info.mbi_out, HERMON_CMD_MADDATA_OFFSET,
2558 2500              size, DDI_DMA_SYNC_FORCPU);
2559 2501  
2560 2502          /*
2561 2503           * Copy GetPKeyTable response MAD into "pkeytable".  Do any endian
2562 2504           * swapping that may be necessary to flip the "pkeytable" fields
2563 2505           */
2564 2506          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
2565 2507              HERMON_CMD_MADDATA_OFFSET), pkeytable, size);
2566      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*pkeytable))
2567 2508          HERMON_GETPKEYTABLE_SWAP(pkeytable);
2568 2509  
2569 2510  getpkeytable_fail:
2570 2511          /* Free the mailbox */
2571 2512          hermon_mbox_free(state, &mbox_info);
2572 2513          return (status);
2573 2514  }
2574 2515  
2575 2516  
2576 2517  /*
↓ open down ↓ 1137 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX