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/mpr/mpr_ioctl.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) 2008 Yahoo!, Inc.
    3  * All rights reserved.
    4  * Written by: John Baldwin <jhb@FreeBSD.org>
    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  * 3. Neither the name of the author nor the names of any co-contributors
   15  *    may be used to endorse or promote products derived from this software
   16  *    without specific prior written permission.
   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  * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD userland interface
   31  *
   32  * $FreeBSD$
   33  */
   34 /*-
   35  * Copyright (c) 2011-2015 LSI Corp.
   36  * Copyright (c) 2013-2016 Avago Technologies
   37  * All rights reserved.
   38  *
   39  * Redistribution and use in source and binary forms, with or without
   40  * modification, are permitted provided that the following conditions
   41  * are met:
   42  * 1. Redistributions of source code must retain the above copyright
   43  *    notice, this list of conditions and the following disclaimer.
   44  * 2. Redistributions in binary form must reproduce the above copyright
   45  *    notice, this list of conditions and the following disclaimer in the
   46  *    documentation and/or other materials provided with the distribution.
   47  *
   48  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   49  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   50  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   51  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   52  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   53  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   54  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   55  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   56  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   57  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   58  * SUCH DAMAGE.
   59  *
   60  * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
   61  *
   62  * $FreeBSD$
   63  */
   64 
   65 #ifndef _MPR_IOCTL_H_
   66 #define _MPR_IOCTL_H_
   67 
   68 #include <dev/mpr/mpi/mpi2_type.h>
   69 #include <dev/mpr/mpi/mpi2.h>
   70 #include <dev/mpr/mpi/mpi2_cnfg.h>
   71 #include <dev/mpr/mpi/mpi2_sas.h>
   72 
   73 /*
   74  * For the read header requests, the header should include the page
   75  * type or extended page type, page number, and page version.  The
   76  * buffer and length are unused.  The completed header is returned in
   77  * the 'header' member.
   78  *
   79  * For the read page and write page requests, 'buf' should point to a
   80  * buffer of 'len' bytes which holds the entire page (including the
   81  * header).
   82  *
   83  * All requests specify the page address in 'page_address'.
   84  */
   85 struct mpr_cfg_page_req {       
   86         MPI2_CONFIG_PAGE_HEADER header;
   87         uint32_t page_address;
   88         void    *buf;
   89         int     len;
   90         uint16_t ioc_status;
   91 };
   92 
   93 struct mpr_ext_cfg_page_req {
   94         MPI2_CONFIG_EXTENDED_PAGE_HEADER header;
   95         uint32_t page_address;
   96         void    *buf;
   97         int     len;
   98         uint16_t ioc_status;
   99 };
  100 
  101 struct mpr_raid_action {
  102         uint8_t action;
  103         uint8_t volume_bus;
  104         uint8_t volume_id;
  105         uint8_t phys_disk_num;
  106         uint32_t action_data_word;
  107         void *buf;
  108         int len;
  109         uint32_t volume_status;
  110         uint32_t action_data[4];
  111         uint16_t action_status;
  112         uint16_t ioc_status;
  113         uint8_t write;
  114 };
  115 
  116 struct mpr_usr_command {
  117         void *req;
  118         uint32_t req_len;
  119         void *rpl;
  120         uint32_t rpl_len;
  121         void *buf;
  122         int len;
  123         uint32_t flags;
  124 };
  125 
  126 typedef struct mpr_pci_bits
  127 {
  128         union {
  129                 struct {
  130                         uint32_t        DeviceNumber    :5;
  131                         uint32_t        FunctionNumber  :3;
  132                         uint32_t        BusNumber       :24;
  133                 } bits;
  134                 uint32_t        AsDWORD;
  135         } u;
  136         uint32_t        PciSegmentId;
  137 } mpr_pci_bits_t;
  138 
  139 /*
  140  *  The following is the MPRIOCTL_GET_ADAPTER_DATA data structure.  This data
  141  *  structure is setup so that we hopefully are properly aligned for both
  142  *  32-bit and 64-bit mode applications.
  143  *
  144  *  Adapter Type - Value = 6 = SCSI Protocol through SAS-3 adapter
  145  *
  146  *  MPI Port Number - The PCI Function number for this device
  147  *
  148  *  PCI Device HW Id - The PCI device number for this device
  149  *
  150  */
  151 #define MPRIOCTL_ADAPTER_TYPE_SAS3              6
  152 #define MPRIOCTL_ADAPTER_TYPE_SAS35             7
  153 typedef struct mpr_adapter_data
  154 {
  155         uint32_t        StructureLength;
  156         uint32_t        AdapterType;
  157         uint32_t        MpiPortNumber;
  158         uint32_t        PCIDeviceHwId;
  159         uint32_t        PCIDeviceHwRev;
  160         uint32_t        SubSystemId;
  161         uint32_t        SubsystemVendorId;
  162         uint32_t        Reserved1;
  163         uint32_t        MpiFirmwareVersion;
  164         uint32_t        BiosVersion;
  165         uint8_t         DriverVersion[32];
  166         uint8_t         Reserved2;
  167         uint8_t         ScsiId;
  168         uint16_t        Reserved3;
  169         mpr_pci_bits_t  PciInformation;
  170 } mpr_adapter_data_t;
  171 
  172 
  173 typedef struct mpr_update_flash
  174 {
  175         uint64_t        PtrBuffer;
  176         uint32_t        ImageChecksum;
  177         uint32_t        ImageOffset;
  178         uint32_t        ImageSize;
  179         uint32_t        ImageType;
  180 } mpr_update_flash_t;
  181 
  182 
  183 #define MPR_PASS_THRU_DIRECTION_NONE    0
  184 #define MPR_PASS_THRU_DIRECTION_READ    1
  185 #define MPR_PASS_THRU_DIRECTION_WRITE   2
  186 #define MPR_PASS_THRU_DIRECTION_BOTH    3
  187 
  188 typedef struct mpr_pass_thru
  189 {
  190         uint64_t        PtrRequest;
  191         uint64_t        PtrReply;
  192         uint64_t        PtrData;
  193         uint32_t        RequestSize;
  194         uint32_t        ReplySize;
  195         uint32_t        DataSize;
  196         uint32_t        DataDirection;
  197         uint64_t        PtrDataOut;
  198         uint32_t        DataOutSize;
  199         uint32_t        Timeout;
  200 } mpr_pass_thru_t;
  201 
  202 
  203 /*
  204  * Event queue defines
  205  */
  206 #define MPR_EVENT_QUEUE_SIZE            (200) /* Max Events stored in driver */
  207 #define MPR_MAX_EVENT_DATA_LENGTH       (48) /* Size of each event in Dwords */
  208 
  209 typedef struct mpr_event_query
  210 {
  211         uint16_t        Entries;
  212         uint16_t        Reserved;
  213         uint32_t        Types[4];
  214 } mpr_event_query_t;
  215 
  216 typedef struct mpr_event_enable
  217 {
  218         uint32_t        Types[4];
  219 } mpr_event_enable_t;
  220 
  221 /*
  222  * Event record entry for ioctl.
  223  */
  224 typedef struct mpr_event_entry
  225 {
  226         uint32_t        Type;
  227         uint32_t        Number;
  228         uint32_t        Data[MPR_MAX_EVENT_DATA_LENGTH];
  229 } mpr_event_entry_t;
  230 
  231 typedef struct mpr_event_report
  232 {
  233         uint32_t        Size;
  234         uint64_t        PtrEvents;
  235 } mpr_event_report_t;
  236 
  237 
  238 typedef struct mpr_pci_info
  239 {
  240         uint32_t        BusNumber;
  241         uint8_t         DeviceNumber;
  242         uint8_t         FunctionNumber;
  243         uint16_t        InterruptVector;
  244         uint8_t         PciHeader[256];
  245 } mpr_pci_info_t;
  246 
  247 
  248 typedef struct mpr_diag_action
  249 {
  250         uint32_t        Action;
  251         uint32_t        Length;
  252         uint64_t        PtrDiagAction;
  253         uint32_t        ReturnCode;
  254 } mpr_diag_action_t;
  255 
  256 #define MPR_FW_DIAGNOSTIC_UID_NOT_FOUND (0xFF)
  257 
  258 #define MPR_FW_DIAG_NEW                         (0x806E6577)
  259 
  260 #define MPR_FW_DIAG_TYPE_REGISTER               (0x00000001)
  261 #define MPR_FW_DIAG_TYPE_UNREGISTER             (0x00000002)
  262 #define MPR_FW_DIAG_TYPE_QUERY                  (0x00000003)
  263 #define MPR_FW_DIAG_TYPE_READ_BUFFER            (0x00000004)
  264 #define MPR_FW_DIAG_TYPE_RELEASE                (0x00000005)
  265 
  266 #define MPR_FW_DIAG_INVALID_UID                 (0x00000000)
  267 
  268 #define MPR_DIAG_SUCCESS                        0
  269 #define MPR_DIAG_FAILURE                        1
  270 
  271 #define MPR_FW_DIAG_ERROR_SUCCESS               (0x00000000)
  272 #define MPR_FW_DIAG_ERROR_FAILURE               (0x00000001)
  273 #define MPR_FW_DIAG_ERROR_INVALID_PARAMETER     (0x00000002)
  274 #define MPR_FW_DIAG_ERROR_POST_FAILED           (0x00000010)
  275 #define MPR_FW_DIAG_ERROR_INVALID_UID           (0x00000011)
  276 #define MPR_FW_DIAG_ERROR_RELEASE_FAILED        (0x00000012)
  277 #define MPR_FW_DIAG_ERROR_NO_BUFFER             (0x00000013)
  278 #define MPR_FW_DIAG_ERROR_ALREADY_RELEASED      (0x00000014)
  279 
  280 
  281 typedef struct mpr_fw_diag_register
  282 {
  283         uint8_t         ExtendedType;
  284         uint8_t         BufferType;
  285         uint16_t        ApplicationFlags;
  286         uint32_t        DiagnosticFlags;
  287         uint32_t        ProductSpecific[23];
  288         uint32_t        RequestedBufferSize;
  289         uint32_t        UniqueId;
  290 } mpr_fw_diag_register_t;
  291 
  292 typedef struct mpr_fw_diag_unregister
  293 {
  294         uint32_t        UniqueId;
  295 } mpr_fw_diag_unregister_t;
  296 
  297 #define MPR_FW_DIAG_FLAG_APP_OWNED              (0x0001)
  298 #define MPR_FW_DIAG_FLAG_BUFFER_VALID           (0x0002)
  299 #define MPR_FW_DIAG_FLAG_FW_BUFFER_ACCESS       (0x0004)
  300 
  301 typedef struct mpr_fw_diag_query
  302 {
  303         uint8_t         ExtendedType;
  304         uint8_t         BufferType;
  305         uint16_t        ApplicationFlags;
  306         uint32_t        DiagnosticFlags;
  307         uint32_t        ProductSpecific[23];
  308         uint32_t        TotalBufferSize;
  309         uint32_t        DriverAddedBufferSize;
  310         uint32_t        UniqueId;
  311 } mpr_fw_diag_query_t;
  312 
  313 typedef struct mpr_fw_diag_release
  314 {
  315         uint32_t        UniqueId;
  316 } mpr_fw_diag_release_t;
  317 
  318 #define MPR_FW_DIAG_FLAG_REREGISTER     (0x0001)
  319 #define MPR_FW_DIAG_FLAG_FORCE_RELEASE  (0x0002)
  320 
  321 typedef struct mpr_diag_read_buffer
  322 {
  323         uint8_t         Status;
  324         uint8_t         Reserved;
  325         uint16_t        Flags;
  326         uint32_t        StartingOffset;
  327         uint32_t        BytesToRead;
  328         uint32_t        UniqueId;
  329         uint64_t        PtrDataBuffer;
  330 } mpr_diag_read_buffer_t;
  331 
  332 /*
  333  * Register Access
  334  */
  335 #define REG_IO_READ     1
  336 #define REG_IO_WRITE    2
  337 #define REG_MEM_READ    3
  338 #define REG_MEM_WRITE   4
  339 
  340 typedef struct mpr_reg_access
  341 {
  342         uint32_t        Command;
  343         uint32_t        RegOffset;
  344         uint32_t        RegData;
  345 } mpr_reg_access_t;
  346 
  347 typedef struct mpr_btdh_mapping
  348 {
  349         uint16_t        TargetID;
  350         uint16_t        Bus;
  351         uint16_t        DevHandle;
  352         uint16_t        Reserved;
  353 } mpr_btdh_mapping_t;
  354 
  355 #define MPRIO_MPR_COMMAND_FLAG_VERBOSE  0x01
  356 #define MPRIO_MPR_COMMAND_FLAG_DEBUG    0x02
  357 #define MPRIO_READ_CFG_HEADER   _IOWR('M', 200, struct mpr_cfg_page_req)
  358 #define MPRIO_READ_CFG_PAGE     _IOWR('M', 201, struct mpr_cfg_page_req)
  359 #define MPRIO_READ_EXT_CFG_HEADER _IOWR('M', 202, struct mpr_ext_cfg_page_req)
  360 #define MPRIO_READ_EXT_CFG_PAGE _IOWR('M', 203, struct mpr_ext_cfg_page_req)
  361 #define MPRIO_WRITE_CFG_PAGE    _IOWR('M', 204, struct mpr_cfg_page_req)
  362 #define MPRIO_RAID_ACTION       _IOWR('M', 205, struct mpr_raid_action)
  363 #define MPRIO_MPR_COMMAND       _IOWR('M', 210, struct mpr_usr_command)
  364 
  365 #define MPTIOCTL                        ('I')
  366 #define MPTIOCTL_GET_ADAPTER_DATA       _IOWR(MPTIOCTL, 1,\
  367     struct mpr_adapter_data)
  368 #define MPTIOCTL_UPDATE_FLASH           _IOWR(MPTIOCTL, 2,\
  369     struct mpr_update_flash)
  370 #define MPTIOCTL_RESET_ADAPTER          _IO(MPTIOCTL, 3)
  371 #define MPTIOCTL_PASS_THRU              _IOWR(MPTIOCTL, 4,\
  372     struct mpr_pass_thru)
  373 #define MPTIOCTL_EVENT_QUERY            _IOWR(MPTIOCTL, 5,\
  374     struct mpr_event_query)
  375 #define MPTIOCTL_EVENT_ENABLE           _IOWR(MPTIOCTL, 6,\
  376     struct mpr_event_enable)
  377 #define MPTIOCTL_EVENT_REPORT           _IOWR(MPTIOCTL, 7,\
  378     struct mpr_event_report)
  379 #define MPTIOCTL_GET_PCI_INFO           _IOWR(MPTIOCTL, 8,\
  380     struct mpr_pci_info)
  381 #define MPTIOCTL_DIAG_ACTION            _IOWR(MPTIOCTL, 9,\
  382     struct mpr_diag_action)
  383 #define MPTIOCTL_REG_ACCESS             _IOWR(MPTIOCTL, 10,\
  384     struct mpr_reg_access)
  385 #define MPTIOCTL_BTDH_MAPPING           _IOWR(MPTIOCTL, 11,\
  386     struct mpr_btdh_mapping)
  387 
  388 #endif /* !_MPR_IOCTL_H_ */

Cache object: 5f181f661fd4d4d8a6628e823e440800


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