Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
megaraid_ioctl.h File Reference
#include <linux/types.h>
#include <linux/semaphore.h>
#include "mbox_defs.h"

Go to the source code of this file.

Data Structures

struct  uioc
 
struct  mraid_hba_info
 
struct  mcontroller
 
struct  mm_dmapool
 
struct  mraid_mmadp
 

Macros

#define CL_ANN   0 /* print unconditionally, announcements */
 
#define CL_DLEVEL1   1 /* debug level 1, informative */
 
#define CL_DLEVEL2   2 /* debug level 2, verbose */
 
#define CL_DLEVEL3   3 /* debug level 3, very verbose */
 
#define con_log(level, fmt)   if (LSI_DBGLVL >= level) printk fmt;
 
#define MEGAIOC_MAGIC   'm'
 
#define MEGAIOCCMD   _IOWR(MEGAIOC_MAGIC, 0, mimd_t)
 
#define MEGAIOC_QNADAP   'm' /* Query # of adapters */
 
#define MEGAIOC_QDRVRVER   'e' /* Query driver version */
 
#define MEGAIOC_QADAPINFO   'g' /* Query adapter information */
 
#define USCSICMD   0x80
 
#define UIOC_RD   0x00001
 
#define UIOC_WR   0x00002
 
#define MBOX_CMD   0x00000
 
#define GET_DRIVER_VER   0x10000
 
#define GET_N_ADAP   0x20000
 
#define GET_ADAP_INFO   0x30000
 
#define GET_CAP   0x40000
 
#define GET_STATS   0x50000
 
#define GET_IOCTL_VERSION   0x01
 
#define EXT_IOCTL_SIGN_SZ   16
 
#define EXT_IOCTL_SIGN   "$$_EXTD_IOCTL_$$"
 
#define MBOX_LEGACY   0x00 /* ioctl has legacy mbox*/
 
#define MBOX_HPE   0x01 /* ioctl has hpe mbox */
 
#define APPTYPE_MIMD   0x00 /* old existing apps */
 
#define APPTYPE_UIOC   0x01 /* new apps using uioc */
 
#define IOCTL_ISSUE   0x00000001 /* Issue ioctl */
 
#define IOCTL_ABORT   0x00000002 /* Abort previous ioctl */
 
#define DRVRTYPE_MBOX   0x00000001 /* regular mbox driver */
 
#define DRVRTYPE_HPE   0x00000002 /* new hpe driver */
 
#define MKADAP(adapno)   (MEGAIOC_MAGIC << 8 | (adapno) )
 
#define GETADAP(mkadap)   ((mkadap) ^ MEGAIOC_MAGIC << 8)
 
#define MAX_DMA_POOLS   5 /* 4k, 8k, 16k, 32k, 64k*/
 

Typedefs

typedef struct mm_dmapool mm_dmapool_t
 
typedef struct mraid_mmadp mraid_mmadp_t
 

Functions

struct uioc __attribute__ ((aligned(1024), packed)) uioc_t
 
struct mraid_hba_info __attribute__ ((aligned(256), packed)) mraid_hba_info_t
 
struct mcontroller __attribute__ ((packed)) mcontroller_t
 
int mraid_mm_register_adp (mraid_mmadp_t *)
 
int mraid_mm_unregister_adp (uint32_t)
 
uint32_t mraid_mm_adapter_app_handle (uint32_t)
 

Variables

uint8_t signature [EXT_IOCTL_SIGN_SZ]
 
uint16_t mb_type
 
uint16_t app_type
 
uint32_t opcode
 
uint32_t adapno
 
uint64_t cmdbuf
 
uint32_t xferlen
 
uint32_t data_dir
 
int32_t status
 
uint8_t reserved [128]
 
void __useruser_data
 
uint32_t user_data_len
 
uint32_t pad_for_64bit_align
 
mraid_passthru_t __useruser_pthru
 
mraid_passthru_t * pthru32
 
dma_addr_t pthru32_h
 
struct list_head list
 
void(* done )(struct uioc *)
 
caddr_t buf_vaddr
 
dma_addr_t buf_paddr
 
int8_t pool_index
 
uint8_t free_buf
 
uint8_t timedout
 
uint16_t pci_vendor_id
 
uint16_t pci_device_id
 
uint16_t subsys_vendor_id
 
uint16_t subsys_device_id
 
uint64_t baseport
 
uint8_t pci_bus
 
uint8_t pci_dev_fn
 
uint8_t pci_slot
 
uint8_t irq
 
uint32_t unique_id
 
uint32_t host_no
 
uint8_t num_ldrv
 
uint64_t base
 
uint8_t numldrv
 
uint8_t pcibus
 
uint16_t pcidev
 
uint8_t pcifun
 
uint16_t pciid
 
uint16_t pcivendor
 
uint8_t pcislot
 
uint32_t uid
 

Macro Definition Documentation

#define APPTYPE_MIMD   0x00 /* old existing apps */

Definition at line 73 of file megaraid_ioctl.h.

#define APPTYPE_UIOC   0x01 /* new apps using uioc */

Definition at line 74 of file megaraid_ioctl.h.

#define CL_ANN   0 /* print unconditionally, announcements */

Definition at line 28 of file megaraid_ioctl.h.

#define CL_DLEVEL1   1 /* debug level 1, informative */

Definition at line 29 of file megaraid_ioctl.h.

#define CL_DLEVEL2   2 /* debug level 2, verbose */

Definition at line 30 of file megaraid_ioctl.h.

#define CL_DLEVEL3   3 /* debug level 3, very verbose */

Definition at line 31 of file megaraid_ioctl.h.

#define con_log (   level,
  fmt 
)    if (LSI_DBGLVL >= level) printk fmt;

con_log() - console log routine : indicates the severity of the message. : format string

con_log displays the error messages on the console based on the current debug level. Also it attaches the appropriate kernel severity level with the message.

Definition at line 42 of file megaraid_ioctl.h.

#define DRVRTYPE_HPE   0x00000002 /* new hpe driver */

Definition at line 80 of file megaraid_ioctl.h.

#define DRVRTYPE_MBOX   0x00000001 /* regular mbox driver */

Definition at line 79 of file megaraid_ioctl.h.

#define EXT_IOCTL_SIGN   "$$_EXTD_IOCTL_$$"

Definition at line 68 of file megaraid_ioctl.h.

#define EXT_IOCTL_SIGN_SZ   16

Definition at line 67 of file megaraid_ioctl.h.

#define GET_ADAP_INFO   0x30000

Definition at line 62 of file megaraid_ioctl.h.

#define GET_CAP   0x40000

Definition at line 63 of file megaraid_ioctl.h.

#define GET_DRIVER_VER   0x10000

Definition at line 60 of file megaraid_ioctl.h.

#define GET_IOCTL_VERSION   0x01

Definition at line 65 of file megaraid_ioctl.h.

#define GET_N_ADAP   0x20000

Definition at line 61 of file megaraid_ioctl.h.

#define GET_STATS   0x50000

Definition at line 64 of file megaraid_ioctl.h.

#define GETADAP (   mkadap)    ((mkadap) ^ MEGAIOC_MAGIC << 8)

Definition at line 83 of file megaraid_ioctl.h.

#define IOCTL_ABORT   0x00000002 /* Abort previous ioctl */

Definition at line 77 of file megaraid_ioctl.h.

#define IOCTL_ISSUE   0x00000001 /* Issue ioctl */

Definition at line 76 of file megaraid_ioctl.h.

#define MAX_DMA_POOLS   5 /* 4k, 8k, 16k, 32k, 64k*/

Definition at line 85 of file megaraid_ioctl.h.

#define MBOX_CMD   0x00000

Definition at line 59 of file megaraid_ioctl.h.

#define MBOX_HPE   0x01 /* ioctl has hpe mbox */

Definition at line 71 of file megaraid_ioctl.h.

#define MBOX_LEGACY   0x00 /* ioctl has legacy mbox*/

Definition at line 70 of file megaraid_ioctl.h.

#define MEGAIOC_MAGIC   'm'

Definition at line 48 of file megaraid_ioctl.h.

#define MEGAIOC_QADAPINFO   'g' /* Query adapter information */

Definition at line 53 of file megaraid_ioctl.h.

#define MEGAIOC_QDRVRVER   'e' /* Query driver version */

Definition at line 52 of file megaraid_ioctl.h.

#define MEGAIOC_QNADAP   'm' /* Query # of adapters */

Definition at line 51 of file megaraid_ioctl.h.

#define MEGAIOCCMD   _IOWR(MEGAIOC_MAGIC, 0, mimd_t)

Definition at line 49 of file megaraid_ioctl.h.

#define MKADAP (   adapno)    (MEGAIOC_MAGIC << 8 | (adapno) )

Definition at line 82 of file megaraid_ioctl.h.

#define UIOC_RD   0x00001

Definition at line 56 of file megaraid_ioctl.h.

#define UIOC_WR   0x00002

Definition at line 57 of file megaraid_ioctl.h.

#define USCSICMD   0x80

Definition at line 55 of file megaraid_ioctl.h.

Typedef Documentation

mm_dmapool_t : Represents one dma pool with just one buffer

: Virtual address : DMA physicall address : In KB - 4 = 4k, 8 = 8k etc. : Handle to the dma pool : lock to synchronize access to the pool : If pool already in use, attach new block

mraid_mmadp_t: Structure that drivers pass during (un)registration

: Any unique id (usually PCI bus+dev+fn) : megaraid or hpe (DRVRTYPE_MBOX or DRVRTYPE_HPE) : Driver specific; not touched by the common module : timeout for issued kiocs : Maximum ioctl packets acceptable by the lld : pci dev; used for allocating dma'ble memory : Driver supplied routine to issue uioc_t commands : issue_uioc(drvr_data, kioc, ISSUE/ABORT, uioc_done) : flag to indicate if ioctl can be issued to this adp : attach with the global list of adapters : block of mem for number of kiocs : pool of free kiocs : protection for free pool : so as not to exceed parallel ioctls : block of mem for number of mboxes : DMA pool to allocate passthru packets : array of dma pools

Function Documentation

struct uioc __attribute__ ( (aligned(1024), packed)  )

struct uioc_t - the common ioctl packet structure

: Must be "$$_EXTD_IOCTL_$$" : Type of the mail box (MB_LEGACY or MB_HPE) : Type of the issuing application (existing or new) : Opcode of the command : Adapter number : Pointer to buffer - can point to mbox or plain data buffer : xferlen for DCMD and non mailbox commands : Direction of the data transfer : Status from the driver : reserved bytes for future expansion

: user data transfer address is saved in this : length of the data buffer sent by user app : user passthru address is saves in this (null if DCMD) : kernel address passthru (allocated per kioc) : physicall address of : for kioc free pool list maintenance : call back routine for llds to call when kioc is completed : dma pool buffer attached to kioc for data transfer : physical address of the dma pool buffer : index of the dma pool that is taken from : indicates if buffer needs to be freed after kioc completes

Note : All LSI drivers understand only this packet. Any other : format sent by applications would be converted to this.

struct mraid_hba_info - information about the controller

: PCI vendor id : PCI device id : PCI subsystem vendor id : PCI subsystem device id : base port of hba memory : PCI bus : PCI device/function values : interrupt vector for the device

Extended information of 256 bytes about the controller. Align on the single byte boundary so that 32-bit applications can be run on 64-bit platform drivers withoug re-compilation. NOTE: reduce the number of reserved bytes whenever new field are added, so that total size of the structure remains 256 bytes.

struct mcontroller __attribute__ ( (packed)  )
read

mcontroller : adapter info structure for old mimd_t apps

: base address : irq number : number of logical drives : pci bus : pci device : pci function : pci id : vendor id : slot number : unique id

Definition at line 171 of file esd_usb2.c.

uint32_t mraid_mm_adapter_app_handle ( uint32_t  unique_id)

mraid_mm_adapter_app_handle - return the application handle for this adapter : adapter unique identifier

For the given driver data, locate the adapter in our global list and return the corresponding handle, which is also used by applications to uniquely identify an adapter.

Return adapter handle if found in the list. Return 0 if adapter could not be located, should never happen though.

Definition at line 1034 of file megaraid_mm.c.

int mraid_mm_register_adp ( mraid_mmadp_t lld_adp)

mraid_mm_register_adp - Registration routine for low level drivers : Adapter objejct

Definition at line 902 of file megaraid_mm.c.

int mraid_mm_unregister_adp ( uint32_t  unique_id)

mraid_mm_unregister_adp - Unregister routine for low level drivers : UID of the adpater

Assumes no outstanding ioctls to llds.

Definition at line 1115 of file megaraid_mm.c.

Variable Documentation

u16 adapno

Definition at line 162 of file megaraid_ioctl.h.

uint16_t app_type

Definition at line 160 of file megaraid_ioctl.h.

uint64_t base

Definition at line 224 of file megaraid_ioctl.h.

uint64_t baseport

Definition at line 199 of file megaraid_ioctl.h.

dma_addr_t buf_paddr

Definition at line 185 of file megaraid_ioctl.h.

caddr_t buf_vaddr

Definition at line 184 of file megaraid_ioctl.h.

uint64_t cmdbuf

Definition at line 163 of file megaraid_ioctl.h.

uint32_t data_dir

Definition at line 165 of file megaraid_ioctl.h.

void(* done)(struct uioc *)

Definition at line 182 of file megaraid_ioctl.h.

uint8_t free_buf

Definition at line 187 of file megaraid_ioctl.h.

u16 host_no

Definition at line 206 of file megaraid_ioctl.h.

uint8_t irq

Definition at line 203 of file megaraid_ioctl.h.

Definition at line 181 of file megaraid_ioctl.h.

uint16_t mb_type

Definition at line 159 of file megaraid_ioctl.h.

uint8_t num_ldrv

Definition at line 208 of file megaraid_ioctl.h.

uint8_t numldrv

Definition at line 226 of file megaraid_ioctl.h.

Definition at line 161 of file megaraid_ioctl.h.

uint32_t pad_for_64bit_align

Definition at line 174 of file megaraid_ioctl.h.

Definition at line 200 of file megaraid_ioctl.h.

uint8_t pci_dev_fn

Definition at line 201 of file megaraid_ioctl.h.

Definition at line 195 of file megaraid_ioctl.h.

Definition at line 202 of file megaraid_ioctl.h.

uint16_t pci_vendor_id

Definition at line 194 of file megaraid_ioctl.h.

uint8_t pcibus

Definition at line 227 of file megaraid_ioctl.h.

uint16_t pcidev

Definition at line 228 of file megaraid_ioctl.h.

uint8_t pcifun

Definition at line 229 of file megaraid_ioctl.h.

uint16_t pciid

Definition at line 230 of file megaraid_ioctl.h.

uint8_t pcislot

Definition at line 232 of file megaraid_ioctl.h.

uint16_t pcivendor

Definition at line 231 of file megaraid_ioctl.h.

int8_t pool_index

Definition at line 186 of file megaraid_ioctl.h.

mraid_passthru_t* pthru32

Definition at line 178 of file megaraid_ioctl.h.

dma_addr_t pthru32_h

Definition at line 179 of file megaraid_ioctl.h.

uint8_t reserved[128]

Definition at line 167 of file megaraid_ioctl.h.

Definition at line 158 of file megaraid_ioctl.h.

Definition at line 166 of file megaraid_ioctl.h.

uint16_t subsys_device_id

Definition at line 197 of file megaraid_ioctl.h.

uint16_t subsys_vendor_id

Definition at line 196 of file megaraid_ioctl.h.

uint8_t timedout

Definition at line 189 of file megaraid_ioctl.h.

uint32_t uid

Definition at line 233 of file megaraid_ioctl.h.

uint32_t unique_id

Definition at line 205 of file megaraid_ioctl.h.

Definition at line 170 of file megaraid_ioctl.h.

uint32_t user_data_len

Definition at line 171 of file megaraid_ioctl.h.

mraid_passthru_t __user* user_pthru

Definition at line 176 of file megaraid_ioctl.h.

uint32_t xferlen

Definition at line 164 of file megaraid_ioctl.h.