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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/io/pci/pci_tools.c
          +++ new/usr/src/uts/i86pc/io/pci/pci_tools.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
       25 +#include <sys/sysmacros.h>
  25   26  #include <sys/types.h>
  26   27  #include <sys/mkdev.h>
  27   28  #include <sys/stat.h>
  28   29  #include <sys/sunddi.h>
  29   30  #include <vm/seg_kmem.h>
  30   31  #include <sys/machparam.h>
  31   32  #include <sys/sunndi.h>
  32   33  #include <sys/ontrap.h>
  33   34  #include <sys/psm.h>
  34   35  #include <sys/pcie.h>
↓ open down ↓ 546 lines elided ↑ open up ↑
 581  582  pcitool_cfg_access(pcitool_reg_t *prg, boolean_t write_flag,
 582  583      boolean_t io_access)
 583  584  {
 584  585          int size = PCITOOL_ACC_ATTR_SIZE(prg->acc_attr);
 585  586          boolean_t big_endian = PCITOOL_ACC_IS_BIG_ENDIAN(prg->acc_attr);
 586  587          int rval = SUCCESS;
 587  588          uint64_t local_data;
 588  589          pci_cfgacc_req_t req;
 589  590          uint32_t max_offset;
 590  591  
 591      -        if ((size <= 0) || (size > 8) || ((size & (size - 1)) != 0)) {
      592 +        if ((size <= 0) || (size > 8) || !ISP2(size)) {
 592  593                  prg->status = PCITOOL_INVALID_SIZE;
 593  594                  return (ENOTSUP);
 594  595          }
 595  596  
 596  597          /*
 597  598           * NOTE: there is no way to verify whether or not the address is
 598  599           * valid other than that it is within the maximum offset.  The
 599  600           * put functions return void and the get functions return -1 on error.
 600  601           */
 601  602  
↓ open down ↓ 600 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX