Add the 'hptrr' driver for supporting the following Highpoint RocketRAID
cards: o RocketRAID 172x series o RocketRAID 174x series o RocketRAID 2210 o RocketRAID 222x series o RocketRAID 2240 o RocketRAID 230x series o RocketRAID 231x series o RocketRAID 232x series o RocketRAID 2340 o RocketRAID 2522 Many thanks to Highpoint for their continued support of FreeBSD. Submitted by: Highpoint
This commit is contained in:
parent
dd3456c071
commit
b063a42270
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174604
@ -103,6 +103,7 @@ MAN= aac.4 \
|
||||
hme.4 \
|
||||
${_hptiop.4} \
|
||||
${_hptmv.4} \
|
||||
${_hptrr.4} \
|
||||
hwpmc.4 \
|
||||
ichsmb.4 \
|
||||
${_ichwd.4} \
|
||||
@ -547,6 +548,7 @@ _asmc.4= asmc.4
|
||||
_coretemp.4= coretemp.4
|
||||
_hptiop.4= hptiop.4
|
||||
_hptmv.4= hptmv.4
|
||||
_hptrr.4= hptrr.4
|
||||
_ichwd.4= ichwd.4
|
||||
_if_nfe.4= if_nfe.4
|
||||
_if_nve.4= if_nve.4
|
||||
|
126
share/man/man4/hptrr.4
Normal file
126
share/man/man4/hptrr.4
Normal file
@ -0,0 +1,126 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Me
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 14, 2007
|
||||
.Dt HPTRR 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm hptrr
|
||||
.Nd "HighPoint RocketRAID device driver"
|
||||
.Sh SYNOPSIS
|
||||
To compile this driver into the kernel,
|
||||
place the following line in your
|
||||
kernel configuration file:
|
||||
.Bd -ragged -offset indent
|
||||
.Cd "device hptrr"
|
||||
.Cd "device scbus"
|
||||
.Cd "device da"
|
||||
.Ed
|
||||
.Pp
|
||||
Alternatively, to load the driver as a
|
||||
module at boot time, place the following line in
|
||||
.Xr loader.conf 5 :
|
||||
.Bd -literal -offset indent
|
||||
hptrr_load="YES"
|
||||
.Ed
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides support for HighPoint's RocketRAID based RAID controllers.
|
||||
.Pp
|
||||
These devices support SATA/ATA disk drives
|
||||
and provide RAID0 (striping), RAID1 (mirroring), and RAID5 functionality.
|
||||
.Sh HARDWARE
|
||||
The
|
||||
.Nm
|
||||
driver supports the following RAID
|
||||
controllers:
|
||||
.Pp
|
||||
.Bl -bullet -compact
|
||||
.It
|
||||
RocketRAID 172x series
|
||||
.It
|
||||
RocketRAID 174x series
|
||||
.It
|
||||
RocketRAID 2210
|
||||
.It
|
||||
RocketRAID 222x series
|
||||
.It
|
||||
RocketRAID 2240
|
||||
.It
|
||||
RocketRAID 230x series
|
||||
.It
|
||||
RocketRAID 231x series
|
||||
.It
|
||||
RocketRAID 232x series
|
||||
.It
|
||||
RocketRAID 2340
|
||||
.It
|
||||
RocketRAID 2522
|
||||
.El
|
||||
.Sh NOTES
|
||||
The
|
||||
.Nm
|
||||
driver only works on the i386 and amd64 platforms as it requires a binary
|
||||
blob object from the manufacturer which they only supply for these platforms.
|
||||
The
|
||||
.Nm
|
||||
driver does
|
||||
.Em not
|
||||
work on i386 with
|
||||
.Xr pae 4
|
||||
enabled.
|
||||
.Pp
|
||||
This driver does not support the RR182x series controller.
|
||||
See the
|
||||
.Xr hptmv 4
|
||||
manual page for details on support.
|
||||
.Sh SEE ALSO
|
||||
.Xr cam 4 ,
|
||||
.Xr hptmv 4 ,
|
||||
.Xr loader 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
device driver first appeared in
|
||||
.Fx 5.3 .
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
The
|
||||
.Nm
|
||||
device driver was written by
|
||||
.An HighPoint Technologies, Inc. ,
|
||||
and ported to
|
||||
.Fx
|
||||
by
|
||||
.An Scott Long .
|
||||
This manual page was written by
|
||||
.An David E. O'Brien .
|
||||
.Sh BUGS
|
||||
The
|
||||
.Nm
|
||||
driver does not support manipulating the RAID from the OS, RAIDs need
|
||||
to be set up from the on-board BIOS.
|
@ -131,6 +131,7 @@ device arcmsr # Areca SATA II RAID
|
||||
device ciss # Compaq Smart RAID 5*
|
||||
device dpt # DPT Smartcache III, IV - See NOTES for options
|
||||
device hptmv # Highpoint RocketRAID 182x
|
||||
device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx
|
||||
device rr232x # Highpoint RocketRAID 232x
|
||||
device iir # Intel Integrated RAID
|
||||
device ips # IBM (Adaptec) ServeRAID
|
||||
|
@ -372,10 +372,14 @@ device aac
|
||||
device aacp # SCSI Passthrough interface (optional, CAM required)
|
||||
|
||||
#
|
||||
# Highpoint RocketRAID 182x. This is really just software RAID on a
|
||||
# Marvell SATA chip.
|
||||
# Highpoint RocketRAID 182x.
|
||||
device hptmv
|
||||
|
||||
#
|
||||
# Highpoint RocketRAID. Supports RR172x, RR222x, RR2240, RR232x, RR2340,
|
||||
# RR2210, RR174x, RR2522, RR231x, RR230x.
|
||||
device hptrr
|
||||
|
||||
#
|
||||
# Highpoint RocketRAID 232x. This is software RAID but with hardware
|
||||
# acceleration assistance for RAID_5.
|
||||
|
@ -72,6 +72,11 @@ hptmvraid.o optional hptmv \
|
||||
dependency "$S/dev/hptmv/amd64-elf.raid.o.uu" \
|
||||
compile-with "uudecode < $S/dev/hptmv/amd64-elf.raid.o.uu" \
|
||||
no-implicit-rule
|
||||
hptrr_lib.o optional hptrr \
|
||||
dependency "$S/dev/hptrr/amd64-elf.hptrr_lib.o.uu" \
|
||||
compile-with "uudecode < $S/dev/hptrr/amd64-elf.hptrr_lib.o.uu" \
|
||||
no-implicit-rule
|
||||
#
|
||||
rr232x_lib.o optional rr232x \
|
||||
dependency "$S/dev/rr232x/amd64-elf.rr232x_lib.o.uu" \
|
||||
compile-with "uudecode < $S/dev/rr232x/amd64-elf.rr232x_lib.o.uu" \
|
||||
@ -183,6 +188,9 @@ dev/hptmv/mv.c optional hptmv
|
||||
dev/hptmv/gui_lib.c optional hptmv
|
||||
dev/hptmv/hptproc.c optional hptmv
|
||||
dev/hptmv/ioctl.c optional hptmv
|
||||
dev/hptrr/hptrr_os_bsd.c optional hptrr
|
||||
dev/hptrr/hptrr_osm_bsd.c optional hptrr
|
||||
dev/hptrr/hptrr_config.c optional hptrr
|
||||
dev/hwpmc/hwpmc_amd.c optional hwpmc
|
||||
dev/hwpmc/hwpmc_piv.c optional hwpmc
|
||||
dev/hwpmc/hwpmc_x86.c optional hwpmc
|
||||
|
@ -77,12 +77,16 @@ hptmvraid.o optional hptmv \
|
||||
compile-with "uudecode < $S/dev/hptmv/i386-elf.raid.o.uu" \
|
||||
no-implicit-rule
|
||||
#
|
||||
hptrr_lib.o optional hptrr \
|
||||
dependency "$S/dev/hptrr/i386-elf.hptrr_lib.o.uu" \
|
||||
compile-with "uudecode < $S/dev/hptrr/i386-elf.hptrr_lib.o.uu" \
|
||||
no-implicit-rule
|
||||
#
|
||||
rr232x_lib.o optional rr232x \
|
||||
dependency "$S/dev/rr232x/i386-elf.rr232x_lib.o.uu" \
|
||||
compile-with "uudecode < $S/dev/rr232x/i386-elf.rr232x_lib.o.uu" \
|
||||
no-implicit-rule
|
||||
#
|
||||
#
|
||||
compat/linprocfs/linprocfs.c optional linprocfs
|
||||
compat/linsysfs/linsysfs.c optional linsysfs
|
||||
compat/linux/linux_emul.c optional compat_linux
|
||||
@ -194,6 +198,9 @@ dev/hptmv/mv.c optional hptmv
|
||||
dev/hptmv/gui_lib.c optional hptmv
|
||||
dev/hptmv/hptproc.c optional hptmv
|
||||
dev/hptmv/ioctl.c optional hptmv
|
||||
dev/hptrr/hptrr_os_bsd.c optional hptrr
|
||||
dev/hptrr/hptrr_osm_bsd.c optional hptrr
|
||||
dev/hptrr/hptrr_config.c optional hptrr
|
||||
dev/hwpmc/hwpmc_amd.c optional hwpmc
|
||||
dev/hwpmc/hwpmc_pentium.c optional hwpmc
|
||||
dev/hwpmc/hwpmc_piv.c optional hwpmc
|
||||
|
13120
sys/dev/hptrr/amd64-elf.hptrr_lib.o.uu
Normal file
13120
sys/dev/hptrr/amd64-elf.hptrr_lib.o.uu
Normal file
File diff suppressed because it is too large
Load Diff
187
sys/dev/hptrr/array.h
Normal file
187
sys/dev/hptrr/array.h
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/*
|
||||
* $Id: array.h,v 1.40 2007/03/12 10:05:44 gmm Exp $
|
||||
* Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _HPT_ARRAY_H_
|
||||
#define _HPT_ARRAY_H_
|
||||
|
||||
#define VERMAGIC_ARRAY 40
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_ARRAY_NAME 16
|
||||
|
||||
#ifndef MAX_MEMBERS
|
||||
#define MAX_MEMBERS 16
|
||||
#endif
|
||||
|
||||
#if MAX_MEMBERS<=16
|
||||
typedef HPT_U16 HPT_MMASK;
|
||||
#elif MAX_MEMBERS<=32
|
||||
typedef HPT_U32 HPT_MMASK;
|
||||
#elif MAX_MEMBERS<=64
|
||||
typedef HPT_U64 HPT_MMASK;
|
||||
#else
|
||||
#error "MAX_MEMBERS too large"
|
||||
#endif
|
||||
|
||||
#define HPT_MMASK_VALUE(x) (HPT_MMASK)((HPT_MMASK)1<<(x))
|
||||
|
||||
#if MAX_MEMBERS<32
|
||||
#define HPT_MMASK_VALUE_SAFE(x) HPT_MMASK_VALUE(x)
|
||||
#else
|
||||
#define HPT_MMASK_VALUE_SAFE(x) ((x)>=MAX_MEMBERS? (HPT_MMASK)0 : HPT_MMASK_VALUE(x))
|
||||
#endif
|
||||
|
||||
#define MAX_REBUILD_SECTORS 128
|
||||
|
||||
typedef struct _RAID_FLAGS {
|
||||
HPT_UINT rf_need_initialize : 1;
|
||||
HPT_UINT rf_need_rebuild: 1;
|
||||
HPT_UINT rf_need_sync: 1;
|
||||
/* ioctl flags */
|
||||
HPT_UINT rf_auto_rebuild: 1;
|
||||
HPT_UINT rf_rebuilding: 1;
|
||||
HPT_UINT rf_verifying: 1;
|
||||
HPT_UINT rf_initializing: 1;
|
||||
HPT_UINT rf_abort_verifying: 1;
|
||||
HPT_UINT rf_raid15: 1;
|
||||
HPT_UINT rf_v3_format : 1;
|
||||
HPT_UINT rf_need_transform : 1;
|
||||
HPT_UINT rf_transforming : 1;
|
||||
HPT_UINT rf_abort_transform : 1;
|
||||
HPT_UINT rf_log_write: 1;
|
||||
} RAID_FLAGS;
|
||||
|
||||
typedef struct transform_cmd_ext
|
||||
{
|
||||
HPT_LBA lba;
|
||||
HPT_U16 total_sectors;
|
||||
HPT_U16 finished_sectors;
|
||||
} TRANSFORM_CMD_EXT , *PTRANSFORM_CMD_EXT;
|
||||
|
||||
|
||||
#define TO_MOVE_DATA 0
|
||||
#define TO_INITIALIZE 1
|
||||
#define TO_INITIALIZE_ONLY 2
|
||||
#define TO_MOVE_DATA_ONLY 3
|
||||
typedef struct hpt_transform
|
||||
{
|
||||
HPT_U32 stamp;
|
||||
PVDEV source;
|
||||
PVDEV target;
|
||||
struct list_head link;
|
||||
HPT_U8 transform_from_tail;
|
||||
struct tq_item task;
|
||||
|
||||
struct lock_request lock;
|
||||
TRANSFORM_CMD_EXT cmdext;
|
||||
|
||||
HPT_U64 transform_point;
|
||||
HPT_U16 transform_sectors_per_step;
|
||||
HPT_U8 operation;
|
||||
HPT_U8 disabled;
|
||||
} HPT_TRANSFORM, *PHPT_TRANSFORM;
|
||||
|
||||
typedef struct hpt_array
|
||||
{
|
||||
HPT_U32 array_stamp;
|
||||
HPT_U32 data_stamp;
|
||||
|
||||
HPT_U8 ndisk;
|
||||
HPT_U8 block_size_shift;
|
||||
HPT_U16 strip_width;
|
||||
|
||||
|
||||
HPT_MMASK outdated_members;
|
||||
HPT_MMASK offline_members;
|
||||
|
||||
PVDEV member[MAX_MEMBERS];
|
||||
|
||||
RAID_FLAGS flags;
|
||||
|
||||
HPT_U64 rebuilt_sectors;
|
||||
|
||||
|
||||
HPT_U8 name[MAX_ARRAY_NAME];
|
||||
PHPT_TRANSFORM transform;
|
||||
|
||||
TIME_RECORD create_time;
|
||||
HPT_U8 description[64];
|
||||
HPT_U8 create_manager[16];
|
||||
|
||||
#ifdef OS_SUPPORT_TASK
|
||||
int floating_priority;
|
||||
OSM_TASK ioctl_task;
|
||||
IOCTL_ARG ioctl_arg;
|
||||
|
||||
char ioctl_inbuf[sizeof(PVDEV)+sizeof(HPT_U64)+sizeof(HPT_U16)];
|
||||
char ioctl_outbuf[sizeof(HPT_UINT)];
|
||||
#endif
|
||||
|
||||
} HPT_ARRAY, *PHPT_ARRAY;
|
||||
|
||||
#ifdef OS_SUPPORT_TASK
|
||||
void ldm_start_rebuild(struct _VDEV *pArray);
|
||||
#else
|
||||
#define ldm_start_rebuild(pArray)
|
||||
#endif
|
||||
|
||||
typedef struct _raw_partition{
|
||||
struct _raw_partition * next;
|
||||
HPT_RAW_LBA start;
|
||||
HPT_RAW_LBA capacity;
|
||||
PVDEV vd_part;
|
||||
} RAW_PARTITION, *PRAW_PARTITION;
|
||||
|
||||
typedef struct hpt_partiton
|
||||
{
|
||||
PVDEV raw_disk;
|
||||
HPT_RAW_LBA des_location;
|
||||
PRAW_PARTITION raw_part;
|
||||
HPT_U8 del_mbr;
|
||||
HPT_U8 reserved[3];
|
||||
} HPT_PARTITION, *PHPT_PARTITION;
|
||||
|
||||
HPT_U16 get_strip_size(PVDEV vd);
|
||||
|
||||
void ldm_check_array_online(PVDEV pArray);
|
||||
void ldm_generic_member_failed(PVDEV member);
|
||||
void ldm_sync_array_info(PVDEV pArray);
|
||||
void ldm_sync_array_stamp(PVDEV pArray);
|
||||
void ldm_add_spare_to_array(PVDEV pArray, PVDEV spare_partition);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
438
sys/dev/hptrr/him.h
Normal file
438
sys/dev/hptrr/him.h
Normal file
@ -0,0 +1,438 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/*
|
||||
* $Id: him.h,v 1.41 2007/01/12 09:12:49 gmm Exp $
|
||||
* Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _HPT_HIM_H_
|
||||
#define _HPT_HIM_H_
|
||||
|
||||
#define VERMAGIC_HIM 41
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <dev/hptrr/list.h>
|
||||
|
||||
#define SECTOR_TO_BYTE_SHIFT 9
|
||||
#define SECTOR_TO_BYTE(x) ((HPT_U32)(x) << SECTOR_TO_BYTE_SHIFT)
|
||||
#define BYTE_TO_SECTOR(x) ((x)>>SECTOR_TO_BYTE_SHIFT)
|
||||
|
||||
typedef struct _PCI_ID
|
||||
{
|
||||
HPT_U16 vid;
|
||||
HPT_U16 did;
|
||||
HPT_U32 subsys;
|
||||
HPT_U8 rev;
|
||||
HPT_U8 nbase;
|
||||
HPT_U16 reserve;
|
||||
}
|
||||
PCI_ID;
|
||||
|
||||
typedef struct _PCI_ADDRESS
|
||||
{
|
||||
HPT_U8 tree;
|
||||
HPT_U8 bus;
|
||||
HPT_U8 device;
|
||||
HPT_U8 function;
|
||||
}
|
||||
PCI_ADDRESS;
|
||||
|
||||
typedef struct _HIM_ADAPTER_CONFIG
|
||||
{
|
||||
PCI_ADDRESS pci_addr;
|
||||
PCI_ID pci_id;
|
||||
|
||||
HPT_U8 max_devices;
|
||||
HPT_U8 reserve1;
|
||||
|
||||
HPT_U8 bDevsPerBus;
|
||||
HPT_U8 first_on_slot;
|
||||
|
||||
HPT_U8 bChipType;
|
||||
HPT_U8 bChipIntrNum;
|
||||
HPT_U8 bChipFlags;
|
||||
HPT_U8 bNumBuses;
|
||||
|
||||
HPT_U8 szVendorID[36];
|
||||
HPT_U8 szProductID[36];
|
||||
}
|
||||
HIM_ADAPTER_CONFIG, *PHIM_ADAPTER_CONFIG;
|
||||
|
||||
typedef struct _HIM_CHANNEL_CONFIG
|
||||
{
|
||||
HPT_U32 io_port;
|
||||
HPT_U32 ctl_port;
|
||||
} HIM_CHANNEL_CONFIG, *PHIM_CHANNEL_CONFIG;
|
||||
|
||||
typedef struct _HIM_DEVICE_FLAGS
|
||||
{
|
||||
HPT_U32 df_atapi :1;
|
||||
HPT_U32 df_removable_drive :1;
|
||||
HPT_U32 df_on_line :1;
|
||||
HPT_U32 df_reduce_mode :1;
|
||||
HPT_U32 df_sata :1;
|
||||
HPT_U32 df_on_pm_port :1;
|
||||
HPT_U32 df_support_read_ahead :1;
|
||||
HPT_U32 df_read_ahead_enabled :1;
|
||||
HPT_U32 df_support_write_cache :1;
|
||||
HPT_U32 df_write_cache_enabled :1;
|
||||
HPT_U32 df_cdrom_device :1;
|
||||
HPT_U32 df_tape_device :1;
|
||||
HPT_U32 df_support_tcq :1;
|
||||
HPT_U32 df_tcq_enabled :1;
|
||||
HPT_U32 df_support_ncq :1;
|
||||
HPT_U32 df_ncq_enabled :1;
|
||||
} DEVICE_FLAGS, *PDEVICE_FLAGS;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _IDENTIFY_DATA2 {
|
||||
HPT_U16 GeneralConfiguration;
|
||||
HPT_U16 NumberOfCylinders;
|
||||
HPT_U16 Reserved1;
|
||||
HPT_U16 NumberOfHeads;
|
||||
HPT_U16 UnformattedBytesPerTrack;
|
||||
HPT_U16 UnformattedBytesPerSector;
|
||||
HPT_U16 SectorsPerTrack;
|
||||
HPT_U16 VendorUnique1[3];
|
||||
HPT_U16 SerialNumber[10];
|
||||
HPT_U16 BufferType;
|
||||
HPT_U16 BufferSectorSize;
|
||||
HPT_U16 NumberOfEccBytes;
|
||||
HPT_U16 FirmwareRevision[4];
|
||||
HPT_U16 ModelNumber[20];
|
||||
HPT_U8 MaximumBlockTransfer;
|
||||
HPT_U8 VendorUnique2;
|
||||
HPT_U16 DoubleWordIo;
|
||||
HPT_U16 Capabilities;
|
||||
HPT_U16 Reserved2;
|
||||
HPT_U8 VendorUnique3;
|
||||
HPT_U8 PioCycleTimingMode;
|
||||
HPT_U8 VendorUnique4;
|
||||
HPT_U8 DmaCycleTimingMode;
|
||||
HPT_U16 TranslationFieldsValid;
|
||||
HPT_U16 NumberOfCurrentCylinders;
|
||||
HPT_U16 NumberOfCurrentHeads;
|
||||
HPT_U16 CurrentSectorsPerTrack;
|
||||
HPT_U32 CurrentSectorCapacity;
|
||||
HPT_U16 CurrentMultiSectorSetting;
|
||||
HPT_U32 UserAddressableSectors;
|
||||
HPT_U8 SingleWordDMASupport;
|
||||
HPT_U8 SingleWordDMAActive;
|
||||
HPT_U8 MultiWordDMASupport;
|
||||
HPT_U8 MultiWordDMAActive;
|
||||
HPT_U8 AdvancedPIOModes;
|
||||
HPT_U8 Reserved4;
|
||||
HPT_U16 MinimumMWXferCycleTime;
|
||||
HPT_U16 RecommendedMWXferCycleTime;
|
||||
HPT_U16 MinimumPIOCycleTime;
|
||||
HPT_U16 MinimumPIOCycleTimeIORDY;
|
||||
HPT_U16 Reserved5[2];
|
||||
HPT_U16 ReleaseTimeOverlapped;
|
||||
HPT_U16 ReleaseTimeServiceCommand;
|
||||
HPT_U16 MajorRevision;
|
||||
HPT_U16 MinorRevision;
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
__attribute__((packed))
|
||||
#endif
|
||||
IDENTIFY_DATA2, *PIDENTIFY_DATA2;
|
||||
#pragma pack()
|
||||
|
||||
typedef struct _HIM_DEVICE_CONFIG
|
||||
{
|
||||
HPT_U64 capacity;
|
||||
|
||||
DEVICE_FLAGS flags;
|
||||
|
||||
HPT_U8 path_id;
|
||||
HPT_U8 target_id;
|
||||
HPT_U8 max_queue_depth;
|
||||
HPT_U8 spin_up_mode;
|
||||
|
||||
HPT_U8 reserved;
|
||||
HPT_U8 transfer_mode;
|
||||
HPT_U8 bMaxShowMode;
|
||||
HPT_U8 bDeUsable_Mode;
|
||||
|
||||
HPT_U16 max_sectors_per_cmd;
|
||||
|
||||
PIDENTIFY_DATA2 pIdentifyData;
|
||||
|
||||
}
|
||||
HIM_DEVICE_CONFIG, *PHIM_DEVICE_CONFIG;
|
||||
|
||||
|
||||
#define _DIT_MODE 0
|
||||
#define _DIT_601 1
|
||||
#define _DIT_READ_AHEAD 2
|
||||
#define _DIT_WRITE_CACHE 3
|
||||
#define _DIT_TCQ 4
|
||||
#define _DIT_NCQ 5
|
||||
#define _DIT_BEEP_OFF 6
|
||||
#define _DIT_SPIN_UP_MODE 7
|
||||
|
||||
#define SPIN_UP_MODE_NOSUPPORT 0
|
||||
#define SPIN_UP_MODE_FULL 1
|
||||
#define SPIN_UP_MODE_STANDBY 2
|
||||
|
||||
struct tcq_control {
|
||||
HPT_U8 enable;
|
||||
HPT_U8 depth;
|
||||
};
|
||||
|
||||
struct ncq_control {
|
||||
HPT_U8 enable;
|
||||
HPT_U8 depth;
|
||||
};
|
||||
|
||||
typedef struct _HIM_ALTERABLE_DEV_INFO{
|
||||
HPT_U8 type;
|
||||
union {
|
||||
HPT_U8 mode;
|
||||
HPT_U8 enable_read_ahead;
|
||||
HPT_U8 enable_read_cache;
|
||||
HPT_U8 enable_write_cache;
|
||||
struct tcq_control tcq;
|
||||
struct ncq_control ncq;
|
||||
void * adapter;
|
||||
HPT_U8 spin_up_mode;
|
||||
}u;
|
||||
} HIM_ALTERABLE_DEV_INFO, *PHIM_ALTERABLE_DEV_INFO;
|
||||
|
||||
struct _COMMAND;
|
||||
struct _IOCTL_ARG;
|
||||
|
||||
typedef void (*PROBE_CALLBACK)(void *arg, void *dev, int index);
|
||||
|
||||
typedef struct _HIM {
|
||||
char *name;
|
||||
struct _HIM *next;
|
||||
HPT_UINT max_sg_descriptors;
|
||||
#define _HIM_INTERFACE(_type, _fn, _args) _type (* _fn) _args;
|
||||
#include <dev/hptrr/himfuncs.h>
|
||||
}
|
||||
HIM, *PHIM;
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
#ifdef SG_FLAG_EOT
|
||||
#error "don't use SG_FLAG_EOT with _SG.eot. clean the code!"
|
||||
#endif
|
||||
|
||||
typedef struct _SG {
|
||||
HPT_U32 size;
|
||||
HPT_UINT eot;
|
||||
union {
|
||||
HPT_U8 FAR * _logical;
|
||||
BUS_ADDRESS bus;
|
||||
}
|
||||
addr;
|
||||
}
|
||||
SG, *PSG;
|
||||
#pragma pack()
|
||||
|
||||
typedef struct _AtaCommand
|
||||
{
|
||||
HPT_U64 Lba;
|
||||
HPT_U16 nSectors;
|
||||
HPT_U16 pad;
|
||||
} AtaComm, *PAtaComm;
|
||||
|
||||
#define ATA_CMD_SET_FEATURES 0xef
|
||||
#define ATA_CMD_FLUSH 0xE7
|
||||
#define ATA_CMD_VERIFY 0x40
|
||||
#define ATA_CMD_STANDBY 0xe2
|
||||
#define ATA_CMD_READ_MULTI 0xC4
|
||||
#define ATA_CMD_READ_MULTI_EXT 0x29
|
||||
#define ATA_CMD_WRITE_MULTI 0xC5
|
||||
#define ATA_CMD_WRITE_MULTI_EXT 0x39
|
||||
#define ATA_CMD_WRITE_MULTI_FUA_EXT 0xCE
|
||||
|
||||
#define ATA_SET_FEATURES_XFER 0x3
|
||||
#define ATA_SECTOR_SIZE 512
|
||||
|
||||
typedef struct _PassthroughCmd {
|
||||
HPT_U16 bFeaturesReg;
|
||||
HPT_U16 bSectorCountReg;
|
||||
HPT_U16 bLbaLowReg;
|
||||
HPT_U16 bLbaMidReg;
|
||||
HPT_U16 bLbaHighReg;
|
||||
HPT_U8 bDriveHeadReg;
|
||||
HPT_U8 bCommandReg;
|
||||
HPT_U8 nSectors;
|
||||
HPT_U8 *pDataBuffer;
|
||||
}
|
||||
PassthroughCmd;
|
||||
|
||||
|
||||
#define CTRL_CMD_REBUILD 1
|
||||
#define CTRL_CMD_VERIFY 2
|
||||
#define CTRL_CMD_INIT 3
|
||||
|
||||
|
||||
typedef struct _R5ControlCmd {
|
||||
HPT_U64 StripeLine;
|
||||
HPT_U16 Offset;
|
||||
HPT_U8 Command;
|
||||
HPT_U8 reserve1;
|
||||
}
|
||||
R5ControlCmd, *PR5ControlCmd;
|
||||
|
||||
typedef struct _HPT_ADDRESS
|
||||
{
|
||||
HPT_U8 * logical;
|
||||
BUS_ADDRESS bus;
|
||||
}
|
||||
HPT_ADDRESS;
|
||||
|
||||
|
||||
typedef struct ctl_pages {
|
||||
HPT_ADDRESS *pages;
|
||||
HPT_UINT page_size;
|
||||
HPT_UINT npages;
|
||||
HPT_UINT min_sg_descriptors;
|
||||
} CONTROL_PAGES, *PCONTROL_PAGES;
|
||||
|
||||
typedef struct _R1ControlCmd {
|
||||
HPT_U64 Lba;
|
||||
HPT_U16 nSectors;
|
||||
HPT_U8 Command; /* CTRL_CMD_XXX */
|
||||
HPT_U8 reserve1;
|
||||
PCONTROL_PAGES ctl_pages;
|
||||
}
|
||||
R1ControlCmd, *PR1ControlCmd;
|
||||
|
||||
typedef void (*TQ_PROC)(void *arg);
|
||||
|
||||
struct tq_item {
|
||||
TQ_PROC proc;
|
||||
void *arg;
|
||||
struct tq_item *next;
|
||||
};
|
||||
|
||||
#define INIT_TQ_ITEM(t, p, a) \
|
||||
do { (t)->proc = p; (t)->arg = a; (t)->next = 0; } while (0)
|
||||
|
||||
typedef struct _COMMAND
|
||||
{
|
||||
|
||||
struct _VBUS * vbus;
|
||||
|
||||
struct freelist *grplist;
|
||||
HPT_UINT grpcnt;
|
||||
|
||||
|
||||
struct list_head q_link;
|
||||
struct tq_item done_dpc;
|
||||
|
||||
HPT_UINT extsize;
|
||||
void *ext;
|
||||
|
||||
|
||||
|
||||
void *target;
|
||||
void *priv;
|
||||
HPT_UPTR priv2;
|
||||
|
||||
int priority;
|
||||
struct lock_request *owned_lock;
|
||||
struct lock_request *lock_req;
|
||||
|
||||
union{
|
||||
/* Ide Command */
|
||||
AtaComm Ide;
|
||||
PassthroughCmd Passthrough;
|
||||
/* Atapi Command */
|
||||
HPT_U8 Atapi[12];
|
||||
/* Control command */
|
||||
R5ControlCmd R5Control;
|
||||
R1ControlCmd R1Control;
|
||||
} uCmd;
|
||||
|
||||
HPT_U8 type; /* CMD_TYPE_* */
|
||||
|
||||
struct {
|
||||
HPT_U8 physical_sg: 1;
|
||||
HPT_U8 data_in: 1;
|
||||
HPT_U8 data_out: 1;
|
||||
HPT_U8 transform : 1;
|
||||
HPT_U8 hard_flush: 2;
|
||||
HPT_U8 from_cc: 1;
|
||||
} flags;
|
||||
|
||||
/* return status */
|
||||
HPT_U8 Result;
|
||||
/* retry count */
|
||||
HPT_U8 RetryCount;
|
||||
|
||||
|
||||
PSG psg;
|
||||
|
||||
|
||||
int (*buildsgl)(struct _COMMAND *cmd, PSG psg, int logical);
|
||||
void (*done)(struct _COMMAND *cmd);
|
||||
}
|
||||
COMMAND, *PCOMMAND;
|
||||
|
||||
/* command types */
|
||||
#define CMD_TYPE_IO 0
|
||||
#define CMD_TYPE_CONTROL 1
|
||||
#define CMD_TYPE_ATAPI 2
|
||||
#define CMD_TYPE_PASSTHROUGH 3
|
||||
#define CMD_TYPE_FLUSH 4
|
||||
|
||||
/* flush command flags */
|
||||
#define CF_HARD_FLUSH_CACHE 1
|
||||
#define CF_HARD_FLUSH_STANDBY 2
|
||||
|
||||
/* command return values */
|
||||
#define RETURN_PENDING 0
|
||||
#define RETURN_SUCCESS 1
|
||||
#define RETURN_BAD_DEVICE 2
|
||||
#define RETURN_BAD_PARAMETER 3
|
||||
#define RETURN_WRITE_NO_DRQ 4
|
||||
#define RETURN_DEVICE_BUSY 5
|
||||
#define RETURN_INVALID_REQUEST 6
|
||||
#define RETURN_SELECTION_TIMEOUT 7
|
||||
#define RETURN_IDE_ERROR 8
|
||||
#define RETURN_NEED_LOGICAL_SG 9
|
||||
#define RETURN_NEED_PHYSICAL_SG 10
|
||||
#define RETURN_RETRY 11
|
||||
#define RETURN_DATA_ERROR 12
|
||||
#define RETURN_BUS_RESET 13
|
||||
#define RETURN_BAD_TRANSFER_LENGTH 14
|
||||
#define RETURN_INSUFFICIENT_MEMORY 15
|
||||
#define RETURN_SECTOR_ERROR 16
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
105
sys/dev/hptrr/himfuncs.h
Normal file
105
sys/dev/hptrr/himfuncs.h
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/* $Id: himfuncs.h,v 1.14 2005/12/22 00:13:11 gmm Exp $
|
||||
* Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
*
|
||||
* define _HIM_INTERFACE before include this file, and
|
||||
* undef it after include this file.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HIM_INTERFACE
|
||||
#error "you must define _HIM_INTERFACE before this file"
|
||||
#endif
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, get_supported_device_id, (int index, PCI_ID *id))
|
||||
|
||||
_HIM_INTERFACE(HPT_U8, get_controller_count, (PCI_ID *id, HPT_U8 *reached))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_UINT, get_adapter_size, (const PCI_ID *id))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, create_adapter, (const PCI_ID *id, PCI_ADDRESS pciAddress, void *adapter, void *osext))
|
||||
|
||||
_HIM_INTERFACE(void, get_adapter_config, (void *adapter, HIM_ADAPTER_CONFIG *config))
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, get_meminfo, (void *adapter))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, adapter_on_same_vbus, (void *adapter1, void *adapter2))
|
||||
_HIM_INTERFACE(void, route_irq, (void *adapter, HPT_BOOL enable))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, initialize, (void *adapter))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_UINT, get_device_size, (void *adapter))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, probe_device, (void *adapter, int index, void *devhandle, PROBE_CALLBACK done, void *arg))
|
||||
_HIM_INTERFACE(void *, get_device, (void *adapter, int index))
|
||||
_HIM_INTERFACE(void, get_device_config, (void *dev, HIM_DEVICE_CONFIG *config))
|
||||
_HIM_INTERFACE(void, remove_device, (void *dev))
|
||||
|
||||
_HIM_INTERFACE(void, reset_device, (void * dev, void (*done)(void *arg), void *arg))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_U32, get_cmdext_size, (void))
|
||||
|
||||
_HIM_INTERFACE(void, queue_cmd, (void *dev, struct _COMMAND *cmd))
|
||||
|
||||
|
||||
_HIM_INTERFACE(int, read_write, (void *dev,HPT_LBA lba, HPT_U16 nsector, HPT_U8 *buffer, HPT_BOOL read))
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, intr_handler, (void *adapter))
|
||||
_HIM_INTERFACE(HPT_BOOL, intr_control, (void * adapter, HPT_BOOL enable))
|
||||
|
||||
|
||||
_HIM_INTERFACE(int, get_channel_config, (void * adapter, int index, PHIM_CHANNEL_CONFIG pInfo))
|
||||
_HIM_INTERFACE(int, set_device_info, (void * dev, PHIM_ALTERABLE_DEV_INFO pInfo))
|
||||
_HIM_INTERFACE(void, unplug_device, (void * dev))
|
||||
|
||||
|
||||
_HIM_INTERFACE(void, shutdown, (void *adapter))
|
||||
_HIM_INTERFACE(void, suspend, (void *adapter))
|
||||
_HIM_INTERFACE(void, resume, (void *adapter))
|
||||
_HIM_INTERFACE(void, release_adapter, (void *adapter))
|
||||
|
||||
/*called after ldm_register_adapter*/
|
||||
_HIM_INTERFACE(HPT_BOOL, verify_adapter, (void *adapter))
|
||||
|
||||
/* (optional) */
|
||||
_HIM_INTERFACE(void, ioctl, (void * adapter, struct _IOCTL_ARG *arg))
|
||||
_HIM_INTERFACE(int, compare_slot_seq, (void *adapter1, void *adapter2))
|
||||
|
||||
|
||||
_HIM_INTERFACE(HPT_BOOL, flash_access, (void *adapter, HPT_U32 offset, void *value, int size, HPT_BOOL reading))
|
||||
|
||||
#undef _HIM_INTERFACE
|
1840
sys/dev/hptrr/hptintf.h
Normal file
1840
sys/dev/hptrr/hptintf.h
Normal file
File diff suppressed because it is too large
Load Diff
69
sys/dev/hptrr/hptrr_config.c
Normal file
69
sys/dev/hptrr/hptrr_config.c
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/****************************************************************************
|
||||
* config.c - auto-generated file
|
||||
****************************************************************************/
|
||||
#include <dev/hptrr/os_bsd.h>
|
||||
|
||||
extern int init_module_him_rr2310pm(void);
|
||||
extern int init_module_him_rr174x_rr2210pm(void);
|
||||
extern int init_module_him_rr2522pm(void);
|
||||
extern int init_module_him_rr2340(void);
|
||||
extern int init_module_him_rr222x_rr2240(void);
|
||||
extern int init_module_him_rr1720(void);
|
||||
extern int init_module_him_rr232x(void);
|
||||
extern int init_module_vdev_raw(void);
|
||||
extern int init_module_partition(void);
|
||||
extern int init_module_raid0(void);
|
||||
extern int init_module_raid1(void);
|
||||
extern int init_module_raid5(void);
|
||||
extern int init_module_jbod(void);
|
||||
|
||||
int init_config(void)
|
||||
{
|
||||
init_module_him_rr2310pm();
|
||||
init_module_him_rr174x_rr2210pm();
|
||||
init_module_him_rr2522pm();
|
||||
init_module_him_rr2340();
|
||||
init_module_him_rr222x_rr2240();
|
||||
init_module_him_rr1720();
|
||||
init_module_him_rr232x();
|
||||
init_module_vdev_raw();
|
||||
init_module_partition();
|
||||
init_module_raid0();
|
||||
init_module_raid1();
|
||||
init_module_raid5();
|
||||
init_module_jbod();
|
||||
return 0;
|
||||
}
|
||||
|
||||
char driver_name[] = "hptrr";
|
||||
char driver_name_long[] = "HPT RocketRAID controller driver";
|
||||
char driver_ver[] = "v1.1 (" __DATE__ " " __TIME__ ")";
|
||||
int osm_max_targets = 0xff;
|
144
sys/dev/hptrr/hptrr_config.h
Normal file
144
sys/dev/hptrr/hptrr_config.h
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#ifndef hptrr_CONFIG_H
|
||||
#define hptrr_CONFIG_H
|
||||
#define SUPPORT_ARRAY
|
||||
#define __KERNEL__ 1
|
||||
#define DRIVER_MINOR 16
|
||||
#define TARGETNAME hptrr
|
||||
#define __dummy_reg hptrr___dummy_reg
|
||||
#define __ldm_alloc_cmd hptrr___ldm_alloc_cmd
|
||||
#define dmapool_active hptrr_dmapool_active
|
||||
#define dmapool_get_page hptrr_dmapool_get_page
|
||||
#define dmapool_get_page_at hptrr_dmapool_get_page_at
|
||||
#define dmapool_make_order hptrr_dmapool_make_order
|
||||
#define dmapool_max_class_pages hptrr_dmapool_max_class_pages
|
||||
#define dmapool_put_page hptrr_dmapool_put_page
|
||||
#define dmapool_register_client hptrr_dmapool_register_client
|
||||
#define driver_name hptrr_driver_name
|
||||
#define driver_name_long hptrr_driver_name_long
|
||||
#define driver_ver hptrr_driver_ver
|
||||
#define freelist_get hptrr_freelist_get
|
||||
#define freelist_get_dma hptrr_freelist_get_dma
|
||||
#define freelist_put hptrr_freelist_put
|
||||
#define freelist_put_dma hptrr_freelist_put_dma
|
||||
#define freelist_reserve hptrr_freelist_reserve
|
||||
#define freelist_reserve_dma hptrr_freelist_reserve_dma
|
||||
#define him_handle_to_vbus hptrr_him_handle_to_vbus
|
||||
#define him_list hptrr_him_list
|
||||
#define init_config hptrr_init_config
|
||||
#define init_module_him_rr1720 hptrr_init_module_him_rr1720
|
||||
#define init_module_him_rr174x_rr2210pm hptrr_init_module_him_rr174x_rr2210pm
|
||||
#define init_module_him_rr222x_rr2240 hptrr_init_module_him_rr222x_rr2240
|
||||
#define init_module_him_rr2310pm hptrr_init_module_him_rr2310pm
|
||||
#define init_module_him_rr232x hptrr_init_module_him_rr232x
|
||||
#define init_module_him_rr2340 hptrr_init_module_him_rr2340
|
||||
#define init_module_him_rr2522pm hptrr_init_module_him_rr2522pm
|
||||
#define init_module_jbod hptrr_init_module_jbod
|
||||
#define init_module_partition hptrr_init_module_partition
|
||||
#define init_module_raid0 hptrr_init_module_raid0
|
||||
#define init_module_raid1 hptrr_init_module_raid1
|
||||
#define init_module_raid5 hptrr_init_module_raid5
|
||||
#define init_module_vdev_raw hptrr_init_module_vdev_raw
|
||||
#define ldm_acquire_lock hptrr_ldm_acquire_lock
|
||||
#define ldm_add_spare_to_array hptrr_ldm_add_spare_to_array
|
||||
#define ldm_alloc_cmds_R_5_41_57_40_16 hptrr_ldm_alloc_cmds_R_5_41_57_40_16
|
||||
#define ldm_alloc_cmds_from_list hptrr_ldm_alloc_cmds_from_list
|
||||
#define ldm_check_array_online hptrr_ldm_check_array_online
|
||||
#define ldm_create_vbus hptrr_ldm_create_vbus
|
||||
#define ldm_create_vdev hptrr_ldm_create_vdev
|
||||
#define ldm_event_notify hptrr_ldm_event_notify
|
||||
#define ldm_find_stamp hptrr_ldm_find_stamp
|
||||
#define ldm_find_target hptrr_ldm_find_target
|
||||
#define ldm_finish_cmd hptrr_ldm_finish_cmd
|
||||
#define ldm_free_cmds hptrr_ldm_free_cmds
|
||||
#define ldm_free_cmds_to_list hptrr_ldm_free_cmds_to_list
|
||||
#define ldm_generic_member_failed hptrr_ldm_generic_member_failed
|
||||
#define ldm_get_cmd_size hptrr_ldm_get_cmd_size
|
||||
#define ldm_get_device_id hptrr_ldm_get_device_id
|
||||
#define ldm_get_mem_info hptrr_ldm_get_mem_info
|
||||
#define ldm_get_next_vbus hptrr_ldm_get_next_vbus
|
||||
#define ldm_get_vbus_ext hptrr_ldm_get_vbus_ext
|
||||
#define ldm_get_vbus_size hptrr_ldm_get_vbus_size
|
||||
#define ldm_idle hptrr_ldm_idle
|
||||
#define ldm_initialize_vbus_async hptrr_ldm_initialize_vbus_async
|
||||
#define ldm_intr hptrr_ldm_intr
|
||||
#define ldm_ioctl hptrr_ldm_ioctl
|
||||
#define ldm_on_timer hptrr_ldm_on_timer
|
||||
#define ldm_queue_cmd hptrr_ldm_queue_cmd
|
||||
#define ldm_queue_task hptrr_ldm_queue_task
|
||||
#define ldm_queue_vbus_dpc hptrr_ldm_queue_vbus_dpc
|
||||
#define ldm_register_adapter hptrr_ldm_register_adapter
|
||||
#define ldm_register_device hptrr_ldm_register_device
|
||||
#define ldm_register_him_R_5_41_57_40_16 hptrr_ldm_register_him_R_5_41_57_40_16
|
||||
#define ldm_register_vdev_class_R_5_41_57_40_16 hptrr_ldm_register_vdev_class_R_5_41_57_40_16
|
||||
#define ldm_release_lock hptrr_ldm_release_lock
|
||||
#define ldm_release_vbus hptrr_ldm_release_vbus
|
||||
#define ldm_release_vdev hptrr_ldm_release_vdev
|
||||
#define ldm_remove_timer hptrr_ldm_remove_timer
|
||||
#define ldm_request_timer hptrr_ldm_request_timer
|
||||
#define ldm_reset_vbus hptrr_ldm_reset_vbus
|
||||
#define ldm_resume hptrr_ldm_resume
|
||||
#define ldm_set_autorebuild hptrr_ldm_set_autorebuild
|
||||
#define ldm_set_rebuild_priority hptrr_ldm_set_rebuild_priority
|
||||
#define ldm_shutdown hptrr_ldm_shutdown
|
||||
#define ldm_suspend hptrr_ldm_suspend
|
||||
#define ldm_sync_array_info hptrr_ldm_sync_array_info
|
||||
#define ldm_sync_array_stamp hptrr_ldm_sync_array_stamp
|
||||
#define ldm_timer_probe_device hptrr_ldm_timer_probe_device
|
||||
#define ldm_unregister_device hptrr_ldm_unregister_device
|
||||
#define log_sector_repair hptrr_log_sector_repair
|
||||
#define num_drives_per_spinup hptrr_num_drives_per_spinup
|
||||
#define os_get_stamp hptrr_os_get_stamp
|
||||
#define os_get_vbus_seq hptrr_os_get_vbus_seq
|
||||
#define os_inb hptrr_os_inb
|
||||
#define os_inl hptrr_os_inl
|
||||
#define os_insw hptrr_os_insw
|
||||
#define os_inw hptrr_os_inw
|
||||
#define os_map_pci_bar hptrr_os_map_pci_bar
|
||||
#define os_outb hptrr_os_outb
|
||||
#define os_outl hptrr_os_outl
|
||||
#define os_outsw hptrr_os_outsw
|
||||
#define os_outw hptrr_os_outw
|
||||
#define os_pci_readb hptrr_os_pci_readb
|
||||
#define os_pci_readl hptrr_os_pci_readl
|
||||
#define os_pci_readw hptrr_os_pci_readw
|
||||
#define os_pci_writeb hptrr_os_pci_writeb
|
||||
#define os_pci_writel hptrr_os_pci_writel
|
||||
#define os_pci_writew hptrr_os_pci_writew
|
||||
#define os_printk hptrr_os_printk
|
||||
#define os_query_remove_device hptrr_os_query_remove_device
|
||||
#define os_query_time hptrr_os_query_time
|
||||
#define os_request_timer hptrr_os_request_timer
|
||||
#define os_revalidate_device hptrr_os_revalidate_device
|
||||
#define os_schedule_task hptrr_os_schedule_task
|
||||
#define os_stallexec hptrr_os_stallexec
|
||||
#define os_unmap_pci_bar hptrr_os_unmap_pci_bar
|
||||
#define osm_max_targets hptrr_osm_max_targets
|
||||
#define vdev_queue_cmd hptrr_vdev_queue_cmd
|
||||
#endif
|
302
sys/dev/hptrr/hptrr_os_bsd.c
Normal file
302
sys/dev/hptrr/hptrr_os_bsd.c
Normal file
@ -0,0 +1,302 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/* $Id: os_bsd.c,v 1.11 2005/06/03 14:06:38 kdh Exp $
|
||||
*
|
||||
* HighPoint RAID Driver for FreeBSD
|
||||
* Copyright (C) 2005 HighPoint Technologies, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include <dev/hptrr/os_bsd.h>
|
||||
|
||||
/* hardware access */
|
||||
HPT_U8 os_inb (void *port) { return inb((unsigned)(HPT_UPTR)port); }
|
||||
HPT_U16 os_inw (void *port) { return inw((unsigned)(HPT_UPTR)port); }
|
||||
HPT_U32 os_inl (void *port) { return inl((unsigned)(HPT_UPTR)port); }
|
||||
|
||||
void os_outb (void *port, HPT_U8 value) { outb((unsigned)(HPT_UPTR)port, (value)); }
|
||||
void os_outw (void *port, HPT_U16 value) { outw((unsigned)(HPT_UPTR)port, (value)); }
|
||||
void os_outl (void *port, HPT_U32 value) { outl((unsigned)(HPT_UPTR)port, (value)); }
|
||||
|
||||
void os_insw (void *port, HPT_U16 *buffer, HPT_U32 count)
|
||||
{ insw((unsigned)(HPT_UPTR)port, (void *)buffer, count); }
|
||||
|
||||
void os_outsw(void *port, HPT_U16 *buffer, HPT_U32 count)
|
||||
{ outsw((unsigned)(HPT_UPTR)port, (void *)buffer, count); }
|
||||
|
||||
HPT_U32 __dummy_reg = 0;
|
||||
|
||||
/* PCI configuration space */
|
||||
HPT_U8 os_pci_readb (void *osext, HPT_U8 offset)
|
||||
{
|
||||
return pci_read_config(((PHBA)osext)->pcidev, offset, 1);
|
||||
}
|
||||
|
||||
HPT_U16 os_pci_readw (void *osext, HPT_U8 offset)
|
||||
{
|
||||
return pci_read_config(((PHBA)osext)->pcidev, offset, 2);
|
||||
}
|
||||
|
||||
HPT_U32 os_pci_readl (void *osext, HPT_U8 offset)
|
||||
{
|
||||
return pci_read_config(((PHBA)osext)->pcidev, offset, 4);
|
||||
}
|
||||
|
||||
void os_pci_writeb (void *osext, HPT_U8 offset, HPT_U8 value)
|
||||
{
|
||||
pci_write_config(((PHBA)osext)->pcidev, offset, value, 1);
|
||||
}
|
||||
|
||||
void os_pci_writew (void *osext, HPT_U8 offset, HPT_U16 value)
|
||||
{
|
||||
pci_write_config(((PHBA)osext)->pcidev, offset, value, 2);
|
||||
}
|
||||
|
||||
void os_pci_writel (void *osext, HPT_U8 offset, HPT_U32 value)
|
||||
{
|
||||
pci_write_config(((PHBA)osext)->pcidev, offset, value, 4);
|
||||
}
|
||||
|
||||
void *os_map_pci_bar(
|
||||
void *osext,
|
||||
int index,
|
||||
HPT_U32 offset,
|
||||
HPT_U32 length
|
||||
)
|
||||
{
|
||||
PHBA hba = (PHBA)osext;
|
||||
|
||||
hba->pcibar[index].rid = 0x10 + index * 4;
|
||||
|
||||
if (pci_read_config(hba->pcidev, hba->pcibar[index].rid, 4) & 1)
|
||||
hba->pcibar[index].type = SYS_RES_IOPORT;
|
||||
else
|
||||
hba->pcibar[index].type = SYS_RES_MEMORY;
|
||||
|
||||
hba->pcibar[index].res = bus_alloc_resource(hba->pcidev,
|
||||
hba->pcibar[index].type, &hba->pcibar[index].rid, 0, ~0, length, RF_ACTIVE);
|
||||
|
||||
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
|
||||
return hba->pcibar[index].base;
|
||||
}
|
||||
|
||||
void os_unmap_pci_bar(void *osext, void *base)
|
||||
{
|
||||
PHBA hba = (PHBA)osext;
|
||||
int index;
|
||||
|
||||
for (index=0; index<6; index++) {
|
||||
if (hba->pcibar[index].base==base) {
|
||||
bus_release_resource(hba->pcidev, hba->pcibar[index].type,
|
||||
hba->pcibar[index].rid, hba->pcibar[index].res);
|
||||
hba->pcibar[index].base = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void freelist_reserve(struct freelist *list, void *osext, HPT_UINT size, HPT_UINT count)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = osext;
|
||||
|
||||
if (vbus_ext->ext_type!=EXT_TYPE_VBUS)
|
||||
vbus_ext = ((PHBA)osext)->vbus_ext;
|
||||
|
||||
list->next = vbus_ext->freelist_head;
|
||||
vbus_ext->freelist_head = list;
|
||||
list->dma = 0;
|
||||
list->size = size;
|
||||
list->head = 0;
|
||||
#ifdef DBG
|
||||
list->reserved_count =
|
||||
#endif
|
||||
list->count = count;
|
||||
}
|
||||
|
||||
void *freelist_get(struct freelist *list)
|
||||
{
|
||||
void * result;
|
||||
if (list->count) {
|
||||
HPT_ASSERT(list->head);
|
||||
result = list->head;
|
||||
list->head = *(void **)result;
|
||||
list->count--;
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void freelist_put(struct freelist * list, void *p)
|
||||
{
|
||||
HPT_ASSERT(list->dma==0);
|
||||
list->count++;
|
||||
*(void **)p = list->head;
|
||||
list->head = p;
|
||||
}
|
||||
|
||||
void freelist_reserve_dma(struct freelist *list, void *osext, HPT_UINT size, HPT_UINT alignment, HPT_UINT count)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = osext;
|
||||
|
||||
if (vbus_ext->ext_type!=EXT_TYPE_VBUS)
|
||||
vbus_ext = ((PHBA)osext)->vbus_ext;
|
||||
|
||||
list->next = vbus_ext->freelist_dma_head;
|
||||
vbus_ext->freelist_dma_head = list;
|
||||
list->dma = 1;
|
||||
list->alignment = alignment;
|
||||
list->size = size;
|
||||
list->head = 0;
|
||||
#ifdef DBG
|
||||
list->reserved_count =
|
||||
#endif
|
||||
list->count = count;
|
||||
}
|
||||
|
||||
void *freelist_get_dma(struct freelist *list, BUS_ADDRESS *busaddr)
|
||||
{
|
||||
void *result;
|
||||
HPT_ASSERT(list->dma);
|
||||
result = freelist_get(list);
|
||||
if (result)
|
||||
*busaddr = *(BUS_ADDRESS *)((void **)result+1);
|
||||
return result;
|
||||
}
|
||||
|
||||
void freelist_put_dma(struct freelist *list, void *p, BUS_ADDRESS busaddr)
|
||||
{
|
||||
HPT_ASSERT(list->dma);
|
||||
list->count++;
|
||||
*(void **)p = list->head;
|
||||
*(BUS_ADDRESS *)((void **)p+1) = busaddr;
|
||||
list->head = p;
|
||||
}
|
||||
|
||||
HPT_U32 os_get_stamp(void)
|
||||
{
|
||||
HPT_U32 stamp;
|
||||
do { stamp = random(); } while (stamp==0);
|
||||
return stamp;
|
||||
}
|
||||
|
||||
void os_stallexec(HPT_U32 microseconds)
|
||||
{
|
||||
DELAY(microseconds);
|
||||
}
|
||||
|
||||
static void os_timer_for_ldm(void *arg)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = (PVBUS_EXT)arg;
|
||||
ldm_on_timer((PVBUS)vbus_ext->vbus);
|
||||
}
|
||||
|
||||
void os_request_timer(void * osext, HPT_U32 interval)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = osext;
|
||||
|
||||
HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS);
|
||||
|
||||
untimeout(os_timer_for_ldm, vbus_ext, vbus_ext->timer);
|
||||
vbus_ext->timer = timeout(os_timer_for_ldm, vbus_ext, interval * hz / 1000000);
|
||||
}
|
||||
|
||||
HPT_TIME os_query_time(void)
|
||||
{
|
||||
return ticks * (1000000 / hz);
|
||||
}
|
||||
|
||||
void os_schedule_task(void *osext, OSM_TASK *task)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = osext;
|
||||
|
||||
HPT_ASSERT(task->next==0);
|
||||
|
||||
if (vbus_ext->tasks==0)
|
||||
vbus_ext->tasks = task;
|
||||
else {
|
||||
OSM_TASK *t = vbus_ext->tasks;
|
||||
while (t->next) t = t->next;
|
||||
t->next = task;
|
||||
}
|
||||
|
||||
if (vbus_ext->worker.ta_context)
|
||||
TASK_ENQUEUE(&vbus_ext->worker);
|
||||
}
|
||||
|
||||
int os_revalidate_device(void *osext, int id)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int os_query_remove_device(void *osext, int id)
|
||||
{
|
||||
PVBUS_EXT vbus_ext = (PVBUS_EXT)osext;
|
||||
struct cam_periph *periph = NULL;
|
||||
struct cam_path *path;
|
||||
int status,retval = 0;
|
||||
|
||||
status = xpt_create_path(&path, NULL, vbus_ext->sim->path_id, id, 0);
|
||||
if (status == CAM_REQ_CMP) {
|
||||
if((periph = cam_periph_find(path, "da")) != NULL){
|
||||
if(periph->refcount >= 1)
|
||||
retval = -1;
|
||||
}
|
||||
xpt_free_path(path);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
HPT_U8 os_get_vbus_seq(void *osext)
|
||||
{
|
||||
return ((PVBUS_EXT)osext)->sim->path_id;
|
||||
}
|
||||
|
||||
int os_printk(char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buf[512];
|
||||
|
||||
va_start(args, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
va_end(args);
|
||||
return printf("%s: %s\n", driver_name, buf);
|
||||
}
|
||||
|
||||
#ifdef DBG
|
||||
void os_check_stack(const char *location, int size){}
|
||||
|
||||
void __os_dbgbreak(const char *file, int line)
|
||||
{
|
||||
printf("*** break at %s:%d ***", file, line);
|
||||
while (1);
|
||||
}
|
||||
|
||||
int hpt_dbg_level = 1;
|
||||
#endif
|
1415
sys/dev/hptrr/hptrr_osm_bsd.c
Normal file
1415
sys/dev/hptrr/hptrr_osm_bsd.c
Normal file
File diff suppressed because it is too large
Load Diff
8495
sys/dev/hptrr/i386-elf.hptrr_lib.o.uu
Normal file
8495
sys/dev/hptrr/i386-elf.hptrr_lib.o.uu
Normal file
File diff suppressed because it is too large
Load Diff
507
sys/dev/hptrr/ldm.h
Normal file
507
sys/dev/hptrr/ldm.h
Normal file
@ -0,0 +1,507 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/*
|
||||
* $Id: ldm.h,v 1.59 2007/04/17 07:00:06 mah Exp $
|
||||
* Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _HPT_LDM_H_
|
||||
#define _HPT_LDM_H_
|
||||
|
||||
#define VERMAGIC_LDM 57
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define __hpt_set_ver(x, v1, v2, v3, v4, v5) x ## _R_ ## v1 ## _ ## v2 ## _ ## v3 ## _ ## v4 ## _ ## v5
|
||||
#define _hpt_set_ver(x, v1, v2, v3, v4, v5) __hpt_set_ver(x, v1, v2, v3, v4, v5)
|
||||
#define hpt_set_ver(x) _hpt_set_ver(x, VERMAGIC_OSM, VERMAGIC_HIM, VERMAGIC_LDM, VERMAGIC_ARRAY, MAX_MEMBERS)
|
||||
|
||||
#define ldm_register_him hpt_set_ver(ldm_register_him)
|
||||
#define ldm_register_vdev_class hpt_set_ver(ldm_register_vdev_class)
|
||||
#define ldm_alloc_cmds hpt_set_ver(ldm_alloc_cmds)
|
||||
|
||||
|
||||
#ifndef HPT_INTERFACE_VERSION
|
||||
#define HPT_INTERFACE_VERSION 0x02000001
|
||||
#endif
|
||||
|
||||
#define MAX_PARTITIONS_PER_DISK 4
|
||||
#if defined(__MAX_PARTITIONS_PER_DISK) && MAX_PARTITIONS_PER_DISK > __MAX_PARTITIONS_PER_DISK
|
||||
#error "Please redefine MAX_PARTITIONS_PER_DISK!!!"
|
||||
#endif
|
||||
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
|
||||
|
||||
struct freelist {
|
||||
int dma;
|
||||
HPT_UINT alignment;
|
||||
HPT_UINT count;
|
||||
HPT_UINT size;
|
||||
void * head;
|
||||
struct freelist *next;
|
||||
#ifdef DBG
|
||||
char *tag;
|
||||
HPT_UINT reserved_count;
|
||||
#define freelist_debug_tag(list, _tag) (list)->tag = _tag
|
||||
#else
|
||||
#define freelist_debug_tag(list, _tag)
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
void freelist_reserve(struct freelist *list, void *osext, HPT_UINT size, HPT_UINT count);
|
||||
|
||||
void *freelist_get(struct freelist *);
|
||||
void freelist_put(struct freelist *, void *p);
|
||||
|
||||
void freelist_reserve_dma(struct freelist *list, void *osext, HPT_UINT size, HPT_UINT alignment, HPT_UINT count);
|
||||
void *freelist_get_dma(struct freelist *, BUS_ADDRESS *busaddr);
|
||||
void freelist_put_dma(struct freelist *, void *p, BUS_ADDRESS busaddr);
|
||||
|
||||
|
||||
#define freelist_reserve_with_tag(list, osext, size, count) \
|
||||
do {\
|
||||
freelist_debug_tag(list, #list " at " __FILE__);\
|
||||
freelist_reserve(list, osext, size, count);\
|
||||
}while(0)
|
||||
|
||||
#define freelist_reserve_dma_with_tag(list, osext, size, alignment, count) \
|
||||
do {\
|
||||
freelist_debug_tag(list, #list " at " __FILE__);\
|
||||
freelist_reserve_dma(list, osext, size, alignment, count);\
|
||||
}while(0)
|
||||
|
||||
struct lock_request {
|
||||
HPT_U64 start, end;
|
||||
struct lock_request *next;
|
||||
struct list_head waiters; /* blocked commands */
|
||||
struct tq_item callback;
|
||||
};
|
||||
|
||||
#define INIT_LOCK_REQUEST(req, _start, _end, _cb, _arg) \
|
||||
do {\
|
||||
(req)->next = 0;\
|
||||
(req)->start = _start;\
|
||||
(req)->end = _end;\
|
||||
INIT_TQ_ITEM(&(req)->callback, _cb, _arg);\
|
||||
INIT_LIST_HEAD(&(req)->waiters);\
|
||||
} while (0)
|
||||
|
||||
struct task_queue {
|
||||
struct tq_item *head, *tail;
|
||||
};
|
||||
|
||||
#define TQ_EMPTY(tq) ((tq)->head==0)
|
||||
|
||||
struct dmapool_order {
|
||||
HPT_UINT npages;
|
||||
struct tq_item wakeup_fn;
|
||||
struct dmapool_order *next;
|
||||
};
|
||||
|
||||
struct dmapool_client {
|
||||
void * handle;
|
||||
HPT_UINT (*shrink)(void *handle, HPT_UINT npages);
|
||||
void (*resume)(void *handle);
|
||||
struct dmapool_client *next;
|
||||
};
|
||||
|
||||
typedef struct _VBUS * PVBUS;
|
||||
typedef struct _VDEV * PVDEV;
|
||||
|
||||
|
||||
void dmapool_register_client(PVBUS vbus, struct dmapool_client *client);
|
||||
|
||||
|
||||
void dmapool_active(PVBUS vbus);
|
||||
|
||||
/* return 0 if the request is immediately satisfied, non-zero otherwise. */
|
||||
int dmapool_make_order(PVBUS vbus, struct dmapool_order *order);
|
||||
|
||||
|
||||
void *dmapool_get_page(PVBUS vbus, BUS_ADDRESS *busaddr);
|
||||
void *dmapool_get_page_at(PVBUS vbus, void *p, BUS_ADDRESS *busaddr);
|
||||
void dmapool_put_page(PVBUS vbus, void *p, BUS_ADDRESS busaddr);
|
||||
void dmapool_init(PVBUS vbus);
|
||||
HPT_UINT dmapool_max_class_pages(PVBUS vbus);
|
||||
|
||||
|
||||
struct timer_call {
|
||||
HPT_U32 interval; /*microseconds*/
|
||||
HPT_TIME expire_time; /*microseconds*/
|
||||
void (*proc)(void * arg);
|
||||
void * arg;
|
||||
struct timer_call ** pprev;
|
||||
struct timer_call * next;
|
||||
};
|
||||
|
||||
#define ldm_init_timer(timer) do { (timer)->next=0; (timer)->pprev=0; } while (0)
|
||||
|
||||
#define INIT_TIMER_CALL(timer, _interval, _proc, _arg) \
|
||||
do { \
|
||||
HPT_ASSERT((timer)->next==0 && (timer)->pprev==0);\
|
||||
(timer)->interval = _interval;\
|
||||
(timer)->proc = _proc;\
|
||||
(timer)->arg = _arg;\
|
||||
} while(0)
|
||||
|
||||
void ldm_request_timer(PVBUS vbus, struct timer_call * tc);
|
||||
void ldm_remove_timer(PVBUS vbus, struct timer_call * tc);
|
||||
void ldm_on_timer(PVBUS vbus);
|
||||
|
||||
|
||||
typedef struct _LDM_ADAPTER
|
||||
{
|
||||
struct _LDM_ADAPTER *next;
|
||||
HIM *him;
|
||||
void *him_handle;
|
||||
PVBUS vbus;
|
||||
struct freelist freelist_dev;
|
||||
struct freelist freelist_plugged_dpc;
|
||||
HPT_BOOL master;
|
||||
}
|
||||
LDM_ADAPTER, *PLDM_ADAPTER;
|
||||
|
||||
typedef struct _IOCTL_ARG
|
||||
{
|
||||
struct list_head link;
|
||||
PVBUS vbus;
|
||||
HPT_U32 dwIoControlCode;
|
||||
HPT_U32 nInBufferSize;
|
||||
HPT_U32 nOutBufferSize;
|
||||
void * lpInBuffer;
|
||||
void * lpOutBuffer;
|
||||
HPT_U32 *lpBytesReturned;
|
||||
void * ioctl_cmnd;
|
||||
void (* done)(struct _IOCTL_ARG *);
|
||||
int result; /* HPT_IOCTL_RESULT_ */
|
||||
struct tq_item dpc;
|
||||
} IOCTL_ARG;
|
||||
|
||||
#define HPT_IOCTL_RESULT_OK 0
|
||||
#define HPT_IOCTL_RESULT_FAILED (-1)
|
||||
#define HPT_IOCTL_RESULT_INVALID (-2)
|
||||
#define HPT_IOCTL_RESULT_RETRY (-3)
|
||||
#define HPT_IOCTL_RESULT_WRONG_VBUS (-4)
|
||||
|
||||
void ldm_ioctl( PVBUS vbus, IOCTL_ARG *IAPnt);
|
||||
HPT_U32 ldm_get_device_id(PVDEV vd); /* for ioctl */
|
||||
void ldm_set_rebuild_priority(PVBUS vbus, int priority);
|
||||
void ldm_set_autorebuild(PVBUS vbus, int enable);
|
||||
|
||||
#include <dev/hptrr/array.h>
|
||||
|
||||
typedef struct hpt_raw_disk
|
||||
{
|
||||
#ifdef SUPPORT_ARRAY
|
||||
PRAW_PARTITION raw_part_list;
|
||||
HPT_RAW_LBA max_available_capacity;
|
||||
HPT_RAW_LBA total_available_capacity;
|
||||
#endif
|
||||
HPT_RAW_LBA real_capacity;
|
||||
HPT_RAW_LBA head_position;
|
||||
|
||||
HPT_U16 max_sectors_per_cmd;
|
||||
HPT_U8 user_select_mode;
|
||||
|
||||
HPT_U8 uninitialized : 1;
|
||||
HPT_U8 legacy_disk : 1;
|
||||
HPT_U8 is_spare : 1;
|
||||
HPT_U8 v3_format : 1;
|
||||
HPT_U8 need_sync : 1;
|
||||
HPT_U8 temp_spare : 1;
|
||||
HPT_U8 need_check_array : 1;
|
||||
HPT_U8 df_user_mode_set: 1;
|
||||
|
||||
HPT_U8 df_read_ahead_set: 1;
|
||||
HPT_U8 enable_read_ahead : 1;
|
||||
HPT_U8 df_write_cache_set: 1;
|
||||
HPT_U8 enable_write_cache : 1;
|
||||
HPT_U8 df_tcq_set: 1;
|
||||
HPT_U8 enable_tcq : 1;
|
||||
HPT_U8 df_ncq_set: 1;
|
||||
HPT_U8 enable_ncq : 1;
|
||||
|
||||
HIM * him;
|
||||
int index;
|
||||
PLDM_ADAPTER adapter;
|
||||
void * phy_dev;
|
||||
PIDENTIFY_DATA2 identify_data;
|
||||
char model[40];
|
||||
|
||||
struct tq_item reset_dpc;
|
||||
int reset_pending;
|
||||
|
||||
struct tq_item fail_dpc;
|
||||
int fail_pending;
|
||||
}
|
||||
HPT_RAW_DISK, *PHPT_RAW_DISK;
|
||||
|
||||
struct vdev_class
|
||||
{
|
||||
struct vdev_class *next;
|
||||
|
||||
HPT_U8 type;
|
||||
HPT_U8 stripped; /* RAID0,3,5,6 */
|
||||
HPT_U8 redundancy; /* RAID1-1, RAID3/5-1, RAID6-2 */
|
||||
HPT_U8 must_init; /* RAID3,5,6 */
|
||||
|
||||
HPT_UINT vbus_ext_size;
|
||||
HPT_UINT vbus_ext_offset; /* used by LDM */
|
||||
HPT_UINT dev_ext_size;
|
||||
HPT_UINT cmd_ext_size;
|
||||
|
||||
|
||||
void (*get_mem_info)(PVBUS vbus, void *osext, int phydev_count);
|
||||
void (*queue_cmd)(PCOMMAND cmd);
|
||||
void (*member_failed)(struct _VDEV * vd);
|
||||
|
||||
|
||||
void (*initialize)(PVBUS vbus);
|
||||
void (*release)(PVBUS vbus);
|
||||
int (*add)(PVDEV vd);
|
||||
void (*remove)(PVDEV vd);
|
||||
void (*reset)(PVDEV vd);
|
||||
void (*sync_stamp)(PVDEV vd);
|
||||
};
|
||||
|
||||
|
||||
#define VDEV_CLASS_CONSTRUCTOR(type, prefix) { \
|
||||
0, \
|
||||
type, \
|
||||
prefix ## _stripped, \
|
||||
prefix ## _redundancy, \
|
||||
prefix ## _must_init, \
|
||||
prefix ## _vbus_ext_size, \
|
||||
0, \
|
||||
prefix ## _dev_ext_size, \
|
||||
prefix ## _cmd_ext_size, \
|
||||
prefix ## _get_mem_info, \
|
||||
prefix ## _queue_cmd, \
|
||||
prefix ## _member_failed, \
|
||||
prefix ## _initialize, \
|
||||
prefix ## _release, \
|
||||
prefix ## _add, \
|
||||
prefix ## _remove, \
|
||||
prefix ## _reset, \
|
||||
prefix ## _sync_stamp, \
|
||||
}
|
||||
|
||||
#define VD_RAW 1
|
||||
#define VD_PARTITION 4
|
||||
|
||||
#define mIsArray(vdev_type) ((vdev_type)>VD_PARTITION)
|
||||
|
||||
#define VD_RAID0 5
|
||||
#define VD_RAID1 6
|
||||
#define VD_JBOD 7
|
||||
#define VD_RAID5 8
|
||||
#define VD_RAID6 9
|
||||
|
||||
#define MAX_VD_TYPE_ID 9
|
||||
|
||||
struct vdev_class *ldm_find_vdev_class(HPT_U8 type);
|
||||
|
||||
typedef struct _VDEV {
|
||||
PVBUS vbus;
|
||||
PVDEV parent;
|
||||
void * ext;
|
||||
HPT_U64 capacity;
|
||||
int target_id;
|
||||
HPT_UINT cmds_per_request;
|
||||
|
||||
union {
|
||||
#ifdef SUPPORT_ARRAY
|
||||
HPT_ARRAY array;
|
||||
HPT_PARTITION partition;
|
||||
#endif
|
||||
HPT_RAW_DISK raw;
|
||||
} u;
|
||||
|
||||
HPT_U8 vf_online : 1;
|
||||
HPT_U8 vf_bootmark : 1;
|
||||
HPT_U8 vf_bootable : 1;
|
||||
HPT_U8 vf_resetting: 1;
|
||||
HPT_U8 vf_quiesced: 1;
|
||||
|
||||
HPT_U8 cache_policy; /* see CACHE_POLICY_* */
|
||||
|
||||
HPT_UINT cq_len;
|
||||
HPT_UINT cmds_sent;
|
||||
HPT_UINT max_queue_depth;
|
||||
|
||||
struct list_head link;
|
||||
struct vdev_class *Class;
|
||||
|
||||
struct list_head cq_wait_send;
|
||||
struct list_head cq_sent;
|
||||
|
||||
int cq_priority;
|
||||
struct list_head cq_wait_lock;
|
||||
struct lock_request *locks_granted;
|
||||
struct lock_request *locks_wait;
|
||||
HPT_U32 ioctl_id;
|
||||
void * cc_ext;
|
||||
}
|
||||
VDEV;
|
||||
|
||||
#define CACHE_POLICY_NONE 0
|
||||
#define CACHE_POLICY_WRITE_THROUGH 1
|
||||
#define CACHE_POLICY_WRITE_BACK 2
|
||||
|
||||
|
||||
extern HIM *him_list;
|
||||
|
||||
|
||||
void ldm_register_him(PHIM him);
|
||||
|
||||
|
||||
void ldm_register_vdev_class(struct vdev_class *Class);
|
||||
|
||||
|
||||
HPT_BOOL ldm_register_adapter(PLDM_ADAPTER adapter);
|
||||
|
||||
|
||||
int init_config(void);
|
||||
|
||||
HPT_UINT ldm_get_vbus_size(void);
|
||||
|
||||
|
||||
void ldm_create_vbus(PVBUS vbus, void *osext);
|
||||
|
||||
|
||||
void ldm_get_mem_info(PVBUS vbus, void *osext);
|
||||
|
||||
|
||||
void *ldm_get_vbus_ext(PVBUS vbus, struct vdev_class *Class);
|
||||
|
||||
|
||||
PVBUS ldm_get_next_vbus(PVBUS vbus, void **posext);
|
||||
|
||||
#define ldm_for_each_vbus(vbus, vbus_ext) \
|
||||
for (vbus = ldm_get_next_vbus(0, (void **)(void *)&vbus_ext); vbus; \
|
||||
vbus = ldm_get_next_vbus(vbus, (void **)(void *)&vbus_ext))
|
||||
|
||||
|
||||
void ldm_initialize_vbus_async(PVBUS vbus, PLDM_ADAPTER master_adapter, void (*done)(void *osext));
|
||||
|
||||
/* ldm_initialize_vbus is deprecated since it will hold the CPU too long. */
|
||||
#define ldm_initialize_vbus(vbus, adapter) ldm_initialize_vbus_async(vbus, adapter, 0)
|
||||
|
||||
|
||||
void ldm_release_vbus(PVBUS vbus);
|
||||
|
||||
PVDEV ldm_create_vdev(PVBUS vbus, HPT_U8 type);
|
||||
void ldm_release_vdev(PVDEV vd);
|
||||
|
||||
PVDEV ldm_find_target(PVBUS vbus, int id);
|
||||
PVDEV ldm_find_stamp(PVBUS vbus, HPT_U32 stamp, int seq);
|
||||
|
||||
|
||||
PCOMMAND ldm_alloc_cmds(PVBUS vbus, HPT_UINT cnt);
|
||||
void ldm_free_cmds(PCOMMAND cmd);
|
||||
|
||||
HPT_UINT ldm_get_cmd_size(void);
|
||||
PCOMMAND ldm_alloc_cmds_from_list(PVBUS vbus, struct freelist *list, HPT_UINT cnt);
|
||||
void ldm_free_cmds_to_list(struct freelist *list, PCOMMAND cmd);
|
||||
|
||||
|
||||
PCOMMAND __ldm_alloc_cmd(struct freelist *list);
|
||||
|
||||
#ifdef OS_SUPPORT_TASK
|
||||
#define CMD_SET_PRIORITY(cmd, pri) cmd->priority = (pri)
|
||||
#else
|
||||
#define CMD_SET_PRIORITY(cmd, pri)
|
||||
#endif
|
||||
|
||||
#define CMD_GROUP_GET(grp, cmd) \
|
||||
do {\
|
||||
grp->grplist->count++;\
|
||||
cmd = __ldm_alloc_cmd(grp->grplist);\
|
||||
cmd->vbus = grp->vbus;\
|
||||
cmd->grplist = grp->grplist;\
|
||||
CMD_SET_PRIORITY(cmd, grp->priority);\
|
||||
} while(0)
|
||||
|
||||
#define CMD_GROUP_PUT(grp, cmd) \
|
||||
do {\
|
||||
freelist_put(grp->grplist, cmd);\
|
||||
grp->grplist->count--;\
|
||||
} while (0)
|
||||
|
||||
|
||||
void ldm_queue_cmd(PCOMMAND cmd);
|
||||
void vdev_queue_cmd(PCOMMAND cmd);
|
||||
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);
|
||||
|
||||
HPT_BOOL ldm_intr(PVBUS vbus);
|
||||
void ldm_run(PVBUS vbus);
|
||||
int ldm_idle(PVBUS vbus);
|
||||
|
||||
|
||||
int ldm_reset_vbus(PVBUS vbus);
|
||||
|
||||
|
||||
void ldm_suspend(PVBUS vbus);
|
||||
void ldm_resume(PVBUS vbus);
|
||||
void ldm_shutdown(PVBUS vbus);/*shutdown all the controllers*/
|
||||
|
||||
|
||||
#define HIM_EVENT_DEVICE_REMOVED 1
|
||||
#define HIM_EVENT_DEVICE_PLUGGED 2
|
||||
#define HIM_EVENT_DEVICE_ERROR 3
|
||||
#define HIM_EVENT_RESET_REQUIRED 4
|
||||
#define HIM_EVENT_QUIESCE_DEVICE 5
|
||||
#define HIM_EVENT_UNQUIESCE_DEVICE 6
|
||||
#define HIM_EVENT_CONFIG_CHANGED 7
|
||||
|
||||
void ldm_event_notify(HPT_U32 event, void *arg1, void *arg2);
|
||||
|
||||
void log_sector_repair(PVDEV vd, int success, HPT_LBA lba, HPT_U16 nsectors);
|
||||
|
||||
void ldm_register_device(PVDEV vd);
|
||||
void ldm_unregister_device(PVDEV vd);
|
||||
|
||||
PVBUS him_handle_to_vbus(void * him_handle);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif
|
132
sys/dev/hptrr/list.h
Normal file
132
sys/dev/hptrr/list.h
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/*
|
||||
* $Id: list.h,v 1.6 2006/10/31 06:25:28 gmm Exp $
|
||||
* Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _HPT_LIST_H_
|
||||
#define _HPT_LIST_H_
|
||||
|
||||
#ifndef _LINUX_LIST_H
|
||||
|
||||
#ifndef HPT_INLINE
|
||||
#define HPT_INLINE __inline
|
||||
#endif
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next, *prev;
|
||||
};
|
||||
|
||||
#define INIT_LIST_HEAD(ptr) do { (ptr)->next = (ptr); (ptr)->prev = (ptr); } while (0)
|
||||
|
||||
static HPT_INLINE void __list_add(struct list_head * _new, struct list_head * prev, struct list_head * next)
|
||||
{
|
||||
next->prev = _new;
|
||||
_new->next = next;
|
||||
_new->prev = prev;
|
||||
prev->next = _new;
|
||||
}
|
||||
|
||||
static HPT_INLINE void list_add(struct list_head *_new, struct list_head *head)
|
||||
{
|
||||
__list_add(_new, head, head->next);
|
||||
}
|
||||
|
||||
static HPT_INLINE void list_add_tail(struct list_head *_new, struct list_head *head)
|
||||
{
|
||||
__list_add(_new, head->prev, head);
|
||||
}
|
||||
|
||||
static HPT_INLINE void __list_del(struct list_head * prev, struct list_head * next)
|
||||
{
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
static HPT_INLINE void list_del(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
}
|
||||
|
||||
static HPT_INLINE void list_del_init(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
INIT_LIST_HEAD(entry);
|
||||
}
|
||||
|
||||
static HPT_INLINE int list_empty(struct list_head *head)
|
||||
{
|
||||
HPT_ASSERT(!(head->next==head && head->prev!=head));
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
static HPT_INLINE void __list_splice(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
struct list_head *first = list->next;
|
||||
struct list_head *last = list->prev;
|
||||
struct list_head *at = head->next;
|
||||
|
||||
first->prev = head;
|
||||
head->next = first;
|
||||
|
||||
last->next = at;
|
||||
at->prev = last;
|
||||
}
|
||||
|
||||
static HPT_INLINE void list_splice(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list))
|
||||
__list_splice(list, head);
|
||||
}
|
||||
|
||||
static HPT_INLINE void list_splice_init(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list)) {
|
||||
__list_splice(list, head);
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
}
|
||||
|
||||
#define list_entry(ptr, type, member) \
|
||||
((type *)((char *)(ptr)-(HPT_UPTR)(&((type *)0)->member)))
|
||||
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; pos != (head); pos = pos->next)
|
||||
|
||||
#define list_for_each_safe(pos, n, head) \
|
||||
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||
pos = n, n = pos->next)
|
||||
|
||||
#define get_first_item(attached, type, member) \
|
||||
((type *)((char *)((attached)->next)-(HPT_UPTR)(&((type *)0)->member)))
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
260
sys/dev/hptrr/os_bsd.h
Normal file
260
sys/dev/hptrr/os_bsd.h
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/* $Id: os_bsd.h,v 1.18 2006/04/11 08:19:02 gmm Exp $
|
||||
*
|
||||
* HighPoint RAID Driver for FreeBSD
|
||||
* Copyright (C) 2005 HighPoint Technologies, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _OS_BSD_H
|
||||
#define _OS_BSD_H
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/cons.h>
|
||||
#if (__FreeBSD_version >= 500000)
|
||||
#include <sys/time.h>
|
||||
#include <sys/systm.h>
|
||||
#else
|
||||
#include <machine/clock.h> /*to support DELAY function under 4.x BSD versions*/
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/libkern.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#if (__FreeBSD_version >= 500000)
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/module.h>
|
||||
#endif
|
||||
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/taskqueue.h>
|
||||
#include <sys/ioccom.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/stdarg.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#if (__FreeBSD_version >= 500000)
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#else
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pcireg.h>
|
||||
#endif
|
||||
|
||||
#if (__FreeBSD_version <= 500043)
|
||||
#include <sys/devicestat.h>
|
||||
#endif
|
||||
|
||||
#include <cam/cam.h>
|
||||
#include <cam/cam_ccb.h>
|
||||
#include <cam/cam_sim.h>
|
||||
#include <cam/cam_xpt_sim.h>
|
||||
#include <cam/cam_debug.h>
|
||||
#include <cam/cam_xpt_periph.h>
|
||||
#include <cam/cam_periph.h>
|
||||
#include <cam/scsi/scsi_all.h>
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
|
||||
#if (__FreeBSD_version < 500043)
|
||||
#include <sys/bus_private.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _INQUIRYDATA {
|
||||
u_char DeviceType : 5;
|
||||
u_char DeviceTypeQualifier : 3;
|
||||
u_char DeviceTypeModifier : 7;
|
||||
u_char RemovableMedia : 1;
|
||||
u_char Versions;
|
||||
u_char ResponseDataFormat;
|
||||
u_char AdditionalLength;
|
||||
u_char Reserved[2];
|
||||
u_char SoftReset : 1;
|
||||
u_char CommandQueue : 1;
|
||||
u_char Reserved2 : 1;
|
||||
u_char LinkedCommands : 1;
|
||||
u_char Synchronous : 1;
|
||||
u_char Wide16Bit : 1;
|
||||
u_char Wide32Bit : 1;
|
||||
u_char RelativeAddressing : 1;
|
||||
u_char VendorId[8];
|
||||
u_char ProductId[16];
|
||||
u_char ProductRevisionLevel[4];
|
||||
u_char VendorSpecific[20];
|
||||
u_char Reserved3[40];
|
||||
}
|
||||
__attribute__((packed))
|
||||
INQUIRYDATA, *PINQUIRYDATA;
|
||||
|
||||
#endif
|
||||
|
||||
/* private headers */
|
||||
|
||||
#include <dev/hptrr/osm.h>
|
||||
#include <dev/hptrr/him.h>
|
||||
#include <dev/hptrr/ldm.h>
|
||||
|
||||
/* driver parameters */
|
||||
extern char driver_name[];
|
||||
extern char driver_name_long[];
|
||||
extern char driver_ver[];
|
||||
extern int osm_max_targets;
|
||||
|
||||
/*
|
||||
* adapter/vbus extensions:
|
||||
* each physical controller has an adapter_ext, passed to him.create_adapter()
|
||||
* each vbus has a vbus_ext passed to ldm_create_vbus().
|
||||
*/
|
||||
#define EXT_TYPE_HBA 1
|
||||
#define EXT_TYPE_VBUS 2
|
||||
|
||||
typedef struct _hba {
|
||||
int ext_type;
|
||||
LDM_ADAPTER ldm_adapter;
|
||||
device_t pcidev;
|
||||
PCI_ADDRESS pciaddr;
|
||||
struct _vbus_ext *vbus_ext;
|
||||
struct _hba *next;
|
||||
|
||||
struct {
|
||||
struct resource *res;
|
||||
int type;
|
||||
int rid;
|
||||
void *base;
|
||||
}
|
||||
pcibar[6];
|
||||
|
||||
struct resource *irq_res;
|
||||
void *irq_handle;
|
||||
}
|
||||
HBA, *PHBA;
|
||||
|
||||
typedef struct _os_cmdext {
|
||||
struct _vbus_ext *vbus_ext;
|
||||
struct _os_cmdext *next;
|
||||
union ccb *ccb;
|
||||
bus_dmamap_t dma_map;
|
||||
SG psg[os_max_sg_descriptors];
|
||||
}
|
||||
OS_CMDEXT, *POS_CMDEXT;
|
||||
|
||||
typedef struct _vbus_ext {
|
||||
int ext_type;
|
||||
struct _vbus_ext *next;
|
||||
PHBA hba_list;
|
||||
struct freelist *freelist_head;
|
||||
struct freelist *freelist_dma_head;
|
||||
|
||||
struct cam_sim *sim; /* sim for this vbus */
|
||||
struct cam_path *path; /* peripheral, path, tgt, lun with this vbus */
|
||||
#if (__FreeBSD_version >= 500000)
|
||||
struct mtx lock; /* general purpose lock */
|
||||
#else
|
||||
int hpt_splx;
|
||||
#endif
|
||||
bus_dma_tag_t io_dmat; /* I/O buffer DMA tag */
|
||||
|
||||
POS_CMDEXT cmdext_list;
|
||||
|
||||
OSM_TASK *tasks;
|
||||
struct task worker;
|
||||
|
||||
struct callout_handle timer;
|
||||
|
||||
eventhandler_tag shutdown_eh;
|
||||
|
||||
/* the LDM vbus instance continues */
|
||||
unsigned long vbus[0] __attribute__((aligned(sizeof(unsigned long))));
|
||||
}
|
||||
VBUS_EXT, *PVBUS_EXT;
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
#define hpt_lock_vbus(vbus_ext) mtx_lock(&(vbus_ext)->lock)
|
||||
#define hpt_unlock_vbus(vbus_ext) mtx_unlock(&(vbus_ext)->lock)
|
||||
#else
|
||||
static __inline void hpt_lock_vbus(PVBUS_EXT vbus_ext)
|
||||
{
|
||||
vbus_ext->hpt_splx = splcam();
|
||||
}
|
||||
static __inline void hpt_unlock_vbus(PVBUS_EXT vbus_ext)
|
||||
{
|
||||
splx(vbus_ext->hpt_splx);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define HPT_OSM_TIMEOUT (20*hz) /* timeout value for OS commands */
|
||||
|
||||
#define HPT_DO_IOCONTROL _IOW('H', 0, HPT_IOCTL_PARAM)
|
||||
|
||||
#define HPT_SCAN_BUS _IO('H', 1)
|
||||
|
||||
#if __FreeBSD_version >= 501000
|
||||
#define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi_giant,(task));
|
||||
#else
|
||||
#define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi,(task));
|
||||
#endif
|
||||
|
||||
#if __FreeBSD_version >= 500000
|
||||
static __inline int hpt_sleep(PVBUS_EXT vbus_ext, void *ident, int priority, const char *wmesg, int timo)
|
||||
{
|
||||
return msleep(ident, &vbus_ext->lock, priority, wmesg, timo);
|
||||
}
|
||||
#else
|
||||
static __inline int hpt_sleep(PVBUS_EXT vbus_ext, void *ident, int priority, const char *wmesg, int timo)
|
||||
{
|
||||
int retval = 0;
|
||||
|
||||
asleep(ident, priority, wmesg, timo);
|
||||
hpt_unlock_vbus(vbus_ext);
|
||||
retval = await(priority, timo);
|
||||
hpt_lock_vbus(vbus_ext);
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __FreeBSD_version < 501000
|
||||
#define READ_16 0x88
|
||||
#define WRITE_16 0x8a
|
||||
#define SERVICE_ACTION_IN 0x9e
|
||||
#endif
|
||||
|
||||
#define HPT_DEV_MAJOR 200
|
204
sys/dev/hptrr/osm.h
Normal file
204
sys/dev/hptrr/osm.h
Normal file
@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Copyright (c) HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <dev/hptrr/hptrr_config.h>
|
||||
/*
|
||||
* $Id: osm.h,v 1.5 2005/08/18 05:17:43 gmm Exp $
|
||||
* Copyright (C) 2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _HPT_OSM_H_
|
||||
#define _HPT_OSM_H_
|
||||
|
||||
#define VERMAGIC_OSM 5
|
||||
|
||||
#define os_max_queue_comm 32
|
||||
#define os_max_sg_descriptors 18
|
||||
|
||||
|
||||
#define DMAPOOL_PAGE_SIZE 0x1000 /* PAGE_SIZE (i386/x86_64) */
|
||||
#define os_max_cache_size 0x800000 /* 8MB */
|
||||
#define os_max_cache_pages (os_max_cache_size/DMAPOOL_PAGE_SIZE)
|
||||
|
||||
/* data types */
|
||||
typedef unsigned int HPT_UINT, HPT_U32;
|
||||
typedef unsigned long HPT_UPTR;
|
||||
typedef unsigned short HPT_U16;
|
||||
typedef unsigned char HPT_U8;
|
||||
typedef unsigned long HPT_TIME;
|
||||
typedef unsigned long long HPT_U64;
|
||||
|
||||
#define CPU_TO_LE64(x) (x)
|
||||
#define CPU_TO_LE32(x) (x)
|
||||
#define CPU_TO_LE16(x) (x)
|
||||
#define LE32_TO_CPU(x) (x)
|
||||
#define LE16_TO_CPU(x) (x)
|
||||
#define LE64_TO_CPU(x) (x)
|
||||
|
||||
#define FAR
|
||||
#define EXTERN_C
|
||||
|
||||
typedef void * HPT_PTR;
|
||||
|
||||
typedef HPT_U64 HPT_LBA;
|
||||
typedef HPT_U32 HPT_RAW_LBA;
|
||||
#define MAX_LBA_VALUE 0xffffffffffffffffull
|
||||
#define MAX_RAW_LBA_VALUE 0xfffffffful
|
||||
#define RAW_LBA(x) ((HPT_U32)(x))
|
||||
#define LO_LBA(x) ((HPT_U32)(x))
|
||||
#define HI_LBA(x) (sizeof(HPT_LBA)>4? (HPT_U32)((x)>>32) : 0)
|
||||
#define LBA_FORMAT_STR "0x%llX"
|
||||
|
||||
typedef HPT_U64 BUS_ADDRESS;
|
||||
#define LO_BUSADDR(x) ((HPT_U32)(x))
|
||||
#define HI_BUSADDR(x) (sizeof(BUS_ADDRESS)>4? (x)>>32 : 0)
|
||||
|
||||
typedef unsigned char HPT_BOOL;
|
||||
#define HPT_TRUE 1
|
||||
#define HPT_FALSE 0
|
||||
|
||||
typedef struct _TIME_RECORD {
|
||||
HPT_U32 seconds:6; /* 0 - 59 */
|
||||
HPT_U32 minutes:6; /* 0 - 59 */
|
||||
HPT_U32 month:4; /* 1 - 12 */
|
||||
HPT_U32 hours:6; /* 0 - 59 */
|
||||
HPT_U32 day:5; /* 1 - 31 */
|
||||
HPT_U32 year:5; /* 0=2000, 31=2031 */
|
||||
} TIME_RECORD;
|
||||
|
||||
/* hardware access */
|
||||
HPT_U8 os_inb (void *port);
|
||||
HPT_U16 os_inw (void *port);
|
||||
HPT_U32 os_inl (void *port);
|
||||
void os_outb (void *port, HPT_U8 value);
|
||||
void os_outw (void *port, HPT_U16 value);
|
||||
void os_outl (void *port, HPT_U32 value);
|
||||
void os_insw (void *port, HPT_U16 *buffer, HPT_U32 count);
|
||||
void os_outsw(void *port, HPT_U16 *buffer, HPT_U32 count);
|
||||
|
||||
extern HPT_U32 __dummy_reg; /* to avoid the compiler warning */
|
||||
|
||||
#define os_readb(addr) (*(HPT_U8 *)&__dummy_reg = *(volatile HPT_U8 *)(addr))
|
||||
#define os_readw(addr) (*(HPT_U16 *)&__dummy_reg = *(volatile HPT_U16 *)(addr))
|
||||
#define os_readl(addr) (*(HPT_U32 *)&__dummy_reg = *(volatile HPT_U32 *)(addr))
|
||||
|
||||
#define os_writeb(addr, val) *(volatile HPT_U8 *)(addr) = (HPT_U8)(val)
|
||||
#define os_writew(addr, val) *(volatile HPT_U16 *)(addr) = (HPT_U16)(val)
|
||||
#define os_writel(addr, val) *(volatile HPT_U32 *)(addr) = (HPT_U32)(val)
|
||||
|
||||
/* PCI configuration space for specified device*/
|
||||
HPT_U8 os_pci_readb (void *osext, HPT_U8 offset);
|
||||
HPT_U16 os_pci_readw (void *osext, HPT_U8 offset);
|
||||
HPT_U32 os_pci_readl (void *osext, HPT_U8 offset);
|
||||
void os_pci_writeb(void *osext, HPT_U8 offset, HPT_U8 value);
|
||||
void os_pci_writew(void *osext, HPT_U8 offset, HPT_U16 value);
|
||||
void os_pci_writel(void *osext, HPT_U8 offset, HPT_U32 value);
|
||||
|
||||
/* obsolute interface */
|
||||
#define MAX_PCI_BUS_NUMBER 0xff
|
||||
#define MAX_PCI_DEVICE_NUMBER 32
|
||||
#define MAX_PCI_FUNC_NUMBER 8
|
||||
#define pcicfg_read_dword(bus, dev, fn, reg) 0xffff
|
||||
|
||||
|
||||
void *os_map_pci_bar(
|
||||
void *osext,
|
||||
int index,
|
||||
HPT_U32 offset,
|
||||
HPT_U32 length
|
||||
);
|
||||
|
||||
|
||||
void os_unmap_pci_bar(void *osext, void *base);
|
||||
|
||||
#define os_kmap_sgptr(psg) (psg->addr._logical)
|
||||
#define os_kunmap_sgptr(ptr)
|
||||
#define os_set_sgptr(psg, ptr) (psg)->addr._logical = (ptr)
|
||||
|
||||
/* timer */
|
||||
void *os_add_timer(void *osext, HPT_U32 microseconds, void (*proc)(void *), void *arg);
|
||||
void os_del_timer(void *handle);
|
||||
void os_request_timer(void * osext, HPT_U32 interval);
|
||||
HPT_TIME os_query_time(void);
|
||||
|
||||
/* task */
|
||||
#define OS_SUPPORT_TASK
|
||||
|
||||
typedef struct _OSM_TASK {
|
||||
struct _OSM_TASK *next;
|
||||
void (*func)(void *vbus, void *data);
|
||||
void *data;
|
||||
}
|
||||
OSM_TASK;
|
||||
|
||||
void os_schedule_task(void *osext, OSM_TASK *task);
|
||||
|
||||
/* misc */
|
||||
HPT_U32 os_get_stamp(void);
|
||||
void os_stallexec(HPT_U32 microseconds);
|
||||
|
||||
#ifndef _SYS_LIBKERN_H_
|
||||
#define memcpy(dst, src, size) __builtin_memcpy((dst), (src), (size))
|
||||
#define memcmp(dst, src, size) __builtin_memcmp((dst), (src), (size))
|
||||
#define strcpy(dst, src) __builtin_strcpy((dst), (src))
|
||||
static __inline void * memset(void *dst, int c, unsigned long size)
|
||||
{
|
||||
char *p;
|
||||
for (p=(char*)dst; size; size--,p++) *p = c;
|
||||
return dst;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define farMemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (HPT_U32)c)
|
||||
|
||||
|
||||
#define os_register_device(osext, target_id)
|
||||
#define os_unregister_device(osext, target_id)
|
||||
int os_query_remove_device(void *osext, int target_id);
|
||||
int os_revalidate_device(void *osext, int target_id);
|
||||
|
||||
HPT_U8 os_get_vbus_seq(void *osext);
|
||||
|
||||
/* debug support */
|
||||
int os_printk(char *fmt, ...);
|
||||
|
||||
#ifdef DBG
|
||||
extern int hpt_dbg_level;
|
||||
#define KdPrint(x) do { if (hpt_dbg_level) os_printk x; } while (0)
|
||||
void __os_dbgbreak(const char *file, int line);
|
||||
#define os_dbgbreak() __os_dbgbreak(__FILE__, __LINE__)
|
||||
#define HPT_ASSERT(x) do { if (!(x)) os_dbgbreak(); } while (0)
|
||||
void os_check_stack(const char *location, int size);
|
||||
#define HPT_CHECK_STACK(size) os_check_stack(__FUNCTION__, (size))
|
||||
#else
|
||||
#define KdPrint(x)
|
||||
#define HPT_ASSERT(x)
|
||||
#define HPT_CHECK_STACK(size)
|
||||
#endif
|
||||
|
||||
#define OsPrint(x) do { os_printk x; } while (0)
|
||||
|
||||
#endif
|
@ -138,6 +138,7 @@ device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID
|
||||
device ciss # Compaq Smart RAID 5*
|
||||
device dpt # DPT Smartcache III, IV - See NOTES for options
|
||||
device hptmv # Highpoint RocketRAID 182x
|
||||
device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx
|
||||
device rr232x # Highpoint RocketRAID 232x
|
||||
device iir # Intel Integrated RAID
|
||||
device ips # IBM (Adaptec) ServeRAID
|
||||
|
@ -729,10 +729,14 @@ device aacp # SCSI Passthrough interface (optional, CAM required)
|
||||
device asr
|
||||
|
||||
#
|
||||
# Highpoint RocketRAID 182x. This is really just software RAID on a
|
||||
# Marvell SATA chip.
|
||||
# Highpoint RocketRAID 182x.
|
||||
device hptmv
|
||||
|
||||
#
|
||||
# Highpoint RocketRAID. Supports RR172x, RR222x, RR2240, RR232x, RR2340,
|
||||
# RR2210, RR174x, RR2522, RR231x, RR230x.
|
||||
device hptrr
|
||||
|
||||
#
|
||||
# Highpoint RocketRAID 232x. This is software RAID but with hardware
|
||||
# acceleration assistance for RAID_5.
|
||||
|
@ -46,6 +46,7 @@ nodevice asr
|
||||
nodevice dpt
|
||||
nodevice mly
|
||||
nodevice hptmv
|
||||
nodevice hptrr
|
||||
|
||||
nodevice ida
|
||||
nodevice mlx
|
||||
|
@ -97,6 +97,7 @@ SUBDIR= ${_3dfx} \
|
||||
hme \
|
||||
${_hptiop} \
|
||||
${_hptmv} \
|
||||
${_hptrr} \
|
||||
hwpmc \
|
||||
${_i2c} \
|
||||
${_ibcs2} \
|
||||
@ -449,6 +450,7 @@ _dpt= dpt
|
||||
_ex= ex
|
||||
_hptiop= hptiop
|
||||
_hptmv= hptmv
|
||||
_hptrr= hptrr
|
||||
_ichwd= ichwd
|
||||
_ida= ida
|
||||
# Disabled due to non-MPSAFEty in 7.0
|
||||
@ -510,6 +512,7 @@ _exca= exca
|
||||
_ext2fs= ext2fs
|
||||
_hptiop= hptiop
|
||||
_hptmv= hptmv
|
||||
_hptrr= hptrr
|
||||
_i2c= i2c
|
||||
_ichwd= ichwd
|
||||
_ida= ida
|
||||
|
14
sys/modules/hptrr/Makefile
Normal file
14
sys/modules/hptrr/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
# $Id: Makefile.def,v 1.18 2007/03/22 11:20:15 gmm Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
HPTRR= ${.CURDIR}/../../dev/hptrr
|
||||
.PATH: ${HPTRR}
|
||||
KMOD = hptrr
|
||||
SRCS = opt_scsi.h opt_cam.h bus_if.h device_if.h pci_if.h os_bsd.h
|
||||
SRCS+= hptrr_os_bsd.c hptrr_osm_bsd.c hptrr_config.c
|
||||
OBJS = hptrr_lib.o
|
||||
|
||||
hptrr_lib.o:
|
||||
uudecode -p < ${HPTRR}/$(MACHINE_ARCH)-elf.hptrr_lib.o.uu > hptrr_lib.o
|
||||
|
||||
.include <bsd.kmod.mk>
|
Loading…
Reference in New Issue
Block a user