Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4/os/ddi_impl.c
          +++ new/usr/src/uts/sun4/os/ddi_impl.c
↓ open down ↓ 993 lines elided ↑ open up ↑
 994  994   * This function must be called before i_ddi_cacheattr_to_hatacc().
 995  995   */
 996  996  boolean_t
 997  997  i_ddi_check_cache_attr(uint_t flags)
 998  998  {
 999  999          /*
1000 1000           * The cache attributes are mutually exclusive. Any combination of
1001 1001           * the attributes leads to a failure.
1002 1002           */
1003 1003          uint_t cache_attr = IOMEM_CACHE_ATTR(flags);
1004      -        if ((cache_attr != 0) && ((cache_attr & (cache_attr - 1)) != 0))
     1004 +        if ((cache_attr != 0) && !ISP2(cache_attr))
1005 1005                  return (B_FALSE);
1006 1006  
1007 1007          /*
1008 1008           * On the sparc architecture, only IOMEM_DATA_CACHED is meaningful,
1009 1009           * but others lead to a failure.
1010 1010           */
1011 1011          if (cache_attr & IOMEM_DATA_CACHED)
1012 1012                  return (B_TRUE);
1013 1013          else
1014 1014                  return (B_FALSE);
↓ open down ↓ 121 lines elided ↑ open up ↑
1136 1136   * we've made it private and moved it here.
1137 1137   */
1138 1138  static int
1139 1139  i_ddi_iomin(dev_info_t *a, int i, int stream)
1140 1140  {
1141 1141          int r;
1142 1142  
1143 1143          /*
1144 1144           * Make sure that the initial value is sane
1145 1145           */
1146      -        if (i & (i - 1))
     1146 +        if (!ISP2(i))
1147 1147                  return (0);
1148 1148          if (i == 0)
1149 1149                  i = (stream) ? 4 : 1;
1150 1150  
1151 1151          r = ddi_ctlops(a, a,
1152 1152              DDI_CTLOPS_IOMIN, (void *)(uintptr_t)stream, (void *)&i);
1153      -        if (r != DDI_SUCCESS || (i & (i - 1)))
     1153 +        if (r != DDI_SUCCESS || !ISP2(i))
1154 1154                  return (0);
1155 1155          return (i);
1156 1156  }
1157 1157  
1158 1158  int
1159 1159  i_ddi_mem_alloc(dev_info_t *dip, ddi_dma_attr_t *attr,
1160 1160      size_t length, int cansleep, int flags,
1161 1161      ddi_device_acc_attr_t *accattrp,
1162 1162      caddr_t *kaddrp, size_t *real_length, ddi_acc_hdl_t *handlep)
1163 1163  {
↓ open down ↓ 6 lines elided ↑ open up ↑
1170 1170  #endif
1171 1171  
1172 1172          /*
1173 1173           * Check legality of arguments
1174 1174           */
1175 1175          if (length == 0 || kaddrp == NULL || attr == NULL) {
1176 1176                  return (DDI_FAILURE);
1177 1177          }
1178 1178  
1179 1179          if (attr->dma_attr_minxfer == 0 || attr->dma_attr_align == 0 ||
1180      -            (attr->dma_attr_align & (attr->dma_attr_align - 1)) ||
1181      -            (attr->dma_attr_minxfer & (attr->dma_attr_minxfer - 1))) {
     1180 +            !ISP2(attr->dma_attr_align) || !ISP2(attr->dma_attr_minxfer)) {
1182 1181                  return (DDI_FAILURE);
1183 1182          }
1184 1183  
1185 1184          /*
1186 1185           * check if a streaming sequential xfer is requested.
1187 1186           */
1188 1187          streaming = (flags & DDI_DMA_STREAMING) ? 1 : 0;
1189 1188  
1190 1189          /*
1191 1190           * Drivers for 64-bit capable SBus devices will encode
↓ open down ↓ 750 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX