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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/io/rootnex.c
          +++ new/usr/src/uts/i86pc/io/rootnex.c
↓ open down ↓ 1803 lines elided ↑ open up ↑
1804 1804          }
1805 1805          count_max = attr->dma_attr_count_max + 1;
1806 1806          if (count_max < attr->dma_attr_count_max) {
1807 1807                  count_max = attr->dma_attr_count_max;
1808 1808          }
1809 1809  
1810 1810          /*
1811 1811           * granularity may or may not be a power of two. If it isn't, we can't
1812 1812           * use a simple mask.
1813 1813           */
1814      -        if (attr->dma_attr_granular & (attr->dma_attr_granular - 1)) {
     1814 +        if (!ISP2(attr->dma_attr_granular)) {
1815 1815                  dma->dp_granularity_power_2 = B_FALSE;
1816 1816          } else {
1817 1817                  dma->dp_granularity_power_2 = B_TRUE;
1818 1818          }
1819 1819  
1820 1820          /*
1821 1821           * maxxfer should be a whole multiple of granularity. If we're going to
1822 1822           * break up a window because we're greater than maxxfer, we might as
1823 1823           * well make sure it's maxxfer is a whole multiple so we don't have to
1824 1824           * worry about triming the window later on for this case.
↓ open down ↓ 2037 lines elided ↑ open up ↑
3862 3862                   * get the offset into the page. For the 64-bit kernel, get the
3863 3863                   * pfn which we'll use with seg kpm.
3864 3864                   */
3865 3865                  poff = cookie->dmac_laddress & MMU_PAGEOFFSET;
3866 3866  #if defined(__amd64)
3867 3867                  /* mfn_to_pfn() is a NOP on i86pc */
3868 3868                  pfn = mfn_to_pfn(cookie->dmac_laddress >> MMU_PAGESHIFT);
3869 3869  #endif /* __amd64 */
3870 3870  
3871 3871                  /* figure out if the copybuf size is a power of 2 */
3872      -                if (dma->dp_copybuf_size & (dma->dp_copybuf_size - 1)) {
     3872 +                if (!ISP2(dma->dp_copybuf_size)) {
3873 3873                          copybuf_sz_power_2 = B_FALSE;
3874 3874                  } else {
3875 3875                          copybuf_sz_power_2 = B_TRUE;
3876 3876                  }
3877 3877  
3878 3878                  /* This page uses the copy buffer */
3879 3879                  dma->dp_pgmap[pidx].pm_uses_copybuf = B_TRUE;
3880 3880  
3881 3881                  /*
3882 3882                   * save the copy buffer KVA that we'll use with this page.
↓ open down ↓ 1290 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX