Print this page
10686 Debug macros causes smatch issues

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/usb/scsa2usb/scsa2usb.h
          +++ new/usr/src/uts/common/sys/usb/scsa2usb/scsa2usb.h
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  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   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  22   22   * Use is subject to license terms.
  23   23   *
  24      - * Copyright 2016 Joyent, Inc.
       24 + * Copyright 2019, Joyent, Inc.
  25   25   */
  26   26  
  27   27  #ifndef _SYS_USB_SCSA2USB_H
  28   28  #define _SYS_USB_SCSA2USB_H
  29   29  
  30   30  
  31   31  #ifdef  __cplusplus
  32   32  extern "C" {
  33   33  #endif
  34   34  
↓ open down ↓ 141 lines elided ↑ open up ↑
 176  176   * SCSA2USB_ATTRS_BIG_TIMEOUT: Mitsumi's CD-RW devices need large
 177  177   *              timeout with SCMD_START_STOP cmd
 178  178   * SCSA2USB_ATTRS_RMB: Pay attention to the device's RMB setting,
 179  179   *              instead of automatically treating it as removable
 180  180   * SCSA2USB_ATTRS_USE_CSW_RESIDUE: Some devices report false residue in
 181  181   *              the CSW of bulk-only transfer status stage though data
 182  182   *              was successfully transfered, so need to ignore residue.
 183  183   * SCSA2USB_ATTRS_NO_MEDIA_CHECK: AMI Virtual Floppy devices need to
 184  184   *              check if media is ready before issuing READ CAPACITY.
 185  185   * SCSA2USB_ATTRS_NO_CAP_ADJUST: Some devices return total logical block number
 186      - *              instead of highest logical block address on READ_CAPACITY cmd.
      186 + *              instead of highest logical block address on READ_CAPACITY cmd.
 187  187   *
 188  188   * NOTE: If a device simply STALLs the GET_MAX_LUN BO class-specific command
 189  189   * and recovers then it will not be added to the scsa2usb_blacklist[] table
 190  190   * in scsa2usb.c. The other attributes will not be taken of the table unless
 191  191   * their inclusion causes a recovery and retries (thus seriously affecting
 192  192   * the driver performance).
 193  193   */
 194  194  #define SCSA2USB_ATTRS_GET_LUN          0x01    /* GET_MAX_LUN (Bulk Only) */
 195  195  #define SCSA2USB_ATTRS_PM               0x02    /* Some don't support PM */
 196  196  #define SCSA2USB_ATTRS_START_STOP       0x04    /* SCMD_START_STOP */
↓ open down ↓ 76 lines elided ↑ open up ↑
 273  273          int     reduced_cmd_support;
 274  274  } scsa2usb_ov_t;
 275  275  
 276  276  
 277  277  /*
 278  278   * Per bulk device "state" data structure.
 279  279   */
 280  280  typedef struct scsa2usb_state {
 281  281          int                     scsa2usb_instance;      /* Instance number    */
 282  282          int                     scsa2usb_dev_state;     /* USB device state   */
 283      -        int                     scsa2usb_flags;         /* Per instance flags */
      283 +        int                     scsa2usb_flags;         /* Per instance flags */
 284  284          int                     scsa2usb_intfc_num;     /* Interface number   */
 285  285          dev_info_t              *scsa2usb_dip;          /* Per device. info   */
 286  286          scsa2usb_power_t        *scsa2usb_pm;           /* PM state info */
 287  287  
 288  288          int                     scsa2usb_transport_busy; /* ugen/sd traffic */
 289  289          int                     scsa2usb_ugen_open_count;
 290  290          kcondvar_t              scsa2usb_transport_busy_cv;
 291  291          struct proc             *scsa2usb_busy_proc; /* owner of the hardware */
 292  292  
 293  293          kmutex_t                scsa2usb_mutex;         /* Per instance lock  */
↓ open down ↓ 238 lines elided ↑ open up ↑
 532  532  typedef struct scsa2usb_cmd {
 533  533          struct scsi_pkt         *cmd_pkt;               /* copy of pkt ptr */
 534  534          struct  buf             *cmd_bp;                /* copy of bp ptr */
 535  535          size_t                  cmd_xfercount;          /* current xfer count */
 536  536          size_t                  cmd_resid_xfercount;    /* last xfer resid */
 537  537          int                     cmd_scblen;             /* status length */
 538  538          int                     cmd_tag;                /* tag */
 539  539          int                     cmd_timeout;            /* copy of pkt_time */
 540  540          uchar_t                 cmd_cdb[SCSI_CDB_SIZE]; /* CDB */
 541  541          uchar_t                 cmd_dir;                /* direction */
 542      -        uchar_t                 cmd_actual_len;         /* cdb len */
      542 +        uchar_t                 cmd_actual_len;         /* cdb len */
 543  543          uchar_t                 cmd_cdblen;             /* requested  cdb len */
 544  544          struct scsi_arq_status  cmd_scb;                /* status, w/ arq */
 545  545  
 546  546          /* used in multiple xfers */
 547  547          size_t                  cmd_total_xfercount;    /* total xfer val */
 548  548          size_t                  cmd_offset;             /* offset into buf */
 549  549          int                     cmd_lba;                /* current xfer lba */
 550  550          int                     cmd_done;               /* command done? */
 551  551          int                     cmd_blksize;            /* block size */
 552  552          usba_list_entry_t       cmd_waitQ;              /* waitQ element */
↓ open down ↓ 95 lines elided ↑ open up ↑
 648  648  #define DPRINT_MASK_EVENTS      0x0004          /* for event handling */
 649  649  #define DPRINT_MASK_CALLBACKS   0x0008          /* for callbacks  */
 650  650  #define DPRINT_MASK_TIMEOUT     0x0010          /* for timeouts */
 651  651  #define DPRINT_MASK_DUMPING     0x0020          /* for dumping */
 652  652  #define DPRINT_MASK_PM          0x0040          /* for pwr mgmt */
 653  653  #define DPRINT_MASK_ALL         0xffffffff      /* for everything */
 654  654  
 655  655  #ifdef  DEBUG
 656  656  #define SCSA2USB_PRINT_CDB      scsa2usb_print_cdb
 657  657  #else
 658      -#define SCSA2USB_PRINT_CDB      0 &&
      658 +#define SCSA2USB_PRINT_CDB(...)
 659  659  #endif
 660  660  
 661  661  /* ugen support */
 662  662  #define SCSA2USB_MINOR_UGEN_BITS_MASK   0xff
 663  663  #define SCSA2USB_MINOR_INSTANCE_MASK    ~SCSA2USB_MINOR_UGEN_BITS_MASK
 664  664  #define SCSA2USB_MINOR_INSTANCE_SHIFT   8
 665  665  
 666  666  #define SCSA2USB_MINOR_TO_INSTANCE(minor)       \
 667  667                  (((minor) & SCSA2USB_MINOR_INSTANCE_MASK) >> \
 668  668                  SCSA2USB_MINOR_INSTANCE_SHIFT)
 669  669  
 670  670  #ifdef __cplusplus
 671  671  }
 672  672  #endif
 673  673  
 674  674  #endif  /* _SYS_USB_SCSA2USB_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX