Print this page
    
NEX-5717 import QLogic 16G FC drivers
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.h
          +++ new/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  
    | 
      ↓ open down ↓ | 
    12 lines elided | 
    
      ↑ open up ↑ | 
  
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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  
  22   22  /*
  23      - * Copyright 2009 QLogic Corporation.  All rights reserved.
       23 + * Copyright 2009-2015 QLogic Corporation.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28      - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
       28 + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  29   29   */
  30   30  
  31   31  #ifndef _QLT_DMA_H
  32   32  #define _QLT_DMA_H
  33   33  
  34   34  #include <sys/stmf.h>
  35   35  
  36   36  #ifdef  __cplusplus
  37   37  extern "C" {
  38   38  #endif
  39   39  
  40   40  /*
  41   41   * DMA memory object.
  42   42   */
  43   43  #define QLT_DMA_SG_LIST_LENGTH  1270
  44   44  #define CMD7_2400_DATA_SEGMENTS 1
  45   45  #define CONT_A64_DATA_SEGMENTS  5
  46   46  
  47   47  
  48   48  /*
  49   49   * Container for ddi_dma_handle
  50   50   *
  51   51   * These elements are either linked to an active dbuf or in the free list.
  52   52   */
  53   53  struct qlt_dma_handle {
  54   54          struct qlt_dma_handle   *next;
  55   55          ddi_dma_handle_t        dma_handle;
  56   56          ddi_dma_cookie_t        first_cookie;
  57   57          uint_t                  num_cookies;
  58   58          uint_t                  num_cookies_fetched;
  59   59  };
  60   60  
  61   61  typedef struct qlt_dma_handle qlt_dma_handle_t;
  62   62  
  63   63  /*
  64   64   * The dbuf private data when using a scatter/gather list.
  65   65   */
  66   66  struct qlt_dma_sgl {
  67   67          uint16_t                handle_count;
  68   68          uint16_t                cookie_count;
  69   69          uint16_t                cookie_next_fetch;
  70   70          uint16_t                cookie_prefetched;
  71   71          qlt_dma_handle_t        *handle_list;
  72   72          qlt_dma_handle_t        *handle_next_fetch;
  73   73          size_t                  qsize;
  74   74          ddi_dma_cookie_t        cookie[1];
  75   75  };
  76   76  
  77   77  typedef struct qlt_dma_sgl qlt_dma_sgl_t;
  78   78  
  79   79  /*
  80   80   * Structure to maintain ddi_dma_handle free pool.
  81   81   */
  82   82  struct qlt_dma_handle_pool {
  83   83          kmutex_t                pool_lock;      /* protects all fields */
  84   84          qlt_dma_handle_t        *free_list;
  85   85          int                     num_free;
  86   86          int                     num_total;
  87   87  };
  88   88  
  89   89  typedef struct qlt_dma_handle_pool qlt_dma_handle_pool_t;
  90   90  
  91   91  struct qlt_dmem_bucket;
  92   92  
  93   93  typedef struct qlt_dmem_bctl {
  94   94          struct qlt_dmem_bucket  *bctl_bucket;
  95   95          struct qlt_dmem_bctl    *bctl_next;
  96   96          uint64_t                bctl_dev_addr;
  97   97          uint8_t                 bctl_task_ndx;  /* notused */
  98   98          stmf_data_buf_t         *bctl_buf;
  99   99  } qlt_dmem_bctl_t;
 100  100  
 101  101  typedef struct qlt_dmem_bucket {
 102  102          uint32_t                dmem_buf_size;
 103  103          uint32_t                dmem_nbufs;
 104  104          uint32_t                dmem_nbufs_free;
 105  105          uint8_t                 *dmem_host_addr;
 106  106          uint64_t                dmem_dev_addr;
 107  107          ddi_dma_handle_t        dmem_dma_handle;
 108  108          ddi_acc_handle_t        dmem_acc_handle;
 109  109          kmutex_t                dmem_lock;
 110  110          qlt_dmem_bctl_t         *dmem_bctl_free_list;
 111  111          void                    *dmem_bctls_mem;
 112  112  } qlt_dmem_bucket_t;
 113  113  
 114  114  fct_status_t qlt_dmem_init(qlt_state_t *qlt);
 115  115  void qlt_dmem_fini(qlt_state_t *qlt);
 116  116  void qlt_dma_handle_pool_init(qlt_state_t *qlt);
 117  117  void qlt_dma_handle_pool_fini(qlt_state_t *qlt);
 118  118  stmf_data_buf_t *qlt_dmem_alloc(fct_local_port_t *port, uint32_t size,
 119  119      uint32_t *pminsize, uint32_t flags);
 120  120  stmf_data_buf_t *qlt_i_dmem_alloc(qlt_state_t *qlt, uint32_t size,
 121  121      uint32_t *pminsize, uint32_t flags);
 122  122  void qlt_dmem_free(fct_dbuf_store_t *fds, stmf_data_buf_t *dbuf);
 123  123  void qlt_i_dmem_free(qlt_state_t *qlt, stmf_data_buf_t *dbuf);
 124  124  stmf_status_t qlt_dma_setup_dbuf(fct_local_port_t *port,
 125  125      stmf_data_buf_t *dbuf, uint32_t flags);
 126  126  void qlt_dma_teardown_dbuf(fct_dbuf_store_t *fds, stmf_data_buf_t *dbuf);
 127  127  void qlt_dmem_dma_sync(stmf_data_buf_t *dbuf, uint_t sync_type);
 128  128  uint8_t qlt_get_iocb_count(uint32_t cookie_cnt);
 129  129  uint64_t qlt_ddi_vtop(caddr_t vaddr);
 130  130  /*
 131  131   * XXX move the following into the fct layer
 132  132   */
 133  133  uint16_t qlt_get_cookie_count(stmf_data_buf_t *dbuf);
 134  134  void qlt_ddi_dma_nextcookie(stmf_data_buf_t *dbuf, ddi_dma_cookie_t *cookie_p);
 135  135  ddi_dma_cookie_t *qlt_get_cookie_array(stmf_data_buf_t *dbuf);
 136  136  
 137  137  
 138  138  #ifdef  __cplusplus
 139  139  }
 140  140  #endif
 141  141  
 142  142  #endif /* _QLT_DMA_H */
  
    | 
      ↓ open down ↓ | 
    104 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX