mirror of https://github.com/lhw/rr272x-dkms.git
Imported Upstream version 1.5.18
parent
77a07f2a6d
commit
a7b13c2301
209
README
209
README
|
@ -1,209 +0,0 @@
|
|||
RocketRAID 271x/272x SAS Controller Linux Open Source Driver
|
||||
Copyright (C) 2013 HighPoint Technologies, Inc. All rights reserved.
|
||||
|
||||
1. Overview
|
||||
2. Build the driver as a kernel module
|
||||
3. Revision History
|
||||
4. Technical support and service
|
||||
|
||||
#############################################################################
|
||||
1. Overview
|
||||
#############################################################################
|
||||
|
||||
This package contains Linux driver code for HighPoint RocketRAID 271x/272x
|
||||
SAS controller. You can use it to build the driver module for custom
|
||||
Linux kernels.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
THE DRIVER SOURCE CODE HIGHPOINT PROVIDED IS FREE OF CHARGE, AND THERE IS
|
||||
NO WARRANTY FOR THE PROGRAM. THERE ARE NO RESTRICTIONS ON THE USE OF THIS
|
||||
FREE SOURCE CODE. HIGHPOINT DOES NOT PROVIDE ANY TECHNICAL SUPPORT IF THE
|
||||
CODE HAS BEEN CHANGED FROM ORIGINAL SOURCE CODE.
|
||||
|
||||
LIMITATION OF LIABILITY
|
||||
|
||||
IN NO EVENT WILL HIGHPOINT BE LIABLE FOR DIRECT, INDIRECT, SPECIAL,
|
||||
INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF OR
|
||||
INABILITY TO USE THIS PRODUCT OR DOCUMENTATION, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES. IN PARTICULAR, HIGHPOINT SHALL NOT HAVE
|
||||
LIABILITY FOR ANY HARDWARE, SOFTWARE, OR DATA STORED USED WITH THE
|
||||
PRODUCT, INCLUDING THE COSTS OF REPAIRING, REPLACING, OR RECOVERING
|
||||
SUCH HARDWARE, OR DATA.
|
||||
|
||||
|
||||
#############################################################################
|
||||
2. Build the driver as a kernel module
|
||||
#############################################################################
|
||||
|
||||
NOTE: The latest tested kernel version: 3.10.5.
|
||||
|
||||
1) Install kernel build tools (gcc, binutils, make, etc.)
|
||||
|
||||
2) Setup the kernel source/headers
|
||||
|
||||
To build driver modules for a specific kernel, you shall use same
|
||||
configuration for the kernel and the driver. Otherwise, the driver may
|
||||
be unable to load, or behave abnormally.
|
||||
|
||||
- For Linux kernel 2.6 and 3.* -
|
||||
|
||||
On most distributions based on kernel 2.6 and 3.*, an exploded source tree is not
|
||||
required to build a driver against the currently in-use kernel. As long
|
||||
as the system has kernel headers setup under /lib/modules/`uname -r`/build,
|
||||
you can simply run "make" to build the driver.
|
||||
|
||||
If you want to build the driver against a custom kernel source, you must
|
||||
setup the kernel source manually and run "make" under kernel source tree
|
||||
to setup kernel headers.
|
||||
|
||||
- For Linux kernel 2.4 -
|
||||
|
||||
You need a full kernel source tree to build the driver. If you are building
|
||||
a driver for the currently in-use kernel, the kernel source should match
|
||||
the version of the running kernel. In addition, you must obtain the config
|
||||
file for the running kernel:
|
||||
|
||||
For Red Hat or Fedora Linux, you can find the stock kernel config files
|
||||
under {kernel-source-dir}/configs, named kernel-*.config. Select the one
|
||||
matches your hardware and copy it to {kernel-source-dir}/.config.
|
||||
|
||||
For SuSE Linux, the config files for current kernel is under /boot dir
|
||||
so you can the kernel source by
|
||||
|
||||
# cd /usr/src/linux-{kernel-version}.SuSE
|
||||
# cp /boot/vmlinuz.config .config
|
||||
# cp /boot/vmlinuz.version.h include/linux/version.h
|
||||
# cp /boot/vmlinuz.autoconf.h include/linux/autoconf.h
|
||||
|
||||
For other distributions please refer to the distribution documents to
|
||||
obtain the config file.
|
||||
|
||||
If you are building a custom kernel and a driver, you can setup the kernel
|
||||
config by yourself, using "make config" or "make menuconfig" commands
|
||||
under kernel source directory.
|
||||
|
||||
Once the kernel config file is ready, run following commands under kernel
|
||||
source directory to setup kernel headers:
|
||||
|
||||
# make oldconfig
|
||||
# make dep
|
||||
|
||||
On some Red Hat versions, {kernel-source-dir}/include/linux/modversions.h
|
||||
may be incorrect after "make dep", you need check if there is a line
|
||||
"#include <linux/rhconfig.h>" before "#include <linux/modsetver.h>" in that
|
||||
file. If not, please add the line manually.
|
||||
|
||||
3) Build the driver
|
||||
|
||||
After you have configured the kernel source/headers you can build the driver
|
||||
by following commands (assume you have extracted the driver source under
|
||||
directory rr272x-linux-src-v1.xx):
|
||||
|
||||
# cd rr272x-linux-src-v1.xx/product/rr272x/linux/
|
||||
# make
|
||||
|
||||
You can append below options to "make" command:
|
||||
|
||||
KERNELDIR=...
|
||||
Specify kernel source directory. If not specified the driver will
|
||||
use /lib/modules/{kernel-version}/build/ as the default location.
|
||||
This option is needed if you have a manually configured kernel
|
||||
source tree.
|
||||
|
||||
CROSS_COMPILE=...
|
||||
Specify cross compiler prefix.
|
||||
|
||||
ARCH=...
|
||||
Specify target system machine architecture.
|
||||
Currently only i386 and x86_64 is supported.
|
||||
|
||||
4) Install/upgrade the driver
|
||||
|
||||
If you are building driver for currently in-use kernel you can use
|
||||
"make install" to install or upgrade the driver:
|
||||
|
||||
# cd rr272x-linux-src-v1.xx/product/rr272x/linux/
|
||||
# make install
|
||||
|
||||
The KERNELDIR=... parameter may be required, e.g.
|
||||
|
||||
# make install KERNELDIR=/usr/src/linux-2.6
|
||||
|
||||
"make install" command will copy the driver module to the directory
|
||||
/lib/modules/`uname -r`/kernel/drivers/scsi, and update the initrd file
|
||||
if it contains an old version driver.
|
||||
|
||||
If your system is installed on the controller, a reboot is required
|
||||
to make the new driver take effect.
|
||||
|
||||
Please note "make install" may not work on some distributions. In that
|
||||
case you have to install the driver manually.
|
||||
|
||||
After the driver is installed, it can be loaded manually by
|
||||
|
||||
# modprobe rr272x_1x
|
||||
|
||||
To load the driver automatically during system startup, you can either
|
||||
put it into initrd file or configure a /etc/rc.d script to load it.
|
||||
|
||||
|
||||
#############################################################################
|
||||
3. Revision History
|
||||
#############################################################################
|
||||
|
||||
v1.6.1 12/26/2013
|
||||
* Support WebGUI for OSes that not suport SCSI_PROC_FS,through SG_IO.
|
||||
|
||||
v1.5.3 08/16/2013
|
||||
* Support Linux kernel up to 3.10.
|
||||
|
||||
v1.5.1 08/12/2013
|
||||
* Add support SGPIO LED.
|
||||
|
||||
v1.5 03/25/2013
|
||||
* Add support Marvell 9715 chipset PM.
|
||||
* Fixed a compatibility issue with WD 4TB SAS HDD.
|
||||
* Add support EJ340.
|
||||
|
||||
v1.4.12.0424 04/24/2012
|
||||
* Add support for over 2TB HDD(Need to update BIOS to v1.5 or later).
|
||||
* Change to active LED by auto mode.
|
||||
* Add recover array function.
|
||||
* Support Multi-LUN.
|
||||
|
||||
v1.3.12.0217 02/17/2012
|
||||
* Fixed PM plug/unplug issue.
|
||||
|
||||
v1.2.11.1212 12/12/2011
|
||||
* Hard drive dropped, after 5 consecutive failures.
|
||||
|
||||
v1.2.11.0920 09/20/2011
|
||||
* Support Raid6.
|
||||
|
||||
v1.1.10.0325 03/25/2010
|
||||
* Kernel panic when legacy disk connected. (Fixed)
|
||||
|
||||
v1.0.10.0108 01/08/2010
|
||||
* First Linux release.
|
||||
|
||||
|
||||
#############################################################################
|
||||
4. Technical support and service
|
||||
#############################################################################
|
||||
|
||||
If you have questions about installing or using your HighPoint product,
|
||||
check the user's guide or readme file first, and you will find answers to
|
||||
most of your questions here. If you need further assistance, please
|
||||
contact us. We offer the following support and information services:
|
||||
|
||||
1) The HighPoint Web Site provides information on software upgrades,
|
||||
answers to common questions, and other topics. The Web Site is
|
||||
available from Internet 24 hours a day, 7 days a week, at
|
||||
http://www.highpoint-tech.com.
|
||||
|
||||
2) For technical support, send e-mail to support@highpoint-tech.com
|
||||
|
||||
NOTE: Before you send an e-mail, please visit our Web Site
|
||||
(http://www.highpoint-tech.com) to check if there is a new or
|
||||
updated device driver for your system.
|
|
@ -0,0 +1,3 @@
|
|||
[Unit]
|
||||
Before=network-online.target
|
||||
Wants=network-online.target
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,110 @@
|
|||
#!/bin/bash
|
||||
|
||||
# chkconfig: 12345 10 10
|
||||
# description: Rebuild driver for HighPoint HBA if kernel changed.
|
||||
### BEGIN INIT INFO
|
||||
# Provides: hptdrv-monitor
|
||||
# Required-Start:
|
||||
# Required-Stop: reboot network networking network-manager umountroot
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Build driver for HighPoint HBA if kernel changed.
|
||||
### END INIT INFO
|
||||
|
||||
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
|
||||
|
||||
quiet=1
|
||||
buildall=1
|
||||
|
||||
DAEMON=hptdrv-monitor
|
||||
pidfile=/var/run/yum.pid
|
||||
drvroot=/usr/share/hptdrv
|
||||
if test ! -d "${drvroot}"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
goon()
|
||||
{
|
||||
logecho "I am trapped"
|
||||
continue
|
||||
}
|
||||
|
||||
trap goon SIGHUP SIGINT SIGTERM
|
||||
|
||||
. ${drvroot}/hptdrv-function
|
||||
|
||||
if test "${modules}" = ""; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
temp=/var/tmp
|
||||
host=www.highpoint-tech.com
|
||||
webroot=http://${host}/linux
|
||||
|
||||
logfile=/var/log/hptdrv.log
|
||||
lock=/var/lib/hptdrv-monitor
|
||||
[ -d /var/lock/subsys ] && lock=/var/lock/subsys/hptdrv-monitor
|
||||
|
||||
mkinitrd=`type -p dracut`
|
||||
[ "$mkinitrd" = "" ] && mkinitrd=`type -p mkinitramfs`
|
||||
[ "$mkinitrd" = "" ] && mkinitrd=`type -p mkinitrd`
|
||||
|
||||
rtrn=1
|
||||
warn=1
|
||||
FORCE=0
|
||||
autoup=1
|
||||
|
||||
test "$runlevel" = "0" && warn=0
|
||||
test "$runlevel" = "6" && warn=0
|
||||
|
||||
if test "${kernels}" = ""; then
|
||||
logecho "no kernels detected."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p "${temp}"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
touch ${lock}
|
||||
start
|
||||
rtrn=$?
|
||||
;;
|
||||
force-stop)
|
||||
# do not remove this file, as reboot need this.
|
||||
#rm /var/lock/subsys/hptdrv-monitor
|
||||
FORCE=1 compile
|
||||
FORCE=1 fixboot
|
||||
rtrn=$?
|
||||
;;
|
||||
stop)
|
||||
rm -f "${logfile}"
|
||||
compile
|
||||
rtrn=$?
|
||||
if test "$rtrn" != "0"; then
|
||||
update
|
||||
rtrn=$?
|
||||
if test "$rtrn" = "0"; then
|
||||
compile
|
||||
rtrn=$?
|
||||
fi
|
||||
fi
|
||||
fixboot
|
||||
#rm -f ${lock}
|
||||
#sleep 5
|
||||
;;
|
||||
restart)
|
||||
touch ${lock}
|
||||
rtrn=0
|
||||
;;
|
||||
status)
|
||||
rtrn=0
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|status}"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $rtrn
|
||||
|
||||
# vim: expandtab ts=2 sw=2 ai
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=LSB: Build driver for HighPoint HBA if kernel changed.
|
||||
#Requires=network-online.target network.service
|
||||
Wants=network.service network-online.target
|
||||
After=network.service network-online.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/etc/init.d/hptdrv-monitor start
|
||||
ExecStop=/etc/init.d/hptdrv-monitor stop
|
||||
RemainAfterExit=yes
|
||||
TimeoutSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Rebuilding HighPoint driver ..."
|
||||
|
||||
drvroot=/usr/share/hptdrv
|
||||
|
||||
. ${drvroot}/hptdrv-function
|
||||
|
||||
if test "${modules}" = ""; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test "${kernels}" = ""; then
|
||||
logecho "no kernels detected."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FORCE=1
|
||||
export FORCE
|
||||
|
||||
rm -f "${logfile}"
|
||||
logecho "Rebuild HighPoint driver"
|
||||
compile
|
||||
rtrn=$?
|
||||
if test "$rtrn" != "0"; then
|
||||
update
|
||||
rtrn=$?
|
||||
if test "$rtrn" = "0"; then
|
||||
compile
|
||||
rtrn=$?
|
||||
fi
|
||||
fi
|
||||
fixboot
|
||||
|
||||
# vim: expandtab ts=2 sw=2 ai
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
drvroot=/usr/share/hptdrv
|
||||
|
||||
if test ! -d "${drvroot}"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
. ${drvroot}/hptdrv-function
|
||||
|
||||
if test "${modules}" = ""; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
logfile=/var/log/hptdrv-cron.log
|
||||
|
||||
rm -f ${logfile}
|
||||
|
||||
update
|
||||
exit $?
|
||||
|
||||
# vim: expandtab ts=2 sw=2 ai
|
18
inc/him.h
18
inc/him.h
|
@ -95,6 +95,7 @@ typedef struct _HIM_DEVICE_FLAGS
|
|||
HPT_UINT df_write_cache_enabled :1;
|
||||
HPT_UINT df_cdrom_device :1;
|
||||
HPT_UINT df_tape_device :1;
|
||||
HPT_UINT df_changer_device :1;
|
||||
HPT_UINT df_support_tcq :1;
|
||||
HPT_UINT df_tcq_enabled :1;
|
||||
HPT_UINT df_support_ncq :1;
|
||||
|
@ -172,7 +173,8 @@ IDENTIFY_DATA, *PIDENTIFY_DATA;
|
|||
typedef struct _HIM_DEVICE_CONFIG
|
||||
{
|
||||
HPT_U64 capacity;
|
||||
|
||||
HPT_U32 logical_sector_size;
|
||||
|
||||
DEVICE_FLAGS flags;
|
||||
|
||||
HPT_U8 path_id;
|
||||
|
@ -325,6 +327,18 @@ typedef struct _ScsiComm {
|
|||
}
|
||||
ScsiComm;
|
||||
|
||||
typedef struct _ScsiExtComm {
|
||||
HPT_U8 cdbLength;
|
||||
HPT_U8 senseLength;
|
||||
HPT_U8 scsiStatus;
|
||||
HPT_U8 reserve1;
|
||||
HPT_U32 dataLength;
|
||||
HPT_U8 cdb[16];
|
||||
HPT_U8 *senseBuffer;
|
||||
HPT_U8 lun[8];
|
||||
}
|
||||
ScsiExtComm;
|
||||
|
||||
|
||||
#define CTRL_CMD_REBUILD 1
|
||||
#define CTRL_CMD_VERIFY 2
|
||||
|
@ -405,6 +419,7 @@ typedef struct _COMMAND
|
|||
AtaComm Ide;
|
||||
PassthroughCmd Passthrough;
|
||||
ScsiComm Scsi;
|
||||
ScsiExtComm ScsiExt;
|
||||
R5ControlCmd R5Control;
|
||||
R1ControlCmd R1Control;
|
||||
} uCmd;
|
||||
|
@ -442,6 +457,7 @@ COMMAND, *PCOMMAND;
|
|||
#define CMD_TYPE_SCSI CMD_TYPE_ATAPI
|
||||
#define CMD_TYPE_PASSTHROUGH 3
|
||||
#define CMD_TYPE_FLUSH 4
|
||||
#define CMD_TYPE_SCSI_EXT 5
|
||||
#define CMD_TYPE_IO_INDIRECT 0x80
|
||||
|
||||
/* flush command flags */
|
||||
|
|
|
@ -83,6 +83,7 @@ typedef HPT_U32 DEVICEID;
|
|||
#define PDT_HARDDISK 1
|
||||
#define PDT_CDROM 2
|
||||
#define PDT_TAPE 3
|
||||
#define PDT_CHANGER 4
|
||||
|
||||
/*
|
||||
* Some constants.
|
||||
|
@ -144,6 +145,8 @@ typedef HPT_U32 DEVICEID;
|
|||
#define DEVICE_FLAG_ON_PM_PORT 0x00000020 /* PM port */
|
||||
#define DEVICE_FLAG_SAS 0x00000040 /* SAS device */
|
||||
#define DEVICE_FLAG_IN_ENCLOSURE 0x00000080 /* PathId is enclosure# */
|
||||
#define DEVICE_FLAG_TAPE 0x00000200 /* SAS Tape device */
|
||||
#define DEVICE_FLAG_CHANGER 0x00000400 /* SAS Changer device */
|
||||
#define DEVICE_FLAG_UNINITIALIZED 0x00010000 /* device is not initialized, can't be used to create array */
|
||||
#define DEVICE_FLAG_LEGACY 0x00020000 /* single disk & mbr contains at least one partition */
|
||||
#define DEVICE_FLAG_BAD_SECTOR_FOUND 0x00040000 /* found bad sector on target disk, set and clear by GUI */
|
||||
|
@ -343,6 +346,7 @@ typedef HPT_U32 DEVICEID;
|
|||
|
||||
#define HPT_CAP_DUMP_METADATA 0x1
|
||||
#define HPT_CAP_DISK_CHECKING 0x2
|
||||
#define HPT_CAP_REPORT_SECTOR_SIZE 0x10
|
||||
|
||||
typedef struct _DRIVER_CAPABILITIES {
|
||||
HPT_U32 dwSize;
|
||||
|
@ -789,7 +793,7 @@ typedef struct _IDENTIFY_DATA2 {
|
|||
HPT_U16 NumberOfCurrentCylinders;
|
||||
HPT_U16 NumberOfCurrentHeads;
|
||||
HPT_U16 CurrentSectorsPerTrack;
|
||||
HPT_U32 CurrentSectorCapacity;
|
||||
HPT_U32 CurrentSectorCapacity; /*word58,59 the value indecate the logical sector size. */
|
||||
HPT_U16 CurrentMultiSectorSetting;
|
||||
HPT_U32 UserAddressableSectors;
|
||||
HPT_U8 SingleWordDMASupport;
|
||||
|
|
|
@ -218,6 +218,7 @@ typedef struct hpt_raw_disk
|
|||
#endif
|
||||
__HPT_RAW_LBA real_capacity;
|
||||
__HPT_RAW_LBA head_position;
|
||||
HPT_U32 logical_sector_size;
|
||||
|
||||
HPT_U16 max_sectors_per_cmd;
|
||||
HPT_U8 max_queue_depth;
|
||||
|
@ -243,6 +244,8 @@ typedef struct hpt_raw_disk
|
|||
|
||||
HPT_UINT bad_sector : 1;
|
||||
HPT_UINT df_sas : 1;
|
||||
HPT_UINT df_tape : 1;
|
||||
HPT_UINT df_changer : 1;
|
||||
|
||||
HIM * him;
|
||||
int index;
|
||||
|
@ -471,8 +474,8 @@ void ldm_finish_cmd(PCOMMAND cmd);
|
|||
int ldm_acquire_lock(PVDEV vd, struct lock_request *req);
|
||||
void ldm_release_lock(PVDEV vd, struct lock_request *req);
|
||||
|
||||
void ldm_queue_task(struct task_queue *tq, struct tq_item *t);
|
||||
void ldm_queue_vbus_dpc(PVBUS vbus, struct tq_item *t);
|
||||
void ldm_queue_vbus_idle(PVBUS vbus, struct tq_item *t);
|
||||
|
||||
HPT_BOOL ldm_intr(PVBUS vbus);
|
||||
void ldm_run(PVBUS vbus);
|
||||
|
@ -486,8 +489,7 @@ void ldm_suspend(PVBUS vbus);
|
|||
void ldm_resume(PVBUS vbus);
|
||||
LDM_ADAPTER *ldm_resume_adapter(PVBUS vbus, PLDM_ADAPTER ldm_adapter);
|
||||
void ldm_shutdown(PVBUS vbus);/*shutdown all the controllers*/
|
||||
void ldm_pause(PVBUS vbus,HPT_BOOL IsQuiesce);/*quise all disks*/
|
||||
|
||||
|
||||
|
||||
#define HIM_EVENT_DEVICE_REMOVED 1
|
||||
#define HIM_EVENT_DEVICE_PLUGGED 2
|
||||
|
|
|
@ -93,6 +93,7 @@ ifeq ($(KERNEL_VER),)
|
|||
$(error Cannot find kernel version. Check $(KERNELDIR)/include/linux/version.h.)
|
||||
endif
|
||||
|
||||
ifneq ($(MAJOR), 4)
|
||||
ifneq ($(MAJOR), 3)
|
||||
ifneq ($(KERNEL_VER), 2.6)
|
||||
ifneq ($(KERNEL_VER), 2.4)
|
||||
|
@ -100,6 +101,7 @@ $(error Only kernel 2.4/2.6/3.x is supported but you use $(KERNEL_VER))
|
|||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(KERNEL_VER), 2.4)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define MAX_MEMBERS 64
|
||||
|
||||
#define os_max_queue_comm 64
|
||||
#define os_max_sg_descriptors 18
|
||||
#define os_max_sg_descriptors 130
|
||||
|
||||
/*
|
||||
*define it in config.c.
|
||||
|
@ -30,6 +30,7 @@ typedef unsigned short HPT_U16;
|
|||
typedef unsigned char HPT_U8;
|
||||
typedef unsigned long HPT_TIME;
|
||||
typedef unsigned long long HPT_U64;
|
||||
typedef long long HPT_64;
|
||||
|
||||
HPT_U64 CPU_TO_LE64(HPT_U64 x);
|
||||
HPT_U32 CPU_TO_LE32(HPT_U32 x);
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
|
||||
if test $(id -u) != "0"; then
|
||||
echo "Please supply root's password to install this package. "
|
||||
su -c "$0"
|
||||
ret=$?
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
MODNAME=rr272x_1x
|
||||
#`grep TARGETNAME product/*/linux/Makefile | sed s'# ##'g | cut -d\= -f2 | sed s'#\r##'`
|
||||
|
||||
#echo $MODNAME
|
||||
|
||||
if [ "$MODNAME" == "" ]; then
|
||||
echo "Could not determine driver name"
|
||||
fi
|
||||
|
||||
rm -rf product/*/linux/*.ko
|
||||
rm -rf product/*/linux/.build
|
||||
|
||||
rm -rf /usr/share/hptdrv/$MODNAME
|
||||
mkdir -p /usr/share/hptdrv/
|
||||
cp -R `pwd` /usr/share/hptdrv/$MODNAME
|
||||
rm -f /usr/share/hptdrv/$MODNAME/install.sh
|
||||
chown -R 0:0 /usr/share/hptdrv/$MODNAME
|
||||
|
||||
#touch /etc/sysconfig/hptdrv || exit 1
|
||||
#echo MODLIST=\"$MODNAME\" > /etc/sysconfig/hptdrv
|
||||
|
||||
rm -f /etc/init.d/hptdrv-monitor
|
||||
cp dist/hptdrv-function /usr/share/hptdrv/
|
||||
cp dist/hptdrv-monitor /etc/init.d/
|
||||
cp dist/hptdrv-rebuild /usr/sbin/
|
||||
cp dist/hptdrv-update /etc/cron.daily/
|
||||
chmod 755 /etc/init.d/hptdrv-monitor /usr/sbin/hptdrv-rebuild /etc/cron.daily/hptdrv-update /usr/share/hptdrv/hptdrv-function
|
||||
|
||||
. /usr/share/hptdrv/hptdrv-function
|
||||
echo "Checking and installing required toolchain and utility ..."
|
||||
|
||||
checkandinstall() {
|
||||
if ! type $1 >/dev/null 2>&1; then
|
||||
#echo "Installing program $1 ..."
|
||||
installtool $1 || return 1
|
||||
else
|
||||
echo "Found program $1 (`type -p $1`)"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
checkandinstall make
|
||||
checkandinstall gcc
|
||||
checkandinstall perl
|
||||
checkandinstall wget
|
||||
|
||||
#touch /var/lock/subsys/hptdrv-monitor
|
||||
if type update-rc.d >/dev/null 2>&1; then
|
||||
update-rc.d -f hptdrv-monitor remove >/dev/null 2>&1
|
||||
update-rc.d hptdrv-monitor defaults >/dev/null 2>&1
|
||||
elif type systemctl >/dev/null 2>&1; then
|
||||
if test -d "/lib/systemd/system"; then
|
||||
# ubuntu14.10
|
||||
cp dist/hptdrv-monitor.service /lib/systemd/system/
|
||||
else
|
||||
cp dist/hptdrv-monitor.service /usr/lib/systemd/system/
|
||||
fi
|
||||
# suse 13.1 bug
|
||||
if test -f "/usr/lib/systemd/system/network@.service"; then
|
||||
mkdir -p "/usr/lib/systemd/system/network@.service.d/"
|
||||
cp dist/50-before-network-online.conf "/usr/lib/systemd/system/network@.service.d/"
|
||||
fi
|
||||
systemctl daemon-reload >/dev/null 2>&1
|
||||
systemctl enable hptdrv-monitor
|
||||
systemctl start hptdrv-monitor > /dev/null 2>&1
|
||||
elif type insserv >/dev/null 2>&1; then
|
||||
insserv -r /etc/init.d/hptdrv-monitor
|
||||
insserv /etc/init.d/hptdrv-monitor
|
||||
else
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc0.d/K01hptdrv-monitor
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc6.d/K01hptdrv-monitor
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc1.d/S01hptdrv-monitor
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc2.d/S01hptdrv-monitor
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc3.d/S01hptdrv-monitor
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc4.d/S01hptdrv-monitor
|
||||
ln -sf ../init.d/hptdrv-monitor /etc/rc5.d/S01hptdrv-monitor
|
||||
fi
|
||||
|
||||
/etc/init.d/hptdrv-monitor start
|
||||
|
||||
/etc/init.d/hptdrv-monitor force-stop
|
||||
|
||||
# vim: expandtab ts=2 sw=2 ai
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -183,11 +183,39 @@ static void hpt_dump_devinfo(HPT_GET_INFO *pinfo, DEVICEID id, int indent)
|
|||
devinfo.u.device.TargetId+1,
|
||||
devinfo.u.device.IdentifyData.ModelNumber
|
||||
);
|
||||
else if (devinfo.u.device.Flags & DEVICE_FLAG_TAPE){
|
||||
memcpy(sn, devinfo.u.device.IdentifyData.SerialNumber,
|
||||
sizeof(devinfo.u.device.IdentifyData.SerialNumber));
|
||||
ldm_ide_fixstring(sn, (sizeof(sn) & (~1)));
|
||||
sn[sizeof(sn) - 1] = 0;
|
||||
hpt_copy_info(pinfo, "%d/%s%d/%d %s-%s, SAS Tape Device, %s\n",
|
||||
devinfo.u.device.ControllerId+1,
|
||||
(devinfo.u.device.Flags & DEVICE_FLAG_IN_ENCLOSURE) ? "E" : "",
|
||||
devinfo.u.device.PathId+1,
|
||||
devinfo.u.device.TargetId+1,
|
||||
devinfo.u.device.IdentifyData.ModelNumber, sn,
|
||||
(devinfo.u.device.Flags & DEVICE_FLAG_DISABLED)? "Disabled" : "Normal"
|
||||
);
|
||||
}
|
||||
else if (devinfo.u.device.Flags & DEVICE_FLAG_CHANGER){
|
||||
memcpy(sn, devinfo.u.device.IdentifyData.SerialNumber,
|
||||
sizeof(devinfo.u.device.IdentifyData.SerialNumber));
|
||||
ldm_ide_fixstring(sn, (sizeof(sn) & (~1)));
|
||||
sn[sizeof(sn) - 1] = 0;
|
||||
hpt_copy_info(pinfo, "%d/%s%d/%d %s-%s, SAS Changer Device, %s\n",
|
||||
devinfo.u.device.ControllerId+1,
|
||||
(devinfo.u.device.Flags & DEVICE_FLAG_IN_ENCLOSURE) ? "E" : "",
|
||||
devinfo.u.device.PathId+1,
|
||||
devinfo.u.device.TargetId+1,
|
||||
devinfo.u.device.IdentifyData.ModelNumber, sn,
|
||||
(devinfo.u.device.Flags & DEVICE_FLAG_DISABLED)? "Disabled" : "Normal"
|
||||
);
|
||||
}
|
||||
else {
|
||||
memcpy(sn, devinfo.u.device.IdentifyData.SerialNumber,
|
||||
sizeof(devinfo.u.device.IdentifyData.SerialNumber));
|
||||
ldm_ide_fixstring(sn, (sizeof(sn) & (~1)));
|
||||
sn[sizeof(sn) - 1] = 0;
|
||||
sn[sizeof(sn) - 1] = 0;
|
||||
hpt_copy_info(pinfo, "%d/%s%d/%d %s-%s, %dMB, %s %s%s%s%s\n",
|
||||
devinfo.u.device.ControllerId+1,
|
||||
(devinfo.u.device.Flags & DEVICE_FLAG_IN_ENCLOSURE) ? "E" : "",
|
||||
|
|
|
@ -149,13 +149,13 @@ debian | ubuntu )
|
|||
rm /boot/initrd.img-${MODVER}
|
||||
fi
|
||||
fi
|
||||
# if [ -f /etc/initramfs-tools/initramfs.conf ]; then
|
||||
# if grep ^ROOTDELAY -s -q /etc/initramfs-tools/initramfs.conf; then
|
||||
# sed -i s"#^ROOTDELAY.*#ROOTDELAY=180#" /etc/initramfs-tools/initramfs.conf
|
||||
# else
|
||||
# echo "ROOTDELAY=180" >> /etc/initramfs-tools/initramfs.conf
|
||||
# fi
|
||||
# fi
|
||||
#if [ -f /etc/initramfs-tools/initramfs.conf ]; then
|
||||
# if grep ^ROOTDELAY -s -q /etc/initramfs-tools/initramfs.conf; then
|
||||
# sed -i s"#^ROOTDELAY.*#ROOTDELAY=180#" /etc/initramfs-tools/initramfs.conf
|
||||
# else
|
||||
# echo "ROOTDELAY=180" >> /etc/initramfs-tools/initramfs.conf
|
||||
# fi
|
||||
#fi
|
||||
$MKINITRD -o /boot/initrd.img-${MODVER} ${MODVER}
|
||||
;;
|
||||
* )
|
||||
|
|
|
@ -114,10 +114,17 @@ static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
|
|||
ldm_get_mem_info((PVBUS)vbus_ext->vbus, 0);
|
||||
|
||||
for (f=vbus_ext->freelist_head; f; f=f->next) {
|
||||
/* KdPrint(("%s: %d*%d=%d bytes", */
|
||||
/* f->tag, f->count, f->size, f->count*f->size)); */
|
||||
KdPrint(("%s: %d*%d=%d bytes",
|
||||
f->tag, f->count, f->size, f->count*f->size));
|
||||
for (i=0; i<f->count; i++) {
|
||||
p = (void **)kmalloc(f->size, GFP_ATOMIC);
|
||||
if(f->size >= 0x20000) {
|
||||
/*workaround for CentOS 5.11(kernel 2.6.18), kmalloc limit 128KB*/
|
||||
int order, size;
|
||||
for (order=0, size=PAGE_SIZE; size<f->size; order++, size<<=1) ;
|
||||
p = (void **)__get_free_pages(GFP_ATOMIC, order);
|
||||
}
|
||||
else
|
||||
p = (void **)kmalloc(f->size, GFP_ATOMIC);
|
||||
if (!p) return -1;
|
||||
*p = f->head;
|
||||
f->head = p;
|
||||
|
@ -131,8 +138,8 @@ static int hpt_alloc_mem(PVBUS_EXT vbus_ext)
|
|||
|
||||
for (order=0, size=PAGE_SIZE; size<f->size; order++, size<<=1) ;
|
||||
|
||||
/* KdPrint(("%s: %d*%d=%d bytes, order %d", */
|
||||
/* f->tag, f->count, f->size, f->count*f->size, order)); */
|
||||
KdPrint(("%s: %d*%d=%d bytes, order %d",
|
||||
f->tag, f->count, f->size, f->count*f->size, order));
|
||||
HPT_ASSERT(f->alignment<=PAGE_SIZE);
|
||||
|
||||
for (i=0; i<f->count;) {
|
||||
|
@ -178,8 +185,16 @@ static void hpt_free_mem(PVBUS_EXT vbus_ext)
|
|||
/* f->tag, f->count, f->reserved_count)); */
|
||||
}
|
||||
#endif
|
||||
while ((p=freelist_get(f)))
|
||||
kfree(p);
|
||||
while ((p=freelist_get(f))) {
|
||||
if(f->size >= 0x20000) {
|
||||
/*workaround for CentOS 5.11(kernel 2.6.18), kmalloc limit 128KB*/
|
||||
int order, size;
|
||||
for (order=0, size=PAGE_SIZE; size<f->size; order++, size<<=1) ;
|
||||
free_pages((unsigned long)p, order);
|
||||
}
|
||||
else
|
||||
kfree(p);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<os_max_cache_pages; i++) {
|
||||
|
@ -373,7 +388,7 @@ static int hpt_detect (Scsi_Host_Template *tpnt)
|
|||
#else
|
||||
host->max_id = osm_max_targets +1;
|
||||
#endif
|
||||
host->max_lun = 1;
|
||||
host->max_lun = 128; /**/
|
||||
host->max_channel = 0;
|
||||
scsi_set_max_cmd_len(host, 16);
|
||||
|
||||
|
@ -785,19 +800,26 @@ static int os_buildsgl(PCOMMAND pCmd, PSG pSg, int logical)
|
|||
addr = sg_dma_address(sgList);
|
||||
length = sg_dma_len(sgList);
|
||||
/* merge the sg elements if possible */
|
||||
if (idx && last==addr && pSg->size &&
|
||||
/*if (idx && last==addr && pSg->size &&
|
||||
pSg->size+length<=0x10000 && (addr & 0xffffffff)!=0) {
|
||||
pSg->size += length;
|
||||
last += length;
|
||||
}
|
||||
else {
|
||||
if (addr & 1) return 0;
|
||||
else*/
|
||||
{
|
||||
if (addr & 1) {
|
||||
KdPrint(("os_buildsgl odd addr %p", addr));
|
||||
return 0;
|
||||
}
|
||||
pSg++;
|
||||
pSg->addr.bus = addr;
|
||||
pSg->size = length;
|
||||
last = addr + length;
|
||||
}
|
||||
if (pSg->size & 1) return 0;
|
||||
if (pSg->size & 1) {
|
||||
KdPrint(("size %x", pSg->size));
|
||||
/*return 0; */
|
||||
}
|
||||
pSg->eot = (idx==HPT_SCP(SCpnt)->sgcnt-1)? 1 : 0;
|
||||
}
|
||||
#else
|
||||
|
@ -888,6 +910,74 @@ static void hpt_scsi_start_stop_done(PCOMMAND pCmd)
|
|||
SCpnt->scsi_done(SCpnt);
|
||||
}
|
||||
}
|
||||
|
||||
static void hpt_scsi_pass_through_done(PCOMMAND pCmd)
|
||||
{
|
||||
Scsi_Cmnd *SCpnt = pCmd->priv;
|
||||
HPT_U8 ScsiStatus = pCmd->uCmd.ScsiExt.scsiStatus;
|
||||
|
||||
if (ScsiStatus == SAM_STAT_GOOD) {
|
||||
HPT_U32 dataLength;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
|
||||
dataLength = scsi_bufflen(SCpnt);
|
||||
#else
|
||||
dataLength = SCpnt->request_bufflen;
|
||||
#endif
|
||||
if ((pCmd->type == CMD_TYPE_SCSI_EXT) && (pCmd->uCmd.ScsiExt.dataLength != dataLength)) {
|
||||
KdPrint(("Update cmd %p leng - %x %x . %x", pCmd, pCmd->uCmd.ScsiExt.dataLength, scsi_bufflen(SCpnt), SCpnt->underflow));
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
|
||||
scsi_set_resid(SCpnt, scsi_bufflen(SCpnt) - pCmd->uCmd.ScsiExt.dataLength);
|
||||
#else
|
||||
SCpnt->resid = SCpnt->request_bufflen - pCmd->uCmd.ScsiExt.dataLength;
|
||||
#endif
|
||||
}
|
||||
SCpnt->result = (DID_OK << 16);
|
||||
}
|
||||
else if (ScsiStatus == SAM_STAT_CHECK_CONDITION) {
|
||||
SCpnt->result = (DRIVER_SENSE << 24) | HPT_SAM_STAT_CHECK_CONDITION;
|
||||
KdPrint(("hpt_queuecommand(%p) %d/%d/%d cdb=(%08x-%08x-%08x-%08x)", SCpnt,
|
||||
sc_channel(SCpnt), sc_target(SCpnt), sc_lun(SCpnt),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[0]),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[1]),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[2]),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[3])));
|
||||
|
||||
}
|
||||
else if (ScsiStatus == SAM_STAT_BUSY) {
|
||||
SCpnt->result = (DID_BUS_BUSY << 16);
|
||||
}
|
||||
else {
|
||||
switch(pCmd->Result) {
|
||||
case RETURN_SUCCESS:
|
||||
SCpnt->result = (DID_OK << 16);
|
||||
break;
|
||||
case RETURN_BAD_DEVICE:
|
||||
SCpnt->result = (DID_BAD_TARGET<<16);
|
||||
break;
|
||||
case RETURN_DEVICE_BUSY:
|
||||
SCpnt->result = (DID_BUS_BUSY<<16);
|
||||
break;
|
||||
case RETURN_SELECTION_TIMEOUT:
|
||||
SCpnt->result = (DID_NO_CONNECT<<16);
|
||||
break;
|
||||
case RETURN_BUS_RESET:
|
||||
SCpnt->result = (DID_RESET<<16);
|
||||
break;
|
||||
case RETURN_RETRY:
|
||||
SCpnt->result = (DID_BUS_BUSY<<16);
|
||||
break;
|
||||
default:
|
||||
SCpnt->result = ((DRIVER_INVALID|SUGGEST_ABORT)<<24) | (DID_ABORT<<16);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
KdPrint(("<8>scsi_done(%p, result %d, scsistatus %x)", SCpnt, pCmd->Result, pCmd->uCmd.ScsiExt.scsiStatus));
|
||||
|
||||
ldm_free_cmds(pCmd);
|
||||
SCpnt->scsi_done(SCpnt);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
|
||||
static int hpt_queuecommand (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
|
||||
#else
|
||||
|
@ -900,12 +990,14 @@ static int hpt_queuecommand_lck (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
|
|||
PVDEV pVDev;
|
||||
PCOMMAND pCmd;
|
||||
HPT_UINT cmds_per_request;
|
||||
|
||||
KdPrint(("<8>hpt_queuecommand(%p) %d/%d/%d/%d cdb=(%x-%x-%x)", SCpnt,
|
||||
|
||||
KdPrint(("<8>hpt_queuecommand(%p) %d/%d/%d/%d cdb=(%08x-%08x-%08x-%08x)", SCpnt,
|
||||
phost->host_no,
|
||||
sc_channel(SCpnt), sc_target(SCpnt), sc_lun(SCpnt),
|
||||
((HPT_U32 *)SCpnt->cmnd)[0], ((HPT_U32 *)SCpnt->cmnd)[1],
|
||||
((HPT_U32 *)SCpnt->cmnd)[2]));
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[0]),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[1]),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[2]),
|
||||
cpu_to_be32(((HPT_U32 *)SCpnt->cmnd)[3])));
|
||||
|
||||
__hpt_do_tasks(vbus_ext);
|
||||
|
||||
|
@ -914,12 +1006,17 @@ static int hpt_queuecommand_lck (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
|
|||
|
||||
HPT_ASSERT(done);
|
||||
|
||||
if (sc_channel(SCpnt) || sc_lun(SCpnt)) {
|
||||
if (sc_channel(SCpnt)) {
|
||||
SCpnt->result = DID_BAD_TARGET << 16;
|
||||
goto cmd_done;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SCSI_PROC_FS
|
||||
if (sc_target(SCpnt) == osm_max_targets) {
|
||||
if (sc_lun(SCpnt)) {
|
||||
SCpnt->result = DID_BAD_TARGET << 16;
|
||||
goto cmd_done;
|
||||
}
|
||||
if (SCpnt->cmnd[0]== INQUIRY) {
|
||||
PINQUIRYDATA inquiryData;
|
||||
int buflen;
|
||||
|
@ -957,12 +1054,12 @@ static int hpt_queuecommand_lck (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
|
|||
rbuf[0] = 0;
|
||||
rbuf[1] = 0x83;
|
||||
rbuf[2] = 0;
|
||||
rbuf[3] = 12;
|
||||
rbuf[3] = 12;
|
||||
rbuf[4] = 1;
|
||||
rbuf[5] = 2;
|
||||
rbuf[5] = 2;
|
||||
rbuf[6] = 0;
|
||||
rbuf[7] = 8;
|
||||
rbuf[8] = 0;
|
||||
rbuf[7] = 8;
|
||||
rbuf[8] = 0;
|
||||
rbuf[9] = 0x19;
|
||||
rbuf[10] = 0x3C;
|
||||
rbuf[11] = 0;
|
||||
|
@ -1020,6 +1117,43 @@ static int hpt_queuecommand_lck (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
|
|||
SCpnt->result = (DID_NO_CONNECT << 16);
|
||||
goto cmd_done;
|
||||
}
|
||||
|
||||
if (!mIsArray(pVDev->type) && (pVDev->u.raw.df_tape || pVDev->u.raw.df_changer || pVDev->u.raw.df_sas)) {
|
||||
pCmd = ldm_alloc_cmds(pVDev->vbus, pVDev->cmds_per_request);
|
||||
if (!pCmd) {
|
||||
HPT_ASSERT(0);
|
||||
KdPrint(("hpt_queuecommand cmd NULL"));
|
||||
return SCSI_MLQUEUE_HOST_BUSY;
|
||||
}
|
||||
|
||||
pCmd->type = CMD_TYPE_SCSI_EXT;
|
||||
pCmd->target = pVDev;
|
||||
pCmd->priv = SCpnt;
|
||||
memcpy(pCmd->uCmd.ScsiExt.cdb, SCpnt->cmnd, SCpnt->cmd_len);
|
||||
int_to_scsilun(sc_lun(SCpnt), (struct scsi_lun *)pCmd->uCmd.ScsiExt.lun);
|
||||
pCmd->uCmd.ScsiExt.cdbLength = SCpnt->cmd_len;
|
||||
pCmd->uCmd.ScsiExt.senseBuffer = SCpnt->sense_buffer;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
|
||||
pCmd->uCmd.ScsiExt.dataLength = scsi_bufflen(SCpnt);
|
||||
#else
|
||||
pCmd->uCmd.ScsiExt.dataLength = SCpnt->request_bufflen;
|
||||
#endif
|
||||
pCmd->uCmd.ScsiExt.senseLength = SCSI_SENSE_BUFFERSIZE;
|
||||
pCmd->uCmd.ScsiExt.scsiStatus = 0xff;
|
||||
if (pCmd->uCmd.ScsiExt.dataLength) {
|
||||
pCmd->flags.data_in = 1;
|
||||
pCmd->flags.data_out = 1;
|
||||
pCmd->buildsgl = os_buildsgl;
|
||||
}
|
||||
pCmd->done = hpt_scsi_pass_through_done;
|
||||
ldm_queue_cmd(pCmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sc_lun(SCpnt)) {
|
||||
SCpnt->result = DID_BAD_TARGET << 16;
|
||||
goto cmd_done;
|
||||
}
|
||||
|
||||
switch(SCpnt->cmnd[0]) {
|
||||
case START_STOP: {
|
||||
|
@ -1346,6 +1480,7 @@ set_sense:
|
|||
u32 cap;
|
||||
u8 sector_size_shift = 0;
|
||||
u64 new_cap;
|
||||
u32 sector_size = 0;
|
||||
|
||||
if (scsicmd_buf_get(SCpnt, (void **)&rbuf)<8) {
|
||||
scsicmd_buf_put(SCpnt, rbuf);
|
||||
|
@ -1355,7 +1490,20 @@ set_sense:
|
|||
|
||||
if (mIsArray(pVDev->type))
|
||||
sector_size_shift = pVDev->u.array.sector_size_shift;
|
||||
|
||||
else{
|
||||
if(pVDev->type == VD_RAW){
|
||||
sector_size = pVDev->u.raw.logical_sector_size;
|
||||
}
|
||||
|
||||
switch (sector_size) {
|
||||
case 0x1000:
|
||||
KdPrint(("set 4k setctor size in READ_CAPACITY"));
|
||||
sector_size_shift = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
new_cap = pVDev->capacity >> sector_size_shift;
|
||||
|
||||
if (new_cap > 0xfffffffful)
|
||||
|
@ -1380,10 +1528,24 @@ set_sense:
|
|||
u8 *rbuf;
|
||||
u64 cap;
|
||||
HPT_U8 sector_size_shift = 0;
|
||||
u32 sector_size = 0;
|
||||
|
||||
if(mIsArray(pVDev->type))
|
||||
sector_size_shift = pVDev->u.array.sector_size_shift;
|
||||
|
||||
else{
|
||||
if(pVDev->type == VD_RAW){
|
||||
sector_size = pVDev->u.raw.logical_sector_size;
|
||||
}
|
||||
|
||||
switch (sector_size) {
|
||||
case 0x1000:
|
||||
KdPrint(("set 4k setctor size in SERVICE_ACTION_IN"));
|
||||
sector_size_shift = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
cap = (pVDev->capacity >> sector_size_shift) - 1;
|
||||
|
||||
if (scsicmd_buf_get(SCpnt, (void **)&rbuf)<12) {
|
||||
|
@ -1420,6 +1582,9 @@ set_sense:
|
|||
case 0x8a: /* WRITE_16 */
|
||||
case 0x8f: /* VERIFY_16 */
|
||||
{
|
||||
u8 sector_size_shift = 0;
|
||||
u32 sector_size = 0;
|
||||
|
||||
if (mIsArray(pVDev->type) &&
|
||||
pVDev->u.array.transform &&
|
||||
pVDev->u.array.transform->target) {
|
||||
|
@ -1489,9 +1654,24 @@ set_sense:
|
|||
}
|
||||
|
||||
if(mIsArray(pVDev->type)) {
|
||||
pCmd->uCmd.Ide.Lba <<= pVDev->u.array.sector_size_shift;
|
||||
pCmd->uCmd.Ide.nSectors <<= pVDev->u.array.sector_size_shift;
|
||||
sector_size_shift = pVDev->u.array.sector_size_shift;
|
||||
}
|
||||
else{
|
||||
if(pVDev->type == VD_RAW){
|
||||
sector_size = pVDev->u.raw.logical_sector_size;
|
||||
}
|
||||
|
||||
switch (sector_size) {
|
||||
case 0x1000:
|
||||
KdPrint(("resize sector size from 4k to 512"));
|
||||
sector_size_shift = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
pCmd->uCmd.Ide.Lba <<= sector_size_shift;
|
||||
pCmd->uCmd.Ide.nSectors <<= sector_size_shift;
|
||||
|
||||
KdPrint(("<8>SCpnt=%p, pVDev=%p cmd=%x lba=" LBA_FORMAT_STR " nSectors=%d",
|
||||
SCpnt, pVDev, SCpnt->cmnd[0], pCmd->uCmd.Ide.Lba, pCmd->uCmd.Ide.nSectors));
|
||||
|
@ -1529,6 +1709,30 @@ cmd_done:
|
|||
static DEF_SCSI_QCMD(hpt_queuecommand)
|
||||
#endif
|
||||
|
||||
static int hpt_slave_config(struct scsi_device *sdev)
|
||||
{
|
||||
struct request_queue *q = sdev->request_queue;
|
||||
if (sdev->type == TYPE_TAPE) {
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,31)
|
||||
blk_queue_max_sectors(q, 8192);
|
||||
#else
|
||||
blk_queue_max_hw_sectors(q, 8192);
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
|
||||
set_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,36)
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, q);
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)
|
||||
q->limits.no_cluster = 0;
|
||||
#endif
|
||||
#else
|
||||
q->limits.cluster = 1;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_reset (Scsi_Cmnd *SCpnt)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = get_vbus_ext(sc_host(SCpnt));
|
||||
|
@ -1743,12 +1947,25 @@ static int hpt_release (struct Scsi_Host *host)
|
|||
}
|
||||
|
||||
#ifndef CONFIG_SCSI_PROC_FS
|
||||
static void __hpt_do_async_ioctl(PVBUS vbus,IOCTL_ARG* ioctl_args)
|
||||
static void __hpt_do_async_ioctl(PVBUS_EXT vbus_ext,IOCTL_ARG* ioctl_args)
|
||||
{
|
||||
PIOCTL_CMD ioctl_cmd;
|
||||
PVBUS_EXT ori_vbus_ext;
|
||||
unsigned long flags;
|
||||
|
||||
ioctl_cmd = ioctl_args->ioctl_cmnd;
|
||||
ioctl_cmd->vbus = vbus;
|
||||
ldm_ioctl(vbus, ioctl_args);
|
||||
ioctl_cmd->vbus = (PVBUS)vbus_ext->vbus;
|
||||
|
||||
ori_vbus_ext =get_vbus_ext(sc_host(ioctl_cmd->SCpnt));
|
||||
KdPrint(("ioctl:%d ori_vbus_ext:%p vbus_ext%p result %d",ioctl_args->dwIoControlCode&0xff,ori_vbus_ext,vbus_ext,ori_vbus_ext==vbus_ext));
|
||||
if(ori_vbus_ext != vbus_ext){
|
||||
spin_lock_irqsave(vbus_ext->lock, flags);
|
||||
}
|
||||
ldm_ioctl(ioctl_cmd->vbus, ioctl_args);
|
||||
if(ori_vbus_ext != vbus_ext){
|
||||
spin_unlock_irqrestore(vbus_ext->lock, flags);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -1774,13 +1991,13 @@ static void hpt_async_ioctl_done(struct _IOCTL_ARG *arg)
|
|||
|
||||
}
|
||||
else if (arg->result == HPT_IOCTL_RESULT_FAILED ||arg->result == HPT_IOCTL_RESULT_INVALID || arg->result == HPT_IOCTL_RESULT_RETRY){
|
||||
KdPrint(("receive ioctl_args:%p iocode:%d result:%x",ioctl_args,ioctl_args->dwIoControlCode&0xff,arg->result));
|
||||
KdPrint(("receive ioctl_args:%p iocode:%d result:%x",arg,arg->dwIoControlCode&0xff,arg->result));
|
||||
}
|
||||
else if (arg->result == HPT_IOCTL_RESULT_WRONG_VBUS){
|
||||
arg->result = HPT_IOCTL_RESULT_FAILED;
|
||||
vbus = ldm_get_next_vbus(ioctl_cmd->vbus, (void **)(void *)&vbus_ext);
|
||||
if(vbus){
|
||||
__hpt_do_async_ioctl(vbus,arg);
|
||||
__hpt_do_async_ioctl(vbus_ext,arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1798,8 +2015,9 @@ void hpt_do_async_ioctl(Scsi_Cmnd * SCpnt)
|
|||
HPT_U8 *buf = 0;
|
||||
IOCTL_ARG* ioctl_args = 0;
|
||||
PIOCTL_CMD ioctl_cmd = 0;
|
||||
PVBUS vbus;
|
||||
PVBUS_EXT vbus_ext;
|
||||
PVBUS first_vbus;
|
||||
PVBUS_EXT first_vbus_ext;
|
||||
|
||||
if ((buflen = scsicmd_buf_get(SCpnt, (void **)&buf))<4) {
|
||||
OsPrint(("invalid ioctl cmd,return"));
|
||||
goto deal_err;
|
||||
|
@ -1841,10 +2059,8 @@ void hpt_do_async_ioctl(Scsi_Cmnd * SCpnt)
|
|||
ioctl_cmd->SCpnt = SCpnt;
|
||||
ioctl_args->result = -1;
|
||||
|
||||
KdPrint(("send ioctl_args:%p iocode:%d",ioctl_args,ioctl_args->dwIoControlCode&0xff));
|
||||
|
||||
vbus = ldm_get_next_vbus(0, (void **)(void *)&vbus_ext);
|
||||
__hpt_do_async_ioctl(vbus,ioctl_args);
|
||||
first_vbus = ldm_get_next_vbus(0, (void **)(void *)&first_vbus_ext);
|
||||
__hpt_do_async_ioctl(first_vbus_ext,ioctl_args);
|
||||
return;
|
||||
|
||||
deal_err:
|
||||
|
@ -2354,7 +2570,7 @@ static Scsi_Host_Template driver_template = {
|
|||
eh_bus_reset_handler: hpt_reset,
|
||||
ioctl: hpt_scsi_ioctl,
|
||||
can_queue: os_max_queue_comm,
|
||||
sg_tablesize: os_max_sg_descriptors-1,
|
||||
sg_tablesize: os_max_sg_descriptors - 2,
|
||||
cmd_per_lun: os_max_queue_comm,
|
||||
unchecked_isa_dma: 0,
|
||||
emulated: 0,
|
||||
|
@ -2371,15 +2587,16 @@ static Scsi_Host_Template driver_template = {
|
|||
highmem_io: 1,
|
||||
#endif
|
||||
#else /* 2.6.x */
|
||||
proc_name: driver_name,
|
||||
proc_name: driver_name,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
|
||||
proc_info: hpt_proc_info26,
|
||||
proc_info: hpt_proc_info26,
|
||||
#else
|
||||
show_info: hpt_proc_info310_get,
|
||||
write_info: hpt_proc_info310_set,
|
||||
#endif
|
||||
max_sectors: 128,
|
||||
max_sectors: 128,
|
||||
#endif
|
||||
slave_configure: hpt_slave_config,
|
||||
this_id: -1
|
||||
};
|
||||
|
||||
|
|
|
@ -284,7 +284,6 @@ typedef struct _vbus_ext {
|
|||
}
|
||||
VBUS_EXT, *PVBUS_EXT;
|
||||
|
||||
|
||||
typedef struct _ioctl_cmd {
|
||||
IOCTL_ARG ioctl_args;
|
||||
HPT_U32 bytesReturned;
|
||||
|
|
|
@ -24,7 +24,7 @@ int init_config(void)
|
|||
|
||||
char driver_name[] = "rr272x_1x";
|
||||
char driver_name_long[] = "RocketRAID 272x_1x controller driver";
|
||||
char driver_ver[] = "v1.6.1 (" __DATE__ " " __TIME__ ")";
|
||||
char driver_ver[] = "v1.5.18";
|
||||
int osm_max_targets = 32;
|
||||
int os_max_cache_size = 0x2000000;
|
||||
|
||||
|
|
Loading…
Reference in New Issue