Commit a5a5e2d1 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

Add new Megaraid driver version 2.20.0.1

From: Mukker, Atul <Atulm@lsil.com>

This is a complete re-write to replace the now obsoleted megaraid2
driver.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 44d90463
### Version 2.00.3
Wed Jan 29 09:13:44 EST 200 - Atul Mukker <atulm@lsil.com>
i. Change the handshake in ISR while acknowledging interrupts. Write the
valid interrupt pattern 0x10001234 as soon as it is read from the
outdoor register. In existing driver and on certain platform, invalid
command ids were being returned.
Release Date : Mon Jun 21 19:53:54 EDT 2004 - Atul Mukker <atulm@lsil.com>
Current Version : 2.20.0.0
Older Version : megaraid 2.20.0.rc2 and 2.00.3
Also, do not wait on status be become 0xFF, since FW can return this
status in certain circumstances.
i. Independent module to interact with userland applications and
multiplex command to low level RAID module(s).
Initialize the numstatus field of mailbox to 0xFF so that we can wait
on this wait in next interrupt. Firmware does not change its value
unless there are some status to be posted
"Shared code in a third module, a "library module", is an acceptable
solution. modprobe automatically loads dependent modules, so users
running "modprobe driver1" or "modprobe driver2" would automatically
load the shared library module."
ii. Specify the logical drive number while issuing the RESERVATION_STATUS
- Jeff Garzik <jgarzik@pobox.com> 02.25.2004 LKML
iii. Reduce the default mailbox busy wait time from 300us to 10us. This is
done to avaoid a possible deadlock in FW because of longer bust waits.
"As Jeff hinted, if your userspace<->driver API is consistent between
your new MPT-based RAID controllers and your existing megaraid driver,
then perhaps you need a single small helper module (lsiioctl or some
better name), loaded by both mptraid and megaraid automatically, which
handles registering the /dev/megaraid node dynamically. In this case,
both mptraid and megaraid would register with lsiioctl for each
adapter discovered, and lsiioctl would essentially be a switch,
redirecting userspace tool ioctls to the appropriate driver."
iv. The max outstanding commands are reduced to 126 because that't the
safest value on all FW.
- Matt Domsch <Matt_Domsch@dell.com> 02.25.2004 LKML
v. Number of sectors per IO are reduced to 128 (64kb), becuase FW needs
resources in special circumstances like check consistency, rebuilds
etc.
ii. Remove C99 initializations from pci_device id.
vi. max_commands is no longer a module parameter because of iv.
"pci_id_table_g would be much more readable when not using C99
initializers.
PCI table doesn't change, there's lots of users that prefer the more
readable variant. And it's really far less and much easier to grok
lines without C99 initializers."
### Version: 2.00.2
i. Intermediate release with kernel specific code
- Christoph Hellwig <hch@infradead.org>, 05.28.2004 linux-scsi
iii. Many fixes as suggested by Christoph Hellwig <hch@infradead.org> on
linux-scsi, 05.28.2004
### Version: 2.00.1i
Wed Dec 4 14:34:51 EST 2002 - Atul Mukker <atulm@lsil.com>
i. Making the older IO based controllers to work with this driver
iv. We now support up to 32 parallel ioctl commands instead of current 1.
There is a conscious effort to let memory allocation not fail for ioctl
commands.
v. Do away with internal memory management. Use pci_pool_(create|alloc)
instead.
### Version 2.00.1
Fri Nov 15 10:59:44 EST 2002 - Atul Mukker <atulm@lsil.com>
i. Release host lock before issuing internal command to reset
reservations in megaraid_reset() and reacquire after internal command
is completed.
vi. Kill tasklet when unloading the driver.
vii. Do not use "host_lock', driver has fine-grain locks now to protect all
data structures.
viii. Optimize the build scatter-gather list routine. The callers already
know the data transfer address and length.
ix. Better implementation of error handling and recovery. Driver now
performs extended errors recovery for instances like scsi cable pull.
x. Disassociate the management commands with an overlaid scsi command.
Driver now treats the mangement packets as special packets and has a
dedicated callback routine.
Notes on Management Module
~~~~~~~~~~~~~~~~~~~~~~~~~~
Overview:
--------
Different classes of controllers from LSI Logic, accept and respond to the
user applications in a similar way. They understand the same firmware control
commands. Furthermore, the applications also can treat different classes of
the controllers uniformly. Hence it is logical to have a single module that
interefaces with the applications on one side and all the low level drivers
on the other.
The advantages, though obvious, are listed for completeness:
i. Avoid duplicate code from the low level drivers.
ii. Unburden the low level drivers from having to export the
character node device and related handling.
iii. Implement any policy mechanisms in one place.
iv. Applications have to interface with only module instead of
multiple low level drivers.
Currently this module (called Common Management Module) is used only to issue
ioctl commands. But this module is envisioned to handle all user space level
interactions. So any 'proc', 'sysfs' implementations will be localized in this
common module.
Credits:
-------
"Shared code in a third module, a "library module", is an acceptable
solution. modprobe automatically loads dependent modules, so users
running "modprobe driver1" or "modprobe driver2" would automatically
load the shared library module."
- Jeff Garzik (jgarzik@pobox.com), 02.25.2004 LKML
"As Jeff hinted, if your userspace<->driver API is consistent between
your new MPT-based RAID controllers and your existing megaraid driver,
then perhaps you need a single small helper module (lsiioctl or some
better name), loaded by both mptraid and megaraid automatically, which
handles registering the /dev/megaraid node dynamically. In this case,
both mptraid and megaraid would register with lsiioctl for each
adapter discovered, and lsiioctl would essentially be a switch,
redirecting userspace tool ioctls to the appropriate driver."
- Matt Domsch, (Matt_Domsch@dell.com), 02.25.2004 LKML
Design:
------
The Common Management Module is implemented in megaraid_mm.[ch] files. This
module acts as a registry for low level hba drivers. The low level drivers
(currently only megaraid) register each controller with the common module.
The applications interface with the common module via the character device
node exported by the module.
The lower level drivers now understand only a new improved ioctl packet called
uioc_t. The management module converts the older ioctl packets from the older
applications into uioc_t. After driver handles the uioc_t, the common module
will convert that back into the old format before returning to applications.
As new applications evolve and replace the old ones, the old packet format
will be retired.
Common module dedicates one uioc_t packet to each controller registered. This
can easily be more than one. But since megaraid is the only low level driver
today, and it can handle only one ioctl, there is no reason to have more. But
as new controller classes get added, this will be tuned appropriately.
......@@ -203,8 +203,22 @@
1000 0530 MegaRAID 530 SCSI 320-0X RAID Controller
1000 0531 MegaRAID 531 SCSI 320-4X RAID Controller
1000 0532 MegaRAID 532 SCSI 320-2X RAID Controller
1028 0533 PowerEgde Expandable RAID Controller 4/QC
8086 0532 Storage RAID Controller SRCU42X
1028 0531 PowerEgde Expandable RAID Controller 4/QC
8086 0530 MegaRAID Intel RAID Controller SRCZCRX
8086 0532 MegaRAID Intel RAID Controller SRCU42X
0408 MegaRAID
1000 0001 MegaRAID SCSI 320-1E RAID Controller
1000 0002 MegaRAID SCSI 320-2E RAID Controller
1028 0001 Dell PowerEdge RAID Controller PERC4e/SC
1028 0002 Dell PowerEdge RAID Controller PERC4e/DC
1734 1065 FSC MegaRAID PCI Express ROMB
8086 0002 MegaRAID Intel RAID Controller SRCU42E
0409 MegaRAID
1000 3004 MegaRAID SATA 300-4X RAID Controller
1000 3008 MegaRAID SATA 300-8X RAID Controller
8086 3008 MegaRAID Intel RAID Controller SRCS28X
8086 3431 MegaRAID Intel RAID Controller Alief SROMBU42E
8086 3499 MegaRAID Intel RAID Controller Harwich SROMBU42E
0621 FC909 Fibre Channel Adapter
0622 FC929 Fibre Channel Adapter
1000 1020 44929 O Dual Fibre Channel card
......@@ -228,13 +242,15 @@
1960 MegaRAID
1000 0518 MegaRAID 518 SCSI 320-2 Controller
1000 0520 MegaRAID 520 SCSI 320-1 Controller
1000 0522 MegaRAID 522 i4133 RAID Controller
1000 0522 MegaRAID 522 i4 133 RAID Controller
1000 0523 MegaRAID SATA 150-6 RAID Controller
1000 4523 MegaRAID SATA 150-4 RAID Controller
1000 a520 MegaRAID ZCR SCSI 320-0 Controller
1028 0518 MegaRAID 518 DELL PERC 4/DC RAID Controller
1028 0520 MegaRAID 520 DELL PERC 4/SC RAID Controller
1028 0531 PowerEdge Expandable RAID Controller 4/QC
8086 0520 MegaRAID Intel RAID Controller SRCU41L
8086 0523 MegaRAID Intel RAID Controller SRCS16
1001 Kolter Electronic
0010 PCI 1616 Measurement card with 32 digital I/O lines
0011 OPTO-PCI Opto-Isolated digital I/O board
......@@ -1210,6 +1226,12 @@
1028 014a PowerEdge Expandable RAID Controller 4/Di
1028 014c MegaRAID DELL PERC 4/Di RAID On Motherboard
1028 014d MegaRAID DELL PERC 4/Di RAID On Motherboard
0013 PowerEdge Expandable RAID controller 4
1028 016c PowerEdge Expandable RAID Controller 4e/Si
1028 016d PowerEdge Expandable RAID Controller 4e/Di
1028 016e PowerEdge Expandable RAID Controller 4e/Di
1028 016f PowerEdge Expandable RAID Controller 4e/Di
1028 0170 PowerEdge Expandable RAID Controller 4e/Di
1029 Siemens Nixdorf IS
102a LSI Logic
0000 HYDRA
......
......@@ -395,15 +395,7 @@ config SCSI_IN2000
To compile this driver as a module, choose M here: the
module will be called in2000.
config SCSI_MEGARAID
tristate "AMI MegaRAID support"
depends on PCI && SCSI
help
This driver supports the AMI MegaRAID 418, 428, 438, 466, 762, 490
and 467 SCSI host adapters.
To compile this driver as a module, choose M here: the
module will be called megaraid.
source "drivers/scsi/megaraid/Kconfig.megaraid"
config SCSI_SATA
bool "Serial ATA (SATA) support"
......
......@@ -95,7 +95,8 @@ obj-$(CONFIG_SCSI_IBMMCA) += ibmmca.o
obj-$(CONFIG_SCSI_EATA) += eata.o
obj-$(CONFIG_SCSI_DC395x) += dc395x.o
obj-$(CONFIG_SCSI_DC390T) += tmscsim.o
obj-$(CONFIG_SCSI_MEGARAID) += megaraid.o
obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o
obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/
obj-$(CONFIG_SCSI_ACARD) += atp870u.o
obj-$(CONFIG_SCSI_SUNESP) += esp.o
obj-$(CONFIG_SCSI_GDTH) += gdth.o
......
config MEGARAID_NEWGEN
bool "LSI Logic New Generation RAID Device Drivers"
depends on PCI && SCSI
default y
help
LSI Logic RAID Device Drivers
config MEGARAID_MM
tristate "LSI Logic Management Module (New Driver)"
depends on PCI && SCSI && MEGARAID_NEWGEN
default m
help
Management Module provides ioctl, sysfs support for LSI Logic
RAID controllers.
To compile this driver as a module, choose M here: the
module will be called megaraid_mm
config MEGARAID_MAILBOX
tristate "LSI Logic MegaRAID Driver (New Driver)"
depends on PCI && SCSI && MEGARAID_MM
default $MEGARAID_MM
help
List of supported controllers
OEM Product Name VID :DID :SVID:SSID
--- ------------ ---- ---- ---- ----
Dell PERC3/QC 101E:1960:1028:0471
Dell PERC3/DC 101E:1960:1028:0493
Dell PERC3/SC 101E:1960:1028:0475
Dell PERC3/Di 1028:000E:1028:0123
Dell PERC4/SC 1000:1960:1028:0520
Dell PERC4/DC 1000:1960:1028:0518
Dell PERC4/QC 1000:0407:1028:0531
Dell PERC4/Di 1028:000F:1028:014A
Dell PERC 4e/Si 1028:0013:1028:016c
Dell PERC 4e/Di 1028:0013:1028:016d
Dell PERC 4e/Di 1028:0013:1028:016e
Dell PERC 4e/Di 1028:0013:1028:016f
Dell PERC 4e/Di 1028:0013:1028:0170
Dell PERC 4e/DC 1000:0408:1028:0002
Dell PERC 4e/SC 1000:0408:1028:0001
LSI MegaRAID SCSI 320-0 1000:1960:1000:A520
LSI MegaRAID SCSI 320-1 1000:1960:1000:0520
LSI MegaRAID SCSI 320-2 1000:1960:1000:0518
LSI MegaRAID SCSI 320-0X 1000:0407:1000:0530
LSI MegaRAID SCSI 320-2X 1000:0407:1000:0532
LSI MegaRAID SCSI 320-4X 1000:0407:1000:0531
LSI MegaRAID SCSI 320-1E 1000:0408:1000:0001
LSI MegaRAID SCSI 320-2E 1000:0408:1000:0002
LSI MegaRAID SATA 150-2 1095:3112:1000:0534
LSI MegaRAID SATA 150-4 1000:1960:1000:4523
LSI MegaRAID SATA 150-6 1000:1960:1000:0523
LSI MegaRAID SATA 150-4X 1000:0409:1000:1504
LSI MegaRAID SATA 150-8X 1000:0409:1000:1508
INTEL RAID Controller SRCU42X 1000:0407:8086:0532
INTEL RAID Controller SRCS16 1000:1960:8086:0523
INTEL RAID Controller SRCU42E 1000:0408:8086:0002
INTEL RAID Controller SRCZCRX 1000:0407:8086:0530
INTEL RAID Controller SRCS28X 1000:0409:8086:3008
INTEL RAID Controller SROMBU42E 1000:0408:8086:3431
INTEL RAID Controller SROMBU42E 1000:0408:8086:3499
INTEL RAID Controller SRCU51L 1000:1960:8086:0520
FSC MegaRAID PCI Express ROMB 1000:0408:1734:1065
To compile this driver as a module, choose M here: the
module will be called megaraid_mbox
if MEGARAID_NEWGEN=n
config MEGARAID_LEGACY
tristate "LSI Logic Legacy MegaRAID Driver"
depends on PCI && SCSI
default m
help
This driver supports the LSI MegaRAID 418, 428, 438, 466, 762, 490
and 467 SCSI host adapters. This driver also support the all U320
RAID controllers
To compile this driver as a module, choose M here: the
module will be called megaraid
endif
obj-$(CONFIG_MEGARAID_MAILBOX) += megaraid_mbox.o
obj-$(CONFIG_MEGARAID_MM) += megaraid_mm.o
This diff is collapsed.
/*
*
* Linux MegaRAID device driver
*
* Copyright (c) 2003-2004 LSI Logic Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* FILE : mega_common.h
*
* Libaray of common routine used by all low-level megaraid drivers
*/
#ifndef _MEGA_COMMON_H_
#define _MEGA_COMMON_H_
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/blkdev.h>
#include <linux/list.h>
#include <linux/version.h>
#include <linux/moduleparam.h>
#include <asm/semaphore.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#define LSI_MAX_CHANNELS 16
#define LSI_MAX_LOGICAL_DRIVES_64LD (64+1)
/**
* scb_t - scsi command control block
* @param ccb : command control block for individual driver
* @param list : list of control blocks
* @param gp : general purpose field for LLDs
* @param sno : all SCBs have a serial number
* @param scp : associated scsi command
* @param state : current state of scb
* @param dma_dir : direction of data transfer
* @param dma_type : transfer with sg list, buffer, or no data transfer
* @param dev_channel : actual channel on the device
* @param dev_target : actual target on the device
* @param status : completion status
*
* This is our central data structure to issue commands the each driver.
* Driver specific data structures are maintained in the ccb field.
* scb provides a field 'gp', which can be used by LLD for its own purposes
*
* dev_channel and dev_target must be initialized with the actual channel and
* target on the controller.
*/
typedef struct {
caddr_t ccb;
struct list_head list;
unsigned long gp;
unsigned int sno;
struct scsi_cmnd *scp;
uint32_t state;
uint32_t dma_direction;
uint32_t dma_type;
uint16_t dev_channel;
uint16_t dev_target;
uint32_t status;
} scb_t;
/*
* SCB states as it transitions from one state to another
*/
#define SCB_FREE 0x0000 /* on the free list */
#define SCB_ACTIVE 0x0001 /* off the free list */
#define SCB_PENDQ 0x0002 /* on the pending queue */
#define SCB_ISSUED 0x0004 /* issued - owner f/w */
#define SCB_ABORT 0x0008 /* Got an abort for this one */
#define SCB_RESET 0x0010 /* Got a reset for this one */
/*
* DMA types for scb
*/
#define MRAID_DMA_NONE 0x0000 /* no data transfer for this command */
#define MRAID_DMA_WSG 0x0001 /* data transfer using a sg list */
#define MRAID_DMA_WBUF 0x0002 /* data transfer using a contiguous buffer */
/**
* struct adapter_t - driver's initialization structure
* @param dpc_h : tasklet handle
* @param pdev : pci configuration pointer for kernel
* @param host : pointer to host structure of mid-layer
* @param host_lock : pointer to appropriate lock
* @param lock : synchronization lock for mid-layer and driver
* @param quiescent : driver is quiescent for now.
* @param outstanding_cmds : number of commands pending in the driver
* @param kscb_list : pointer to the bulk of SCBs pointers for IO
* @param kscb_pool : pool of free scbs for IO
* @param kscb_pool_lock : lock for pool of free scbs
* @param pend_list : pending commands list
* @param pend_list_lock : exlusion lock for pending commands list
* @param completed_list : list of completed commands
* @param completed_list_lock : exclusion lock for list of completed commands
* @param sglen : max sg elements supported
* @param device_ids : to convert kernel device addr to our devices.
* @param raid_device : raid adapter specific pointer
* @param max_channel : maximum channel number supported - inclusive
* @param max_target : max target supported - inclusive
* @param max_lun : max lun supported - inclusive
* @param list : list of megaraid host structures
* @param unique_id : unique identifier for each adapter
* @param irq : IRQ for this adapter
* @param ito : internal timeout value, (-1) means no timeout
* @param ibuf : buffer to issue internal commands
* @param ibuf_dma_h : dma handle for the above buffer
* @param uscb_list : SCB pointers for user cmds, common mgmt module
* @param uscb_pool : pool of SCBs for user commands
* @param uscb_pool_lock : exclusion lock for these SCBs
* @param max_cmds : max outstanding commands
* @param fw_version : firmware version
* @param bios_version : bios version
* @param max_cdb_sz : biggest CDB size supported.
* @param ha : is high availability present - clustering
* @param init_id : initiator ID, the default value should be 7
* @param max_sectors : max sectors per request
* @param cmd_per_lun : max outstanding commands per LUN
* @param being_detached : set when unloading, no more mgmt calls
*
*
* mraid_setup_device_map() can be called anytime after the device map is
* available and MRAID_GET_DEVICE_MAP() can be called whenever the mapping is
* required, usually from LLD's queue entry point. The formar API sets up the
* MRAID_IS_LOGICAL(adapter_t *, struct scsi_cmnd *) to find out if the
* device in question is a logical drive.
*
* quiescent flag should be set by the driver if it is not accepting more
* commands
*
* NOTE: The fields of this structures are placed to minimize cache misses
*/
// amount of space required to store the bios and firmware version strings
#define VERSION_SIZE 16
typedef struct {
struct tasklet_struct dpc_h;
struct pci_dev *pdev;
struct Scsi_Host *host;
spinlock_t *host_lock;
spinlock_t lock;
uint8_t quiescent;
int outstanding_cmds;
scb_t *kscb_list;
struct list_head kscb_pool;
spinlock_t kscb_pool_lock;
struct list_head pend_list;
spinlock_t pend_list_lock;
struct list_head completed_list;
spinlock_t completed_list_lock;
uint16_t sglen;
int device_ids[LSI_MAX_CHANNELS]
[LSI_MAX_LOGICAL_DRIVES_64LD];
caddr_t raid_device;
uint8_t max_channel;
uint16_t max_target;
uint8_t max_lun;
struct list_head list;
uint32_t unique_id;
uint8_t irq;
uint8_t ito;
caddr_t ibuf;
dma_addr_t ibuf_dma_h;
scb_t *uscb_list;
struct list_head uscb_pool;
spinlock_t uscb_pool_lock;
int max_cmds;
uint8_t fw_version[VERSION_SIZE];
uint8_t bios_version[VERSION_SIZE];
uint8_t max_cdb_sz;
uint8_t ha;
uint16_t init_id;
uint16_t max_sectors;
uint16_t cmd_per_lun;
atomic_t being_detached;
} adapter_t;
#define SCSI_FREE_LIST_LOCK(adapter) (&adapter->kscb_pool_lock)
#define USER_FREE_LIST_LOCK(adapter) (&adapter->uscb_pool_lock)
#define PENDING_LIST_LOCK(adapter) (&adapter->pend_list_lock)
#define COMPLETED_LIST_LOCK(adapter) (&adapter->completed_list_lock)
// conversion from scsi command
#define SCP2HOST(scp) (scp)->device->host // to host
#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state
#define SCP2CHANNEL(scp) (scp)->device->channel // to channel
#define SCP2TARGET(scp) (scp)->device->id // to target
#define SCP2LUN(scp) (scp)->device->lun // to LUN
// generic macro to convert scsi command and host to controller's soft state
#define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0])
#define SCP2ADAPTER(scp) (adapter_t *)SCSIHOST2ADAP(SCP2HOST(scp))
/**
* MRAID_GET_DEVICE_MAP - device ids
* @param adp - Adapter's soft state
* @param scp - mid-layer scsi command pointer
* @param p_chan - physical channel on the controller
* @param target - target id of the device or logical drive number
* @param islogical - set if the command is for the logical drive
*
* Macro to retrieve information about device class, logical or physical and
* the corresponding physical channel and target or logical drive number
**/
#define MRAID_IS_LOGICAL(adp, scp) \
(SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0
#define MRAID_GET_DEVICE_MAP(adp, scp, p_chan, target, islogical) \
/* \
* Is the request coming for the virtual channel \
*/ \
islogical = MRAID_IS_LOGICAL(adp, scp); \
\
/* \
* Get an index into our table of drive ids mapping \
*/ \
if (islogical) { \
p_chan = 0xFF; \
target = \
(adp)->device_ids[(adp)->max_channel][SCP2TARGET(scp)]; \
} \
else { \
p_chan = ((adp)->device_ids[SCP2CHANNEL(scp)] \
[SCP2TARGET(scp)] >> 8) & 0xFF; \
target = ((adp)->device_ids[SCP2CHANNEL(scp)] \
[SCP2TARGET(scp)] & 0xFF); \
}
/**
* struct mraid_driver_t - global driver data
* @param driver_version : driver version
* @param device_list : list of adapter_t structures
*
* mraid_driver_t contains information which is global to the driver.
*/
typedef struct {
uint8_t driver_version[8];
struct list_head device_list;
} mraid_driver_t;
/*
* ### Helper routines ###
*/
#define LSI_DBGLVL mraid_debug_level // each LLD must define a global
// mraid_debug_level
#ifdef DEBUG
#if defined (_ASSERT_PANIC)
#define ASSERT_ACTION panic
#else
#define ASSERT_ACTION printk
#endif
#define ASSERT(expression) \
if (!(expression)) { \
ASSERT_ACTION("assertion failed:(%s), file: %s, line: %d:%s\n", \
#expression, __FILE__, __LINE__, __FUNCTION__); \
}
#else
#define ASSERT(expression)
#endif
/*
* struct mraid_pci_blk - structure holds DMA memory block info
* @param vaddr : virtual address to a memory block
* @param dma_addr : DMA handle to a memory block
*
* This structure is filled up for the caller. It is the responsibilty of the
* caller to allocate this array big enough to store addresses for all
* requested elements
*/
struct mraid_pci_blk {
caddr_t vaddr;
dma_addr_t dma_addr;
};
#endif // _MEGA_COMMON_H_
// vim: set ts=8 sw=8 tw=78:
/*
*
* Linux MegaRAID device driver
*
* Copyright (c) 2003-2004 LSI Logic Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* FILE : megaraid_ioctl.h
*
* Definitions to interface with user level applications
*/
#ifndef _MEGARAID_IOCTL_H_
#define _MEGARAID_IOCTL_H_
#include <linux/types.h>
#include <asm/semaphore.h>
#include "mbox_defs.h"
/**
* con_log() - console log routine
* @param level : indicates the severity of the message.
* @fparam mt : 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.
*
*
* consolge messages debug levels
*/
#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;
/*
* Definitions & Declarations needed to use common management module
*/
#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 MAX_LSI_CMN_ADAPS 16
#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*/
/**
* struct uioc_t - the common ioctl packet structure
*
* @signature : Must be "$$_EXTD_IOCTL_$$"
* @mb_type : Type of the mail box (MB_LEGACY or MB_HPE)
* @app_type : Type of the issuing application (existing or new)
* @opcode : Opcode of the command
* @adapno : Adapter number
* @cmdbuf : Pointer to buffer - can point to mbox or plain data buffer
* @xferlen : xferlen for DCMD and non mailbox commands
* @data_dir : Direction of the data transfer
* @status : Status from the driver
* @reserved : reserved bytes for future expansion
*
* @user_data : user data transfer address is saved in this
* @user_data_len: length of the data buffer sent by user app
* @user_pthru : user passthru address is saves in this (null if DCMD)
* @pthru32 : kernel address passthru (allocated per kioc)
* @pthru32_h : physicall address of @pthru32
* @list : for kioc free pool list maintenance
* @done : call back routine for llds to call when kioc is completed
* @buf_vaddr : dma pool buffer attached to kioc for data transfer
* @buf_paddr : physical address of the dma pool buffer
* @pool_index : index of the dma pool that @buf_vaddr is taken from
* @free_buf : 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.
*/
typedef struct uioc {
/* User Apps: */
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];
/* Driver Data: */
caddr_t user_data;
uint32_t user_data_len;
mraid_passthru_t *user_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;
uint8_t pool_index;
uint8_t free_buf;
} __attribute__ ((aligned(1024),packed)) uioc_t;
/**
* struct mraid_hba_info - information about the controller
*
* @param pci_vendor_id : PCI vendor id
* @param pci_device_id : PCI device id
* @param subsystem_vendor_id : PCI subsystem vendor id
* @param subsystem_device_id : PCI subsystem device id
* @param baseport : base port of hba memory
* @param pci_bus : PCI bus
* @param pci_dev_fn : PCI device/function values
* @param irq : 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.
*/
typedef struct mraid_hba_info {
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;
} __attribute__ ((aligned(256), packed)) mraid_hba_info_t;
/**
* mcontroller : adapter info structure for old mimd_t apps
*
* @base : base address
* @irq : irq number
* @numldrv : number of logical drives
* @pcibus : pci bus
* @pcidev : pci device
* @pcifun : pci function
* @pciid : pci id
* @pcivendor : vendor id
* @pcislot : slot number
* @uid : unique id
*/
typedef struct mcontroller {
uint64_t base;
uint8_t irq;
uint8_t numldrv;
uint8_t pcibus;
uint16_t pcidev;
uint8_t pcifun;
uint16_t pciid;
uint16_t pcivendor;
uint8_t pcislot;
uint32_t uid;
} __attribute__ ((packed)) mcontroller_t;
/**
* mm_dmapool_t : Represents one dma pool with just one buffer
*
* @vaddr : Virtual address
* @paddr : DMA physicall address
* @bufsize : In KB - 4 = 4k, 8 = 8k etc.
* @handle : Handle to the dma pool
* @lock : lock to synchronize access to the pool
* @in_use : If pool already in use, attach new block
*/
typedef struct mm_dmapool {
caddr_t vaddr;
dma_addr_t paddr;
uint32_t buf_size;
struct dma_pool *handle;
spinlock_t lock;
uint8_t in_use;
} mm_dmapool_t;
/**
* mraid_mmadp_t: Structure that drivers pass during (un)registration
*
* @unique_id : Any unique id (usually PCI bus+dev+fn)
* @drvr_type : megaraid or hpe (DRVRTYPE_MBOX or DRVRTYPE_HPE)
* @drv_data : Driver specific; not touched by the common module
* @timeout : timeout for issued kiocs
* @max_kioc : Maximum ioctl packets acceptable by the lld
* @pdev : pci dev; used for allocating dma'ble memory
* @issue_uioc : Driver supplied routine to issue uioc_t commands
* : issue_uioc(drvr_data, kioc, ISSUE/ABORT, uioc_done)
* @kioc_list : block of mem for @max_kioc number of kiocs
* @kioc_pool : pool of free kiocs
* @kioc_pool_lock : protection for free pool
* @kioc_semaphore : so as not to exceed @max_kioc parallel ioctls
* @mbox_list : block of mem for @max_kioc number of mboxes
* @pthru_dma_pool : DMA pool to allocate passthru packets
* @dma_pool_list : array of dma pools
*/
typedef struct mraid_mmadp {
/* Filled by driver */
uint32_t unique_id;
uint32_t drvr_type;
unsigned long drvr_data;
uint8_t timeout;
uint8_t max_kioc;
struct pci_dev *pdev;
int(*issue_uioc)(unsigned long, uioc_t *, uint32_t);
/* Maintained by common module */
uioc_t *kioc_list;
struct list_head kioc_pool;
spinlock_t kioc_pool_lock;
struct semaphore kioc_semaphore;
mbox64_t *mbox_list;
struct dma_pool *pthru_dma_pool;
mm_dmapool_t dma_pool_list[MAX_DMA_POOLS];
} mraid_mmadp_t;
int mraid_mm_register_adp(mraid_mmadp_t *);
int mraid_mm_unregister_adp(uint32_t);
#endif /* _MEGARAID_IOCTL_H_ */
This diff is collapsed.
/*
*
* Linux MegaRAID device driver
*
* Copyright (c) 2003-2004 LSI Logic Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* FILE : megaraid.h
*/
#ifndef _MEGARAID_H_
#define _MEGARAID_H_
#include "mega_common.h"
#include "mbox_defs.h"
#include "megaraid_ioctl.h"
#define MEGARAID_VERSION "2.20.0.0"
#define MEGARAID_EXT_VERSION "(Release Date: Wed Jun 23 11:38:38 EDT 2004)"
/*
* Define some PCI values here until they are put in the kernel
*/
#define PCI_DEVICE_ID_PERC4_DI_DISCOVERY 0x000E
#define PCI_SUBSYS_ID_PERC4_DI_DISCOVERY 0x0123
#define PCI_DEVICE_ID_PERC4_SC 0x1960
#define PCI_SUBSYS_ID_PERC4_SC 0x0520
#define PCI_DEVICE_ID_PERC4_DC 0x1960
#define PCI_SUBSYS_ID_PERC4_DC 0x0518
#define PCI_DEVICE_ID_PERC4_QC 0x0407
#define PCI_SUBSYS_ID_PERC4_QC 0x0531
#define PCI_DEVICE_ID_PERC4_DI_EVERGLADES 0x000F
#define PCI_SUBSYS_ID_PERC4_DI_EVERGLADES 0x014A
#define PCI_DEVICE_ID_PERC4E_SI_BIGBEND 0x0013
#define PCI_SUBSYS_ID_PERC4E_SI_BIGBEND 0x016c
#define PCI_DEVICE_ID_PERC4E_DI_KOBUK 0x0013
#define PCI_SUBSYS_ID_PERC4E_DI_KOBUK 0x016d
#define PCI_DEVICE_ID_PERC4E_DI_CORVETTE 0x0013
#define PCI_SUBSYS_ID_PERC4E_DI_CORVETTE 0x016e
#define PCI_DEVICE_ID_PERC4E_DI_EXPEDITION 0x0013
#define PCI_SUBSYS_ID_PERC4E_DI_EXPEDITION 0x016f
#define PCI_DEVICE_ID_PERC4E_DI_GUADALUPE 0x0013
#define PCI_SUBSYS_ID_PERC4E_DI_GUADALUPE 0x0170
#define PCI_DEVICE_ID_PERC4E_DC_320_2E 0x0408
#define PCI_SUBSYS_ID_PERC4E_DC_320_2E 0x0002
#define PCI_DEVICE_ID_PERC4E_SC_320_1E 0x0408
#define PCI_SUBSYS_ID_PERC4E_SC_320_1E 0x0001
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_0 0x1960
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_0 0xA520
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_1 0x1960
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_1 0x0520
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_2 0x1960
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_2 0x0518
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_0x 0x0407
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_0x 0x0530
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_2x 0x0407
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_2x 0x0532
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_4x 0x0407
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_4x 0x0531
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_1E 0x0408
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_1E 0x0001
#define PCI_DEVICE_ID_MEGARAID_SCSI_320_2E 0x0408
#define PCI_SUBSYS_ID_MEGARAID_SCSI_320_2E 0x0002
#define PCI_DEVICE_ID_MEGARAID_SATA_150_4 0x1960
#define PCI_SUBSYS_ID_MEGARAID_SATA_150_4 0x4523
#define PCI_DEVICE_ID_MEGARAID_SATA_150_6 0x1960
#define PCI_SUBSYS_ID_MEGARAID_SATA_150_6 0x0523
#define PCI_DEVICE_ID_MEGARAID_SATA_300_4x 0x0409
#define PCI_SUBSYS_ID_MEGARAID_SATA_300_4x 0x3008
#define PCI_DEVICE_ID_MEGARAID_SATA_300_8x 0x0409
#define PCI_SUBSYS_ID_MEGARAID_SATA_300_8x 0x3008
#define PCI_DEVICE_ID_INTEL_RAID_SRCU42X 0x0407
#define PCI_SUBSYS_ID_INTEL_RAID_SRCU42X 0x0532
#define PCI_DEVICE_ID_INTEL_RAID_SRCS16 0x1960
#define PCI_SUBSYS_ID_INTEL_RAID_SRCS16 0x0523
#define PCI_DEVICE_ID_INTEL_RAID_SRCU42E 0x0408
#define PCI_SUBSYS_ID_INTEL_RAID_SRCU42E 0x0002
#define PCI_DEVICE_ID_INTEL_RAID_SRCZCRX 0x0407
#define PCI_SUBSYS_ID_INTEL_RAID_SRCZCRX 0x0530
#define PCI_DEVICE_ID_INTEL_RAID_SRCS28X 0x0409
#define PCI_SUBSYS_ID_INTEL_RAID_SRCS28X 0x3008
#define PCI_DEVICE_ID_INTEL_RAID_SROMBU42E_ALIEF 0x0408
#define PCI_SUBSYS_ID_INTEL_RAID_SROMBU42E_ALIEF 0x3431
#define PCI_DEVICE_ID_INTEL_RAID_SROMBU42E_HARWICH 0x0408
#define PCI_SUBSYS_ID_INTEL_RAID_SROMBU42E_HARWICH 0x3499
#define PCI_DEVICE_ID_INTEL_RAID_SRCU41L_LAKE_SHETEK 0x1960
#define PCI_SUBSYS_ID_INTEL_RAID_SRCU41L_LAKE_SHETEK 0x0520
#define PCI_DEVICE_ID_FSC_MEGARAID_PCI_EXPRESS_ROMB 0x0408
#define PCI_SUBSYS_ID_FSC_MEGARAID_PCI_EXPRESS_ROMB 0x1065
#define PCI_SUBSYS_ID_PERC3_QC 0x0471
#define PCI_SUBSYS_ID_PERC3_DC 0x0493
#define PCI_SUBSYS_ID_PERC3_SC 0x0475
#ifndef PCI_SUBSYS_ID_FSC
#define PCI_SUBSYS_ID_FSC 0x1734
#endif
#define MBOX_MAX_SCSI_CMDS 128 // number of cmds reserved for kernel
#define MBOX_MAX_USER_CMDS 32 // number of cmds for applications
#define MBOX_DEF_CMD_PER_LUN 64 // default commands per lun
#define MBOX_DEFAULT_SG_SIZE 26 // default sg size supported by all fw
#define MBOX_MAX_SG_SIZE 32 // maximum scatter-gather list size
#define MBOX_MAX_SECTORS 128 // maximum sectors per IO
#define MBOX_TIMEOUT 30 // timeout value for internal cmds
#define MBOX_BUSY_WAIT 10 // max usec to wait for busy mailbox
#define MBOX_RESET_WAIT 180 // wait these many seconds in reset
#define MBOX_RESET_EXT_WAIT 120 // extended wait reset
/*
* maximum transfer that can happen through the firmware commands issued
* internnaly from the driver.
*/
#define MBOX_IBUF_SIZE 4096
/**
* mbox_ccb_t - command control block specific to mailbox based controllers
* @raw_mbox : raw mailbox pointer
* @mbox : mailbox
* @mbox64 : extended mailbox
* @mbox_dma_h : maibox dma address
* @sgl64 : 64-bit scatter-gather list
* @sgl32 : 32-bit scatter-gather list
* @sgl_dma_h : dma handle for the scatter-gather list
* @pthru : passthru structure
* @pthru_dma_h : dma handle for the passthru structure
* @epthru : extended passthru structure
* @epthru_dma_h : dma handle for extended passthru structure
* @buf_dma_h : dma handle for buffers w/o sg list
*
* command control block specific to the mailbox based controllers
*/
typedef struct {
uint8_t *raw_mbox;
mbox_t *mbox;
mbox64_t *mbox64;
dma_addr_t mbox_dma_h;
mbox_sgl64 *sgl64;
mbox_sgl32 *sgl32;
dma_addr_t sgl_dma_h;
mraid_passthru_t *pthru;
dma_addr_t pthru_dma_h;
mraid_epassthru_t *epthru;
dma_addr_t epthru_dma_h;
dma_addr_t buf_dma_h;
} mbox_ccb_t;
/**
* mraid_device_t - adapter soft state structure for mailbox controllers
* @param una_mbox64 : 64-bit mbox - unaligned
* @param una_mbox64_dma : mbox dma addr - unaligned
* @param mbox : 32-bit mbox - aligned
* @param mbox64 : 64-bit mbox - aligned
* @param mbox_dma : mbox dma addr - aligned
* @param mailbox_lock : exclusion lock for the mailbox
* @param baseport : base port of hba memory
* @param baseaddr : mapped addr of hba memory
* @param mbox_pool : pool of mailboxes
* @param mbox_pool_handle : handle for the mailbox pool memory
* @param epthru_pool : a pool for extended passthru commands
* @param epthru_pool_handle : handle to the pool above
* @param sg_pool : pool of scatter-gather lists for this driver
* @param sg_pool_handle : handle to the pool above
* @param ccb_list : list of our command control blocks
* @param uccb_list : list of cmd control blocks for mgmt module
* @param umbox64 : array of mailbox for user commands (cmm)
* @param pdrv_state : array for state of each physical drive.
* @param last_disp : flag used to show device scanning
* @param hw_error : set if FW not responding
* @param fast_load : If set, skip physical device scanning
* @channel_class : channel class, RAID or SCSI
*
* Initialization structure for mailbox controllers: memory based and IO based
* All the fields in this structure are LLD specific and may be discovered at
* init() or start() time.
*
* NOTE: The fields of this structures are placed to minimize cache misses
*/
typedef struct {
mbox64_t *una_mbox64;
dma_addr_t una_mbox64_dma;
mbox_t *mbox;
mbox64_t *mbox64;
dma_addr_t mbox_dma;
spinlock_t mailbox_lock;
unsigned long baseport;
unsigned long baseaddr;
struct mraid_pci_blk mbox_pool[MBOX_MAX_SCSI_CMDS];
struct dma_pool *mbox_pool_handle;
struct mraid_pci_blk epthru_pool[MBOX_MAX_SCSI_CMDS];
struct dma_pool *epthru_pool_handle;
struct mraid_pci_blk sg_pool[MBOX_MAX_SCSI_CMDS];
struct dma_pool *sg_pool_handle;
mbox_ccb_t ccb_list[MBOX_MAX_SCSI_CMDS];
mbox_ccb_t uccb_list[MBOX_MAX_USER_CMDS];
mbox64_t umbox64[MBOX_MAX_USER_CMDS];
uint8_t pdrv_state[MBOX_MAX_PHYSICAL_DRIVES];
uint32_t last_disp;
int hw_error;
int fast_load;
uint8_t channel_class;
} mraid_device_t;
// route to raid device from adapter
#define ADAP2RAIDDEV(adp) ((mraid_device_t *)((adp)->raid_device))
#define MAILBOX_LOCK(rdev) (&(rdev)->mailbox_lock)
// Find out if this channel is a RAID or SCSI
#define IS_RAID_CH(rdev, ch) (((rdev)->channel_class >> (ch)) & 0x01)
#define RDINDOOR(rdev) readl((rdev)->baseaddr + 0x20)
#define RDOUTDOOR(rdev) readl((rdev)->baseaddr + 0x2C)
#define WRINDOOR(rdev, value) writel(value, (rdev)->baseaddr + 0x20)
#define WROUTDOOR(rdev, value) writel(value, (rdev)->baseaddr + 0x2C)
#endif // _MEGARAID_H_
// vim: set ts=8 sw=8 tw=78:
This diff is collapsed.
/*
*
* Linux MegaRAID device driver
*
* Copyright (c) 2003-2004 LSI Logic Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* FILE : megaraid_mm.h
*/
#ifndef MEGARAID_MM_H
#define MEGARAID_MM_H
#include <linux/spinlock.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/list.h>
#include "mbox_defs.h"
#include "megaraid_ioctl.h"
#define LSI_COMMON_MOD_VERSION "2.20.0.0"
#define LSI_COMMON_MOD_EXT_VERSION \
"(Release Date: Wed Jun 23 11:38:38 EDT 2004)"
#define LSI_DBGLVL dbglevel
// The smallest dma pool
#define MRAID_MM_INIT_BUFF_SIZE 4096
/*
* Localizing ioctl32 differences
*/
#if defined (CONFIG_COMPAT) || defined(__x86_64__) || defined(IA32_EMULATION)
#if !defined(CONFIG_IA64)
#define LSI_CONFIG_COMPAT
#endif
#endif
#ifdef LSI_CONFIG_COMPAT
#include <asm/ioctl32.h>
#else
#define register_ioctl32_conversion(a,b) do{}while(0)
#define unregister_ioctl32_conversion(a) do{}while(0)
#endif /* LSI_CONFIG_COMPAT */
/**
* mimd_t : Old style ioctl packet structure (deprecated)
*
* @inlen :
* @outlen :
* @fca :
* @opcode :
* @subopcode :
* @adapno :
* @buffer :
* @pad :
* @length :
* @mbox :
* @pthru :
* @data :
* @pad :
*
* Note : This structure is DEPRECATED. New applications must use
* : uioc_t structure instead. All new hba drivers use the new
* : format. If we get this mimd packet, we will convert it into
* : new uioc_t format and send it to the hba drivers.
*/
typedef struct mimd {
uint32_t inlen;
uint32_t outlen;
union {
uint8_t fca[16];
struct {
uint8_t opcode;
uint8_t subopcode;
uint16_t adapno;
#if BITS_PER_LONG == 32
uint8_t *buffer;
uint8_t pad[4];
#endif
#if BITS_PER_LONG == 64
uint8_t *buffer;
#endif
uint32_t length;
} __attribute__ ((packed)) fcs;
} __attribute__ ((packed)) ui;
uint8_t mbox[18]; /* 16 bytes + 2 status bytes */
mraid_passthru_t pthru;
#if BITS_PER_LONG == 32
char *data; /* buffer <= 4096 for 0x80 commands */
char pad[4];
#endif
#if BITS_PER_LONG == 64
char *data;
#endif
} __attribute__ ((packed))mimd_t;
// Entry points for char node driver
static int mraid_mm_open(struct inode *, struct file *);
static int mraid_mm_ioctl(struct inode *, struct file *, uint, unsigned long);
// routines to convert to and from the old the format
static int mimd_to_kioc(mimd_t *, mraid_mmadp_t *, uioc_t *);
static int kioc_to_mimd(uioc_t *, mimd_t *);
// Helper functions
static int handle_drvrcmd(unsigned long, uint8_t, int *);
static int lld_ioctl(mraid_mmadp_t *, uioc_t *);
static void ioctl_done(uioc_t *);
static void lld_timedout(unsigned long);
static void hinfo_to_cinfo(mraid_hba_info_t *, mcontroller_t *);
static int mraid_mm_get_adpindex(mimd_t *, int *);
static uioc_t *mraid_mm_alloc_kioc(mraid_mmadp_t *);
static void mraid_mm_dealloc_kioc(mraid_mmadp_t *, uioc_t *);
static int mraid_mm_attach_buf(mraid_mmadp_t *, uioc_t *, int);
static int mraid_mm_setup_dma_pools(mraid_mmadp_t *);
static void mraid_mm_free_adp_resources(mraid_mmadp_t *);
static void mraid_mm_teardown_dma_pools(mraid_mmadp_t *);
#ifdef LSI_CONFIG_COMPAT
static int mraid_mm_compat_ioctl(unsigned int, unsigned int, unsigned long,
struct file *);
#endif
#endif // MEGARAID_MM_H
// vi: set ts=8 sw=8 tw=78:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment