The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/twa/tw_cl_share.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2004-05 Applied Micro Circuits Corporation.
    3  * Copyright (c) 2004-05 Vinod Kashyap
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  *      $FreeBSD: releng/6.0/sys/dev/twa/tw_cl_share.h 144966 2005-04-12 22:07:11Z vkashyap $
   28  */
   29 
   30 /*
   31  * AMCC'S 3ware driver for 9000 series storage controllers.
   32  *
   33  * Author: Vinod Kashyap
   34  */
   35 
   36 
   37 
   38 #ifndef TW_CL_SHARE_H
   39 
   40 #define TW_CL_SHARE_H
   41 
   42 
   43 /*
   44  * Macros, structures and functions shared between OSL and CL,
   45  * and defined by CL.
   46  */
   47 
   48 
   49 #define TW_CL_VERSION_STRING            "1.00.00.007"
   50 
   51 #define TW_CL_NULL                      ((TW_VOID *)0)
   52 #define TW_CL_TRUE                      1
   53 #define TW_CL_FALSE                     0
   54 
   55 #define TW_CL_VENDOR_ID                 0x13C1  /* 3ware vendor id */
   56 #define TW_CL_DEVICE_ID_9K              0x1002  /* 9000 series device id */
   57 
   58 #define TW_CL_MAX_NUM_UNITS             16      /* max # of units we support */
   59 #define TW_CL_MAX_NUM_LUNS              16      /* max # of LUN's we support */
   60 #define TW_CL_MAX_IO_SIZE               0x20000 /* 128K */
   61 
   62 /*
   63  * Though we can support 256 simultaneous requests, we advertise as capable
   64  * of supporting only 255, since we want to keep one CL internal request
   65  * context packet always available for internal requests.
   66  */
   67 #define TW_CL_MAX_SIMULTANEOUS_REQUESTS 0xFF    /* max simult reqs supported */
   68 
   69 #define TW_CL_MAX_32BIT_SG_ELEMENTS     109     /* max 32-bit sg elements */
   70 #define TW_CL_MAX_64BIT_SG_ELEMENTS     72      /* max 64-bit sg elements */
   71 
   72 
   73 /* Possible values of ctlr->flags */
   74 #define TW_CL_64BIT_ADDRESSES   (1<<0) /* 64 bit cmdpkt & SG addresses */
   75 #define TW_CL_64BIT_SG_LENGTH   (1<<1) /* 64 bit SG length */
   76 #define TW_CL_START_CTLR_ONLY   (1<<2) /* Start ctlr only */
   77 #define TW_CL_STOP_CTLR_ONLY    (1<<3) /* Stop ctlr only */
   78 #define TW_CL_FLASH_FIRMWARE    (1<<4) /* Flash firmware */
   79 
   80 /* Possible error values from the Common Layer. */
   81 #define TW_CL_ERR_REQ_SUCCESS                   0
   82 #define TW_CL_ERR_REQ_GENERAL_FAILURE           (1<<0)
   83 #define TW_CL_ERR_REQ_INVALID_TARGET            (1<<1)
   84 #define TW_CL_ERR_REQ_INVALID_LUN               (1<<2)
   85 #define TW_CL_ERR_REQ_SCSI_ERROR                (1<<3)
   86 #define TW_CL_ERR_REQ_AUTO_SENSE_VALID          (1<<4)
   87 #define TW_CL_ERR_REQ_BUS_RESET                 (1<<5)
   88 #define TW_CL_ERR_REQ_UNABLE_TO_SUBMIT_COMMAND  (1<<6)
   89 
   90 
   91 /* Possible values of req_pkt->flags */
   92 #ifndef TW_OSL_NON_DMA_MEM_ALLOC_PER_REQUEST
   93 #define TW_CL_REQ_RETRY_ON_BUSY         (1<<0)
   94 #endif /* TW_OSL_NON_DMA_MEM_ALLOC_PER_REQUEST */
   95 #define TW_CL_REQ_CALLBACK_FOR_SGLIST   (1<<1)
   96 
   97 
   98 #define TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR   3
   99 #define TW_CL_MESSAGE_SOURCE_CONTROLLER_EVENT   4
  100 #define TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR 21
  101 #define TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT 22
  102 #define TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER     5
  103 #define TW_CL_MESSAGE_SOURCE_FREEBSD_OS         8
  104 #define TW_CL_MESSAGE_SOURCE_WINDOWS_DRIVER     7
  105 #define TW_CL_MESSAGE_SOURCE_WINDOWS_OS         10
  106 
  107 #define TW_CL_SEVERITY_ERROR            0x1
  108 #define TW_CL_SEVERITY_WARNING          0x2
  109 #define TW_CL_SEVERITY_INFO             0x3
  110 #define TW_CL_SEVERITY_DEBUG            0x4
  111 
  112 #define TW_CL_SEVERITY_ERROR_STRING     "ERROR"
  113 #define TW_CL_SEVERITY_WARNING_STRING   "WARNING"
  114 #define TW_CL_SEVERITY_INFO_STRING      "INFO"
  115 #define TW_CL_SEVERITY_DEBUG_STRING     "DEBUG"
  116 
  117 
  118 #pragma pack(1)
  119 
  120 /*
  121  * Structure, a pointer to which is used as the controller handle in
  122  * communications between the OS Layer and the Common Layer.
  123  */
  124 struct tw_cl_ctlr_handle {
  125         TW_VOID *osl_ctlr_ctxt; /* OSL's ctlr context */
  126         TW_VOID *cl_ctlr_ctxt;  /* CL's ctlr context */
  127 };
  128 
  129 
  130 /*
  131  * Structure, a pointer to which is used as the request handle in
  132  * communications between the OS Layer and the Common Layer.
  133  */
  134 struct tw_cl_req_handle {
  135         TW_VOID *osl_req_ctxt;  /* OSL's request context */
  136         TW_VOID *cl_req_ctxt;   /* CL's request context */
  137 };
  138 
  139 
  140 /* Structure used to describe SCSI requests to CL. */
  141 struct tw_cl_scsi_req_packet {
  142         TW_UINT32       unit;           /* unit # to send cmd to */
  143         TW_UINT32       lun;            /* LUN to send cmd to */
  144         TW_UINT8        *cdb;           /* ptr to SCSI cdb */
  145         TW_UINT32       cdb_len;        /* # of valid cdb bytes */
  146         TW_UINT32       sense_len;      /* # of bytes of valid sense info */
  147         TW_UINT8        *sense_data;    /* ptr to sense data, if any */
  148         TW_UINT32       scsi_status;    /* SCSI status returned by fw */
  149         TW_UINT32       sgl_entries;    /* # of SG descriptors */
  150         TW_UINT8        *sg_list;       /* ptr to SG list */
  151 };
  152 
  153 
  154 /* Structure used to describe pass through command packets to CL. */
  155 struct tw_cl_passthru_req_packet {
  156         TW_UINT8        *cmd_pkt;       /* ptr to passthru cmd pkt */
  157         TW_UINT32       cmd_pkt_length; /* size of cmd pkt */
  158         TW_UINT32       sgl_entries;    /* # of SG descriptors */
  159         TW_UINT8        *sg_list;       /* ptr to SG list */
  160 };
  161 
  162 
  163 /* Request packet submitted to the Common Layer, by the OS Layer. */
  164 struct tw_cl_req_packet {
  165         TW_UINT32       cmd;            /* Common Layer cmd */
  166         TW_UINT32       flags;          /* flags describing request */
  167         TW_UINT32       status;         /* Common Layer returned status */
  168         TW_VOID         (*tw_osl_callback)(struct tw_cl_req_handle *req_handle);
  169                         /* OSL routine to be called by CL on req completion */
  170         TW_VOID         (*tw_osl_sgl_callback)(
  171                         struct tw_cl_req_handle *req_handle, TW_VOID *sg_list,
  172                         TW_UINT32 *num_sgl_entries);
  173                         /* OSL callback to get SG list. */
  174 
  175 #ifdef TW_OSL_DMA_MEM_ALLOC_PER_REQUEST
  176 
  177         TW_VOID         *dma_mem;
  178         TW_UINT64       dma_mem_phys;
  179 
  180 #endif /* TW_OSL_DMA_MEM_ALLOC_PER_REQUEST */
  181 
  182 #ifdef TW_OSL_NON_DMA_MEM_ALLOC_PER_REQUEST
  183 
  184         TW_VOID         *non_dma_mem;
  185 
  186 #endif /* TW_OSL_NON_DMA_MEM_ALLOC_PER_REQUEST */
  187 
  188         union {
  189                 struct tw_cl_scsi_req_packet            scsi_req; /* SCSI req */
  190                 struct tw_cl_passthru_req_packet        pt_req;/*Passthru req*/
  191         } gen_req_pkt;
  192 };
  193 
  194 
  195 /*
  196  * Packet that describes an AEN/error generated by the controller,
  197  * Common Layer, or even the OS Layer.
  198  */
  199 struct tw_cl_event_packet {
  200         TW_UINT32       sequence_id;
  201         TW_UINT32       time_stamp_sec;
  202         TW_UINT16       aen_code;
  203         TW_UINT8        severity;
  204         TW_UINT8        retrieved;
  205         TW_UINT8        repeat_count;
  206         TW_UINT8        parameter_len;
  207         TW_UINT8        parameter_data[98];
  208         TW_UINT32       event_src;
  209         TW_UINT8        severity_str[20];
  210 };
  211 
  212 
  213 /* Structure to link 2 adjacent elements in a list. */
  214 struct tw_cl_link {
  215         struct tw_cl_link       *next;
  216         struct tw_cl_link       *prev;
  217 };
  218 
  219 
  220 /* Scatter/Gather list entry with 32 bit addresses. */
  221 struct tw_cl_sg_desc32 {
  222         TW_UINT32       address;
  223         TW_UINT32       length;
  224 };
  225 
  226 
  227 /* Scatter/Gather list entry with 64 bit addresses. */
  228 struct tw_cl_sg_desc64 {
  229         TW_UINT64       address;
  230         TW_UINT32       length;
  231 };
  232 
  233 #pragma pack()
  234 
  235 
  236 /* Byte swap functions.  Valid only if running on big endian platforms. */
  237 #ifdef TW_OSL_BIG_ENDIAN
  238 
  239 #define TW_CL_SWAP16_WITH_CAST(x)                                       \
  240         ((x << 8) | (x >> 8))
  241 
  242 
  243 #define TW_CL_SWAP32_WITH_CAST(x)                                       \
  244         ((x << 24) | ((x << 8) & (0xFF0000)) |                          \
  245         ((x >> 8) & (0xFF00)) | (x >> 24))
  246 
  247 
  248 #define TW_CL_SWAP64_WITH_CAST(x)                                       \
  249         ((((TW_UINT64)(TW_CL_SWAP32(((TW_UINT32 *)(&(x)))[1]))) << 32) |\
  250         ((TW_UINT32)(TW_CL_SWAP32(((TW_UINT32 *)(&(x)))[0]))))
  251 
  252 
  253 #else /* TW_OSL_BIG_ENDIAN */
  254 
  255 #define TW_CL_SWAP16_WITH_CAST(x)       x
  256 #define TW_CL_SWAP32_WITH_CAST(x)       x
  257 #define TW_CL_SWAP64_WITH_CAST(x)       x
  258 
  259 #endif /* TW_OSL_BIG_ENDIAN */
  260 
  261 #define TW_CL_SWAP16(x)         TW_CL_SWAP16_WITH_CAST((TW_UINT16)(x))
  262 #define TW_CL_SWAP32(x)         TW_CL_SWAP32_WITH_CAST((TW_UINT32)(x))
  263 #define TW_CL_SWAP64(x)         TW_CL_SWAP64_WITH_CAST((TW_UINT64)(x))
  264 
  265 
  266 /* Queue manipulation functions. */
  267 
  268 /* Initialize a queue. */
  269 #define TW_CL_Q_INIT(head)      do {            \
  270         (head)->prev = (head)->next = head;     \
  271 } while (0)
  272 
  273 
  274 /* Insert an item at the head of the queue. */
  275 #define TW_CL_Q_INSERT_HEAD(head, item) do {    \
  276         (item)->next = (head)->next;            \
  277         (item)->prev = head;                    \
  278         (head)->next->prev = item;              \
  279         (head)->next = item;                    \
  280 } while (0)
  281 
  282 
  283 /* Insert an item at the tail of the queue. */
  284 #define TW_CL_Q_INSERT_TAIL(head, item) do {    \
  285         (item)->next = head;                    \
  286         (item)->prev = (head)->prev;            \
  287         (head)->prev->next = item;              \
  288         (head)->prev = item;                    \
  289 } while (0)
  290 
  291 
  292 /* Remove an item from the head of the queue. */
  293 #define TW_CL_Q_REMOVE_ITEM(head, item) do {    \
  294         (item)->prev->next = (item)->next;      \
  295         (item)->next->prev = (item)->prev;      \
  296 } while (0)
  297 
  298 
  299 /* Retrieve the item at the head of the queue. */
  300 #define TW_CL_Q_FIRST_ITEM(head)                \
  301         (((head)->next != head) ? ((head)->next) : TW_CL_NULL)
  302 
  303 
  304 /* Retrieve the item at the tail of the queue. */
  305 #define TW_CL_Q_LAST_ITEM(head)                 \
  306         (((head)->prev != head) ? ((head)->prev) : TW_CL_NULL)
  307 
  308 
  309 /* Retrieve the item next to a given item in the queue. */
  310 #define TW_CL_Q_NEXT_ITEM(head, item)           \
  311         (((item)->next != head) ? ((item)->next) : TW_CL_NULL)
  312 
  313 
  314 /* Retrieve the item previous to a given item in the queue. */
  315 #define TW_CL_Q_PREV_ITEM(head, item)           \
  316         (((item)->prev != head) ? ((item)->prev) : TW_CL_NULL)
  317 
  318 
  319 /* Determine the offset of a field from the head of the structure it is in. */
  320 #define TW_CL_STRUCT_OFFSET(struct_type, field) \
  321         (TW_INT8 *)(&((struct_type *)0)->field)
  322 
  323 
  324 /*
  325  * Determine the address of the head of a structure, given the address of a
  326  * field within it.
  327  */
  328 #define TW_CL_STRUCT_HEAD(addr, struct_type, field)     \
  329         (struct_type *)((TW_INT8 *)addr -               \
  330         TW_CL_STRUCT_OFFSET(struct_type, field))
  331 
  332 
  333 
  334 /*
  335  * The following are extern declarations of OS Layer defined functions called
  336  * by the Common Layer.  If any function has been defined as a macro in
  337  * tw_osl_share.h, we will not make the extern declaration here.
  338  */
  339 
  340 #ifndef tw_osl_breakpoint
  341 /* Allows setting breakpoints in the CL code for debugging purposes. */
  342 extern TW_VOID  tw_osl_breakpoint(TW_VOID);
  343 #endif
  344 
  345 
  346 #ifndef tw_osl_ctlr_ready
  347 /* Called on cmd interrupt.  Allows re-submission of any pending requests. */
  348 extern TW_VOID  tw_osl_ctlr_ready(struct tw_cl_ctlr_handle *ctlr_handle);
  349 #endif
  350 
  351 
  352 #ifndef tw_osl_cur_func
  353 /* Text name of current function. */
  354 extern TW_INT8  *tw_osl_cur_func(TW_VOID);
  355 #endif
  356 
  357 
  358 #ifdef TW_OSL_DEBUG
  359 #ifndef tw_osl_dbg_printf
  360 /* Print to syslog/event log/debug console, as applicable. */
  361 extern TW_INT32 tw_osl_dbg_printf(struct tw_cl_ctlr_handle *ctlr_handle,
  362         const TW_INT8 *fmt, ...);
  363 #endif
  364 #endif /* TW_OSL_DEBUG */
  365 
  366 
  367 #ifndef tw_osl_delay
  368 /* Cause a delay of usecs micro-seconds. */
  369 extern TW_VOID  tw_osl_delay(TW_INT32 usecs);
  370 #endif
  371 
  372 
  373 #ifndef tw_osl_destroy_lock
  374 /* Create/initialize a lock for CL's use. */
  375 extern TW_VOID  tw_osl_destroy_lock(struct tw_cl_ctlr_handle *ctlr_handle,
  376         TW_LOCK_HANDLE *lock);
  377 #endif
  378 
  379 
  380 #ifndef tw_osl_free_lock
  381 /* Free a previously held lock. */
  382 extern TW_VOID  tw_osl_free_lock(struct tw_cl_ctlr_handle *ctlr_handle,
  383         TW_LOCK_HANDLE *lock);
  384 #endif
  385 
  386 
  387 #ifndef tw_osl_get_local_time
  388 /* Get local time. */
  389 extern TW_TIME  tw_osl_get_local_time(TW_VOID);
  390 #endif
  391 
  392 
  393 #ifndef tw_osl_get_lock
  394 /* Acquire a lock. */
  395 extern TW_VOID  tw_osl_get_lock(struct tw_cl_ctlr_handle *ctlr_handle,
  396         TW_LOCK_HANDLE *lock);
  397 #endif
  398 
  399 
  400 #ifndef tw_osl_init_lock
  401 /* Create/initialize a lock for CL's use. */
  402 extern TW_VOID  tw_osl_init_lock(struct tw_cl_ctlr_handle *ctlr_handle,
  403         TW_INT8 *lock_name, TW_LOCK_HANDLE *lock);
  404 #endif
  405 
  406 
  407 #ifndef tw_osl_memcpy
  408 /* Copy 'size' bytes from 'src' to 'dest'. */
  409 extern TW_VOID  tw_osl_memcpy(TW_VOID *src, TW_VOID *dest, TW_INT32 size);
  410 #endif
  411 
  412 
  413 #ifndef tw_osl_memzero
  414 /* Zero 'size' bytes starting at 'addr'. */
  415 extern TW_VOID  tw_osl_memzero(TW_VOID *addr, TW_INT32 size);
  416 #endif
  417 
  418 
  419 #ifndef tw_osl_notify_event
  420 /* Notify OSL of a controller/CL (or even OSL) event. */
  421 extern TW_VOID  tw_osl_notify_event(struct tw_cl_ctlr_handle *ctlr_handle,
  422         struct tw_cl_event_packet *event);
  423 #endif
  424 
  425 
  426 #ifdef TW_OSL_PCI_CONFIG_ACCESSIBLE
  427 #ifndef tw_osl_read_pci_config
  428 /* Read 'size' bytes from 'offset' in the PCI config space. */
  429 extern TW_UINT32 tw_osl_read_pci_config(
  430         struct tw_cl_ctlr_handle *ctlr_handle, TW_INT32 offset, TW_INT32 size);
  431 #endif
  432 #endif /* TW_OSL_PCI_CONFIG_ACCESSIBLE */
  433 
  434 
  435 #ifndef tw_osl_read_reg
  436 /* Read 'size' bytes at 'offset' from base address of this controller. */
  437 extern TW_UINT32 tw_osl_read_reg(struct tw_cl_ctlr_handle *ctlr_handle,
  438         TW_INT32 offset, TW_INT32 size);
  439 #endif
  440 
  441 
  442 #ifndef tw_osl_scan_bus
  443 /* Request OSL for a bus scan. */
  444 extern TW_VOID  tw_osl_scan_bus(struct tw_cl_ctlr_handle *ctlr_handle);
  445 #endif
  446 
  447 
  448 #ifdef TW_OSL_CAN_SLEEP
  449 #ifndef tw_osl_sleep
  450 /* Sleep for 'timeout' ms or until woken up (by tw_osl_wakeup). */
  451 extern TW_INT32 tw_osl_sleep(struct tw_cl_ctlr_handle *ctlr_handle,
  452         TW_SLEEP_HANDLE *sleep_handle, TW_INT32 timeout);
  453 #endif
  454 #endif /* TW_OSL_CAN_SLEEP */
  455 
  456 
  457 #ifndef tw_osl_sprintf
  458 /* Standard sprintf. */
  459 extern TW_INT32 tw_osl_sprintf(TW_INT8 *dest, const TW_INT8 *fmt, ...);
  460 #endif
  461 
  462 
  463 #ifndef tw_osl_strcpy
  464 /* Copy string 'src' to 'dest'. */
  465 extern TW_INT8  *tw_osl_strcpy(TW_INT8 *dest, TW_INT8 *src);
  466 #endif
  467 
  468 
  469 #ifndef tw_osl_strlen
  470 /* Return length of string pointed at by 'str'. */
  471 extern TW_INT32 tw_osl_strlen(TW_VOID *str);
  472 #endif
  473 
  474 
  475 #ifdef TW_OSL_CAN_SLEEP
  476 #ifndef tw_osl_wakeup
  477 /* Wake up a thread sleeping by a call to tw_osl_sleep. */
  478 extern TW_VOID  tw_osl_wakeup(struct tw_cl_ctlr_handle *ctlr_handle,
  479         TW_SLEEP_HANDLE *sleep_handle);
  480 #endif
  481 #endif /* TW_OSL_CAN_SLEEP */
  482 
  483 
  484 #ifdef TW_OSL_PCI_CONFIG_ACCESSIBLE
  485 #ifndef tw_osl_write_pci_config
  486 /* Write 'value' of 'size' bytes at 'offset' in the PCI config space. */
  487 extern TW_VOID  tw_osl_write_pci_config(struct tw_cl_ctlr_handle *ctlr_handle,
  488         TW_INT32 offset, TW_INT32 value, TW_INT32 size);
  489 #endif
  490 #endif /* TW_OSL_PCI_CONFIG_ACCESSIBLE */
  491 
  492 
  493 #ifndef tw_osl_write_reg
  494 /*
  495  * Write 'value' of 'size' (max 4) bytes at 'offset' from base address of
  496  * this controller.
  497  */
  498 extern TW_VOID  tw_osl_write_reg(struct tw_cl_ctlr_handle *ctlr_handle,
  499         TW_INT32 offset, TW_INT32 value, TW_INT32 size);
  500 #endif
  501 
  502 
  503 
  504 /* Functions in the Common Layer */
  505 
  506 /* Creates and queues AEN's.  Also notifies OS Layer. */
  507 extern TW_VOID tw_cl_create_event(struct tw_cl_ctlr_handle *ctlr_handle,
  508         TW_UINT8 queue_event, TW_UINT8 event_src, TW_UINT16 event_code,
  509         TW_UINT8 severity, TW_UINT8 *severity_str, TW_UINT8 *event_desc,
  510         TW_UINT8 *event_specific_desc, ...);
  511 
  512 /* Indicates whether a ctlr is supported by CL. */
  513 extern TW_INT32 tw_cl_ctlr_supported(TW_INT32 vendor_id, TW_INT32 device_id);
  514 
  515 
  516 /* Deferred interrupt handler. */
  517 extern TW_VOID  tw_cl_deferred_interrupt(struct tw_cl_ctlr_handle *ctlr_handle);
  518 
  519 
  520 /* Submit a firmware cmd packet. */
  521 extern TW_INT32 tw_cl_fw_passthru(struct tw_cl_ctlr_handle *ctlr_handle,
  522         struct tw_cl_req_packet *req_pkt, struct tw_cl_req_handle *req_handle);
  523 
  524 
  525 /* Find out how much memory CL needs. */
  526 extern TW_INT32 tw_cl_get_mem_requirements(
  527         struct tw_cl_ctlr_handle *ctlr_handle, TW_UINT32 flags,
  528         TW_INT32 max_simult_reqs, TW_INT32 max_aens,
  529         TW_UINT32 *alignment, TW_UINT32 *sg_size_factor,
  530         TW_UINT32 *non_dma_mem_size, TW_UINT32 *dma_mem_size
  531 #ifdef TW_OSL_FLASH_FIRMWARE
  532         , TW_UINT32 *flash_dma_mem_size
  533 #endif /* TW_OSL_FLASH_FIRMWARE */
  534 #ifdef TW_OSL_DMA_MEM_ALLOC_PER_REQUEST
  535         , TW_UINT32 *per_req_dma_mem_size
  536 #endif /* TW_OSL_DMA_MEM_ALLOC_PER_REQUEST */
  537 #ifdef TW_OSL_NON_DMA_MEM_ALLOC_PER_REQUEST
  538         , TW_UINT32 *per_req_non_dma_mem_size
  539 #endif /* TW_OSL_N0N_DMA_MEM_ALLOC_PER_REQUEST */
  540         );
  541 
  542 
  543 /* Initialize Common Layer for a given controller. */
  544 extern TW_INT32 tw_cl_init_ctlr(struct tw_cl_ctlr_handle *ctlr_handle,
  545         TW_UINT32 flags, TW_INT32 max_simult_reqs, TW_INT32 max_aens,
  546         TW_VOID *non_dma_mem, TW_VOID *dma_mem, TW_UINT64 dma_mem_phys
  547 #ifdef TW_OSL_FLASH_FIRMWARE
  548         , TW_VOID *flash_dma_mem, TW_UINT64 flash_dma_mem_phys
  549 #endif /* TW_OSL_FLASH_FIRMWARE */
  550         );
  551 
  552 
  553 /* CL's interrupt handler. */
  554 extern TW_INT32 tw_cl_interrupt(struct tw_cl_ctlr_handle *ctlr_handle);
  555 
  556 
  557 /* CL's ioctl handler. */
  558 extern TW_INT32 tw_cl_ioctl(struct tw_cl_ctlr_handle *ctlr_handle,
  559         TW_INT32 cmd, TW_VOID *buf);
  560 
  561 
  562 #ifdef TW_OSL_DEBUG
  563 /* Print CL's state/statistics for a controller. */
  564 extern TW_VOID  tw_cl_print_ctlr_stats(struct tw_cl_ctlr_handle *ctlr_handle);
  565 
  566 /* Prints CL internal details of a given request. */
  567 extern TW_VOID  tw_cl_print_req_info(struct tw_cl_req_handle *req_handle);
  568 #endif /* TW_OSL_DEBUG */
  569 
  570 
  571 /* Soft reset controller. */
  572 extern TW_INT32 tw_cl_reset_ctlr(struct tw_cl_ctlr_handle *ctlr_handle);
  573 
  574 
  575 #ifdef TW_OSL_DEBUG
  576 /* Reset CL's statistics for a controller. */
  577 extern TW_VOID  tw_cl_reset_stats(struct tw_cl_ctlr_handle *ctlr_handle);
  578 #endif /* TW_OSL_DEBUG */
  579 
  580 
  581 /* Stop a controller. */
  582 extern TW_INT32 tw_cl_shutdown_ctlr(struct tw_cl_ctlr_handle *ctlr_handle,
  583         TW_UINT32 flags);
  584 
  585 
  586 /* Submit a SCSI I/O request. */
  587 extern TW_INT32 tw_cl_start_io(struct tw_cl_ctlr_handle *ctlr_handle,
  588         struct tw_cl_req_packet *req_pkt, struct tw_cl_req_handle *req_handle);
  589 
  590 
  591 #endif /* TW_CL_SHARE_H */

Cache object: d52913def45374b6e507f850efa5e424


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.