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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/os/ddi_impl.c
          +++ new/usr/src/uts/i86pc/os/ddi_impl.c
↓ open down ↓ 1528 lines elided ↑ open up ↑
1529 1529   * This function must be called before i_ddi_cacheattr_to_hatacc().
1530 1530   */
1531 1531  boolean_t
1532 1532  i_ddi_check_cache_attr(uint_t flags)
1533 1533  {
1534 1534          /*
1535 1535           * The cache attributes are mutually exclusive. Any combination of
1536 1536           * the attributes leads to a failure.
1537 1537           */
1538 1538          uint_t cache_attr = IOMEM_CACHE_ATTR(flags);
1539      -        if ((cache_attr != 0) && ((cache_attr & (cache_attr - 1)) != 0))
     1539 +        if ((cache_attr != 0) && !ISP2(cache_attr))
1540 1540                  return (B_FALSE);
1541 1541  
1542 1542          /* All cache attributes are supported on X86/X64 */
1543 1543          if (cache_attr & (IOMEM_DATA_UNCACHED | IOMEM_DATA_CACHED |
1544 1544              IOMEM_DATA_UC_WR_COMBINE))
1545 1545                  return (B_TRUE);
1546 1546  
1547 1547          /* undefined attributes */
1548 1548          return (B_FALSE);
1549 1549  }
↓ open down ↓ 70 lines elided ↑ open up ↑
1620 1620          int e;
1621 1621  
1622 1622          /*
1623 1623           * Check legality of arguments
1624 1624           */
1625 1625          if (length == 0 || kaddrp == NULL || attr == NULL) {
1626 1626                  return (DDI_FAILURE);
1627 1627          }
1628 1628  
1629 1629          if (attr->dma_attr_minxfer == 0 || attr->dma_attr_align == 0 ||
1630      -            (attr->dma_attr_align & (attr->dma_attr_align - 1)) ||
1631      -            (attr->dma_attr_minxfer & (attr->dma_attr_minxfer - 1))) {
1632      -                        return (DDI_FAILURE);
     1630 +            !ISP2(attr->dma_attr_align) || !ISP2(attr->dma_attr_minxfer)) {
     1631 +                return (DDI_FAILURE);
1633 1632          }
1634 1633  
1635 1634          /*
1636 1635           * figure out most restrictive alignment requirement
1637 1636           */
1638 1637          iomin = attr->dma_attr_minxfer;
1639 1638          iomin = maxbit(iomin, attr->dma_attr_align);
1640 1639          if (iomin == 0)
1641 1640                  return (DDI_FAILURE);
1642 1641  
↓ open down ↓ 1282 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX