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/ips/ips.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  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2002 Adaptec Inc.
    5  * All rights reserved.
    6  *
    7  * Written by: David Jeffery
    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 #ifndef _IPS_H
   33 #define _IPS_H
   34 
   35 #ifdef _KERNEL
   36 
   37 #include <sys/param.h>
   38 #include <sys/systm.h>
   39 #include <sys/kernel.h>
   40 #include <sys/module.h>
   41 #include <sys/bus.h>
   42 #include <sys/conf.h>
   43 #include <sys/types.h>
   44 #include <sys/queue.h>
   45 #include <sys/bio.h>
   46 #include <sys/malloc.h>
   47 #include <sys/mutex.h>
   48 #include <sys/sema.h>
   49 #include <sys/time.h>
   50 
   51 #include <machine/bus.h>
   52 #include <sys/rman.h>
   53 #include <machine/resource.h>
   54 
   55 MALLOC_DECLARE(M_IPSBUF);
   56 
   57 /*
   58  *  IPS MACROS
   59  */
   60 
   61 #define ips_read_1(sc,offset)           bus_read_1(sc->iores, offset)
   62 #define ips_read_2(sc,offset)           bus_read_2(sc->iores, offset)
   63 #define ips_read_4(sc,offset)           bus_read_4(sc->iores, offset)
   64 
   65 #define ips_write_1(sc,offset,value)    bus_write_1(sc->iores, offset, value)
   66 #define ips_write_2(sc,offset,value)    bus_write_2(sc->iores, offset, value)
   67 #define ips_write_4(sc,offset,value)    bus_write_4(sc->iores, offset, value)
   68 
   69 /* this is ugly.  It zeros the end elements in an ips_command_t struct starting with the status element */
   70 #define clear_ips_command(command)      bzero(&((command)->status), (unsigned long)(&(command)[1])-(unsigned long)&((command)->status))
   71 
   72 #define ips_read_request(iobuf)         ((iobuf)->bio_cmd == BIO_READ)
   73 
   74 #define COMMAND_ERROR(command)          (((command)->status.fields.basic_status & IPS_GSC_STATUS_MASK) >= IPS_MIN_ERROR)
   75 
   76 #define ips_set_error(command, error)   do {                            \
   77         (command)->status.fields.basic_status = IPS_DRV_ERROR;          \
   78         (command)->status.fields.reserved = ((error) & 0x0f);           \
   79 } while (0)
   80 
   81 #ifndef IPS_DEBUG
   82 #define DEVICE_PRINTF(x...)
   83 #define PRINTF(x...)
   84 #else
   85 #define DEVICE_PRINTF(level,x...)       if(IPS_DEBUG >= level)device_printf(x)
   86 #define PRINTF(level,x...)              if(IPS_DEBUG >= level)printf(x)
   87 #endif
   88 
   89 struct ips_softc;
   90 
   91 typedef struct {
   92         u_int32_t       status[IPS_MAX_CMD_NUM];
   93         u_int32_t       base_phys_addr;
   94         int             nextstatus;
   95         bus_dma_tag_t   dmatag;
   96         bus_dmamap_t    dmamap;
   97 } ips_copper_queue_t;
   98 
   99 /* used to keep track of current commands to the card */
  100 typedef struct ips_command{
  101         u_int8_t                command_number;
  102         u_int8_t                id;
  103         u_int8_t                timeout;
  104         struct ips_softc *      sc;
  105         bus_dma_tag_t           data_dmatag;
  106         bus_dmamap_t            data_dmamap;
  107         bus_dmamap_t            command_dmamap;
  108         void *                  command_buffer;
  109         u_int32_t               command_phys_addr;/*WARNING! must be changed if 64bit addressing ever used*/    
  110         ips_cmd_status_t        status;
  111         SLIST_ENTRY(ips_command)        next;
  112         void *                  data_buffer;
  113         void *                  arg;
  114         void                    (* callback)(struct ips_command *command);
  115 }ips_command_t;
  116 
  117 typedef struct ips_softc{
  118         struct resource *       iores;
  119         struct resource *       irqres;
  120         struct intr_config_hook ips_ich;
  121         int                     configured;
  122         int                     state;
  123         int                     iotype;
  124         int                     rid;
  125         int                     irqrid;
  126         void *                  irqcookie;
  127         bus_dma_tag_t           adapter_dmatag;
  128         bus_dma_tag_t           command_dmatag;
  129         bus_dma_tag_t           sg_dmatag;
  130         device_t                dev;
  131         struct cdev *device_file;
  132         struct callout          timer;
  133         u_int16_t               adapter_type;
  134         ips_adapter_info_t      adapter_info;
  135         device_t                diskdev[IPS_MAX_NUM_DRIVES];
  136         ips_drive_t             drives[IPS_MAX_NUM_DRIVES];
  137         u_int8_t                drivecount;
  138         u_int16_t               ffdc_resetcount;
  139         struct timeval          ffdc_resettime;
  140         u_int8_t                next_drive;
  141         u_int8_t                max_cmds;
  142         volatile u_int8_t       used_commands;
  143         ips_command_t           *commandarray;
  144         ips_command_t           *staticcmd;
  145         SLIST_HEAD(command_list, ips_command) free_cmd_list;
  146         int                     (* ips_adapter_reinit)(struct ips_softc *sc, 
  147                                                        int force);
  148         void                    (* ips_adapter_intr)(void *sc);
  149         void                    (* ips_issue_cmd)(ips_command_t *command);
  150         void                    (* ips_poll_cmd)(ips_command_t *command);
  151         ips_copper_queue_t *    copper_queue;
  152         struct mtx              queue_mtx;
  153         struct bio_queue_head   queue;
  154         struct sema             cmd_sema;
  155 
  156 }ips_softc_t;
  157 
  158 /* function defines from ips_ioctl.c */
  159 extern int ips_ioctl_request(ips_softc_t *sc, u_long ioctl_cmd, caddr_t addr, 
  160                                 int32_t flags);
  161 /* function defines from ips_disk.c */
  162 extern void ipsd_finish(struct bio *iobuf);
  163 
  164 /* function defines from ips_commands.c */
  165 extern int ips_flush_cache(ips_softc_t *sc);
  166 extern void ips_start_io_request(ips_softc_t *sc);
  167 extern int ips_get_drive_info(ips_softc_t *sc);
  168 extern int ips_get_adapter_info(ips_softc_t *sc);
  169 extern int ips_ffdc_reset(ips_softc_t *sc);
  170 extern int ips_update_nvram(ips_softc_t *sc); 
  171 extern int ips_clear_adapter(ips_softc_t *sc);
  172 
  173 /* function defines from ips.c */
  174 extern int ips_get_free_cmd(ips_softc_t *sc, ips_command_t **command, unsigned long flags);
  175 extern void ips_insert_free_cmd(ips_softc_t *sc, ips_command_t *command);
  176 extern int ips_adapter_init(ips_softc_t *sc);
  177 extern int ips_morpheus_reinit(ips_softc_t *sc, int force);
  178 extern int ips_adapter_free(ips_softc_t *sc);
  179 extern void ips_morpheus_intr(void *sc);
  180 extern void ips_issue_morpheus_cmd(ips_command_t *command);
  181 extern void ips_morpheus_poll(ips_command_t *command);
  182 extern int ips_copperhead_reinit(ips_softc_t *sc, int force);
  183 extern void ips_copperhead_intr(void *sc);
  184 extern void ips_issue_copperhead_cmd(ips_command_t *command);
  185 extern void ips_copperhead_poll(ips_command_t *command);
  186 
  187 #endif
  188 #endif

Cache object: c2315bd99f1bd195fb995f6be3fd43bd


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