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/hptnr/os_bsd.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 /* $Id: os_bsd.h,v 1.20 2010/05/11 03:12:11 lcn Exp $ */
    2 /*-
    3  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    4  *
    5  * HighPoint RAID Driver for FreeBSD
    6  * Copyright (C) 2005-2011 HighPoint Technologies, Inc. All Rights Reserved.
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  * 1. Redistributions of source code must retain the above copyright
   13  *    notice, this list of conditions and the following disclaimer.
   14  * 2. Redistributions in binary form must reproduce the above copyright
   15  *    notice, this list of conditions and the following disclaimer in the
   16  *    documentation and/or other materials provided with the distribution.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28  * SUCH DAMAGE.
   29  *
   30  * $FreeBSD$
   31  */
   32 
   33 #include <dev/hptnr/hptnr_config.h>
   34 
   35 #ifndef _OS_BSD_H
   36 #define _OS_BSD_H
   37 
   38 #ifndef DBG
   39 #define  DBG    0
   40 #endif
   41 
   42 #include <sys/param.h>
   43 #include <sys/types.h>
   44 #include <sys/cons.h>
   45 #include <sys/time.h>
   46 #include <sys/systm.h> 
   47 
   48 #include <sys/stat.h>
   49 #include <sys/malloc.h>
   50 #include <sys/conf.h>
   51 #include <sys/libkern.h>
   52 #include <sys/kernel.h>
   53 
   54 #include <sys/kthread.h>
   55 #include <sys/mutex.h>
   56 #include <sys/module.h>
   57 
   58 #include <sys/eventhandler.h>
   59 #include <sys/bus.h>
   60 #include <sys/taskqueue.h>
   61 #include <sys/ioccom.h>
   62 
   63 #include <machine/resource.h>
   64 #include <machine/pci_cfgreg.h>
   65 #include <machine/bus.h>
   66 #include <machine/stdarg.h>
   67 #include <sys/rman.h>
   68 
   69 #include <vm/vm.h>
   70 #include <vm/pmap.h>
   71 
   72 #include <dev/pci/pcireg.h>
   73 #include <dev/pci/pcivar.h>
   74 
   75 #include <cam/cam.h>
   76 #include <cam/cam_ccb.h>
   77 #include <cam/cam_sim.h>
   78 #include <cam/cam_xpt_sim.h>
   79 #include <cam/cam_debug.h>
   80 #include <cam/cam_xpt_periph.h>
   81 #include <cam/cam_periph.h>
   82 #include <cam/scsi/scsi_all.h>
   83 #include <cam/scsi/scsi_message.h>
   84 
   85 
   86 typedef struct _INQUIRYDATA {
   87         u_char DeviceType : 5;
   88         u_char DeviceTypeQualifier : 3;
   89         u_char DeviceTypeModifier : 7;
   90         u_char RemovableMedia : 1;
   91         u_char Versions;
   92         u_char ResponseDataFormat;
   93         u_char AdditionalLength;
   94         u_char Reserved[2];
   95         u_char SoftReset : 1;
   96         u_char CommandQueue : 1;
   97         u_char Reserved2 : 1;
   98         u_char LinkedCommands : 1;
   99         u_char Synchronous : 1;
  100         u_char Wide16Bit : 1;
  101         u_char Wide32Bit : 1;
  102         u_char RelativeAddressing : 1;
  103         u_char VendorId[8];
  104         u_char ProductId[16];
  105         u_char ProductRevisionLevel[4];
  106         u_char VendorSpecific[20];
  107         u_char Reserved3[40];
  108 } 
  109 __attribute__((packed))
  110 INQUIRYDATA, *PINQUIRYDATA;
  111 
  112 #endif
  113 
  114 /* private headers */
  115 
  116 #include <dev/hptnr/osm.h>
  117 #include <dev/hptnr/him.h>
  118 #include <dev/hptnr/ldm.h>
  119 
  120 /* driver parameters */
  121 extern const char driver_name[];
  122 extern const char driver_name_long[];
  123 extern const char driver_ver[];
  124 extern int  osm_max_targets;
  125 
  126 /*
  127  * adapter/vbus extensions:
  128  * each physical controller has an adapter_ext, passed to him.create_adapter()
  129  * each vbus has a vbus_ext passed to ldm_create_vbus().
  130  */
  131 #define EXT_TYPE_HBA  1
  132 #define EXT_TYPE_VBUS 2
  133 
  134 typedef struct _hba {
  135         int               ext_type;
  136         LDM_ADAPTER       ldm_adapter;
  137         device_t          pcidev;
  138         PCI_ADDRESS       pciaddr;
  139         struct _vbus_ext *vbus_ext;
  140         struct _hba      *next;
  141         
  142         struct {
  143                 struct resource *res;
  144                 int type;
  145                 int rid;
  146                 void *base;
  147         }
  148         pcibar[6];
  149 
  150         struct resource  *irq_res;
  151         void             *irq_handle;
  152 }
  153 HBA, *PHBA;
  154 
  155 typedef struct _os_cmdext {
  156         struct _vbus_ext  *vbus_ext;
  157         struct _os_cmdext *next;
  158         union ccb         *ccb;
  159         bus_dmamap_t       dma_map;
  160         struct callout     timeout;
  161         SG                 psg[os_max_sg_descriptors];
  162 }
  163 OS_CMDEXT, *POS_CMDEXT;
  164 
  165 typedef struct _vbus_ext {
  166         int               ext_type;
  167         struct _vbus_ext *next;
  168         PHBA              hba_list;
  169         struct freelist  *freelist_head;
  170         struct freelist  *freelist_dma_head;
  171         
  172         struct cam_sim   *sim;    /* sim for this vbus */
  173         struct cam_path  *path;   /* peripheral, path, tgt, lun with this vbus */
  174         struct mtx        lock; /* general purpose lock */
  175         bus_dma_tag_t     io_dmat; /* I/O buffer DMA tag */
  176         
  177         POS_CMDEXT        cmdext_list;
  178 
  179         OSM_TASK         *tasks;
  180         struct task       worker;
  181         
  182         struct callout    timer;
  183 
  184         eventhandler_tag  shutdown_eh;
  185         
  186         /* the LDM vbus instance continues */
  187         unsigned long vbus[0] __attribute__((aligned(sizeof(unsigned long))));
  188 }
  189 VBUS_EXT, *PVBUS_EXT;
  190 
  191 #define hpt_lock_vbus(vbus_ext)   mtx_lock(&(vbus_ext)->lock)
  192 #define hpt_unlock_vbus(vbus_ext) mtx_unlock(&(vbus_ext)->lock)
  193 #define hpt_assert_vbus_locked(vbus_ext)        mtx_assert(&(vbus_ext)->lock, MA_OWNED)
  194 
  195 
  196 #define HPT_OSM_TIMEOUT (120*hz)  /* timeout value for OS commands */
  197 
  198 #define HPT_DO_IOCONTROL        _IOW('H', 0, HPT_IOCTL_PARAM)
  199 
  200 #define HPT_SCAN_BUS            _IO('H', 1)
  201 
  202 #define TASK_ENQUEUE(task)      taskqueue_enqueue(taskqueue_swi,(task));
  203 
  204 static  __inline        int hpt_sleep(PVBUS_EXT vbus_ext, void *ident, int priority, const char *wmesg, int timo)
  205 {
  206         return  msleep(ident, &vbus_ext->lock, priority, wmesg, timo);
  207 }

Cache object: 73be124d9b506dde2ac8292daf9bfc3c


[ 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.