Update vendor driver to 1.2.7. This update improves driver reliability and

adds support of 4Kn drives and report LUNs command.

This driver update is intended for 10.2-RELEASE.

Many thanks to HighPoint for providing this driver update.

Submitted by:	Steve Chang
MFC after:	3 days
This commit is contained in:
Xin LI 2015-06-23 17:26:16 +00:00
parent 69f172f27d
commit f29c86f1ed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=284730
15 changed files with 43392 additions and 38155 deletions

View File

@ -1,10 +1,34 @@
RocketRAID Controller Driver for FreeBSD
Copyright (C) 2011 HighPoint Technologies, Inc. All rights reserved.
Copyright (C) 2005-2015 HighPoint Technologies, Inc. All rights reserved.
#############################################################################
Revision History:
v1.0 2011-12-27
First source code release
v1.2.7.1 06/08/2015
* Add 10.x comment and correct file name in readme.
v1.2.7 05/22/2015
* Support Report Luns command.
v1.2.6 04/13/2015
* Fix a bug that some disks will be dropped when data integrity test over
one hour on 32bit system.
v1.2.5 01/26/2015
* Fix a bug that failed to verify controller by retrying 8 times.
* Supported 4Kn drive.
v1.2.4 09/29/2014
* Fix a bug that memory would be corrupted and caused strange system
behavior when running IO and WebGUI
v1.2.3 01/24/2014
* fixup system crash while write date to raid5.
v1.1 07/01/2013
* Fix 2nd RAID controller can not load as multipath issue.
v1.0 12/13/2011
* First source code release
#############################################################################
@ -40,7 +64,7 @@ Revision History:
2) Extract the driver files under the kernel source tree:
# cd /usr/src/sys/
# tar xvzf /your/path/to/hpt27xx-freebsd-src-v1.0-111227.tgz
# tar xvzf /your/path/to/HPT27xx_FreeBSD_Src_v1.2.7.1_15_06_08.tgz
3) Update the kernel configuration file to include the HighPoint source.
Assume the configure file is GENERIC, and new kernel configure file is
@ -62,8 +86,8 @@ Revision History:
compile-with "uudecode < $S/dev/hpt27xx/i386-elf.hpt27xx_lib.o.uu" \
no-implicit-rule
dev/hpt27xx/os_bsd.c optional hpt27xx
dev/hpt27xx/osm_bsd.c optional hpt27xx
dev/hpt27xx/hpt27xx_os_bsd.c optional hpt27xx
dev/hpt27xx/hpt27xx_osm_bsd.c optional hpt27xx
dev/hpt27xx/hpt27xx_config.c optional hpt27xx
For amd64 system, edit /usr/src/sys/conf/files.amd64 and append the lines
@ -74,13 +98,13 @@ Revision History:
compile-with "uudecode < $S/dev/hpt27xx/amd64-elf.hpt27xx_lib.o.uu" \
no-implicit-rule
dev/hpt27xx/os_bsd.c optional hpt27xx
dev/hpt27xx/osm_bsd.c optional hpt27xx
dev/hpt27xx/hpt27xx_os_bsd.c optional hpt27xx
dev/hpt27xx/hpt27xx_osm_bsd.c optional hpt27xx
dev/hpt27xx/hpt27xx_config.c optional hpt27xx
6) Rebuild and install the kernel:
a) for FreeBSD 5.x-i386/6.x-i386/7.x-i386/8.x-i386/9.x-i386:
a) for FreeBSD 5.x-i386/6.x-i386/7.x-i386/8.x-i386/9.x-i386/10.x-i386:
# cd /usr/src/sys/i386/conf/
# /usr/sbin/config MYKERNEL
@ -89,7 +113,7 @@ Revision History:
# make
# make install
b) for FreeBSD 5.x-amd64/6.x-amd64/7.x-amd64/8.x-amd64/9.x-amd64:
b) for FreeBSD 5.x-amd64/6.x-amd64/7.x-amd64/8.x-amd64/9.x-amd64/10.x-amd64:
# cd /usr/src/sys/amd64/conf/
# /usr/sbin/config MYKERNEL
@ -122,7 +146,7 @@ Revision History:
2) Extract the driver files under the kernel source tree:
# cd /usr/src/sys/
# tar xvzf /your/path/to/hpt27xx-freebsd-src-v1.0-111227.tgz
# tar xvzf /your/path/to/HPT27xx_FreeBSD_Src_v1.2.7.1_15_06_08.tgz
4) Build the driver module:
@ -136,7 +160,7 @@ Revision History:
# cp hpt27xx.ko /modules/
For FreeBSD 5.x/6.x/7.x/8.x/9.x:
For FreeBSD 5.x/6.x/7.x/8.x/9.x/10.x:
# cp hpt27xx.ko /boot/kernel/
@ -162,7 +186,7 @@ Revision History:
/modules/hpt27xx.ko text=0xf571 data=0x2c8+0x254
ok boot
For FreeBSD 5.x/6.x/7.x/8.x/9.x, you can select 6 on the boot menu to get a loader
For FreeBSD 5.x/6.x/7.x/8.x/9.x/10.x, you can select 6 on the boot menu to get a loader
prompt.
7) You can add a below line into /boot/defaults/loader.conf to load the

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* Copyright (c) 2004-2011 HighPoint Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -93,7 +93,11 @@ typedef struct _HIM_ADAPTER_CONFIG
HPT_U32 nvramSize;
HPT_U64 nvramAddress;
HPT_U8 slot_index;
HPT_U8 reserved2[11];
HPT_U8 maxWidth;
HPT_U8 currentWidth;
HPT_U8 maxSpeed;
HPT_U8 currentSpeed;
HPT_U8 reserved2[7];
}
HIM_ADAPTER_CONFIG, *PHIM_ADAPTER_CONFIG;
@ -117,6 +121,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;
@ -194,7 +199,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;
@ -342,11 +348,23 @@ typedef struct _ScsiComm {
HPT_U8 scsiStatus;
HPT_U8 reserve1;
HPT_U32 dataLength;
HPT_U8 *cdb;
HPT_U8 cdb[16];
HPT_U8 *senseBuffer;
}
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
@ -357,7 +375,7 @@ typedef struct _R5ControlCmd {
HPT_U64 StripeLine;
HPT_U16 Offset;
HPT_U8 Command;
HPT_U8 reserve1;
HPT_U8 CmdTarget;
}
R5ControlCmd, *PR5ControlCmd;
@ -379,8 +397,8 @@ typedef struct ctl_pages {
typedef struct _R1ControlCmd {
HPT_U64 Lba;
HPT_U16 nSectors;
HPT_U8 Command; /* CTRL_CMD_XXX */
HPT_U8 reserve1;
HPT_U8 Command;
HPT_U8 CmdTarget;
PCONTROL_PAGES ctl_pages;
}
R1ControlCmd, *PR1ControlCmd;
@ -427,6 +445,7 @@ typedef struct _COMMAND
AtaComm Ide;
PassthroughCmd Passthrough;
ScsiComm Scsi;
ScsiExtComm ScsiExt;
R5ControlCmd R5Control;
R1ControlCmd R1Control;
} uCmd;
@ -464,6 +483,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 */

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* Copyright (c) 2005-2011 HighPoint Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -101,6 +101,7 @@ _HIM_INTERFACE(int, get_enclosure_count, (void *adapter))
_HIM_INTERFACE(int, get_enclosure_info, (void *adapter, int id, void *pinfo))
_HIM_INTERFACE(int, get_enclosure_info_v2, (void *adapter, int id, void *pinfo))
_HIM_INTERFACE(int, get_enclosure_info_v3, (void *adapter, int id, void *pinfo))
_HIM_INTERFACE(int, get_enclosure_info_v4, (void *adapter, int enc_id, int ele_id, void *pinfo, void *pstatus))
_HIM_INTERFACE(HPT_BOOL, flash_access, (void *adapter, HPT_U32 offset, void *value, int size, HPT_BOOL reading))

View File

@ -60,7 +60,7 @@ int init_config(void)
const char driver_name[] = "hpt27xx";
const char driver_name_long[] = "RocketRAID 27xx controller driver";
const char driver_ver[] = "v1.1";
const char driver_ver[] = "v1.2.7";
int osm_max_targets = 0xff;

View File

@ -149,7 +149,9 @@
#define os_stallexec hpt27xx_os_stallexec
#define os_unmap_pci_bar hpt27xx_os_unmap_pci_bar
#define osm_max_targets hpt27xx_osm_max_targets
#define pcicfg_read_byte hpt27xx_pcicfg_read_byte
#define pcicfg_read_dword hpt27xx_pcicfg_read_dword
#define vbus_list hpt27xx_vbus_list
#define vdev_queue_cmd hpt27xx_vdev_queue_cmd
#define get_dmapool_phy_addr hpt27xx_get_dmapool_phy_addr
#endif

View File

@ -1,5 +1,7 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* HighPoint RAID Driver for FreeBSD
*
* Copyright (C) 2005-2011 HighPoint Technologies, Inc. All Rights Reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,6 +32,8 @@
#include <dev/hpt27xx/os_bsd.h>
BUS_ADDRESS get_dmapool_phy_addr(void *osext, void * dmapool_virt_addr);
/* 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); }
@ -78,6 +82,11 @@ void os_pci_writel (void *osext, HPT_U8 offset, HPT_U32 value)
pci_write_config(((PHBA)osext)->pcidev, offset, value, 4);
}
BUS_ADDRESS get_dmapool_phy_addr(void *osext, void * dmapool_virt_addr)
{
return (BUS_ADDRESS)vtophys(dmapool_virt_addr);
}
/* PCI space access */
HPT_U8 pcicfg_read_byte (HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg)
{
@ -240,8 +249,13 @@ void os_request_timer(void * osext, HPT_U32 interval)
HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS);
#if (__FreeBSD_version >= 1000510)
callout_reset_sbt(&vbus_ext->timer, SBT_1US * interval, 0,
os_timer_for_ldm, vbus_ext, 0);
#else
untimeout(os_timer_for_ldm, vbus_ext, vbus_ext->timer);
vbus_ext->timer = timeout(os_timer_for_ldm, vbus_ext, interval * hz / 1000000);
#endif
}
HPT_TIME os_query_time(void)

View File

@ -374,7 +374,10 @@ static void hpt_shutdown_vbus(PVBUS_EXT vbus_ext, int howto)
vbus_ext->hba_list = hba->next;
free(hba->ldm_adapter.him_handle, M_DEVBUF);
}
#if (__FreeBSD_version >= 1000510)
callout_drain(&vbus_ext->timer);
mtx_destroy(&vbus_ext->lock);
#endif
free(vbus_ext, M_DEVBUF);
KdPrint(("hpt_shutdown_vbus done"));
}
@ -437,10 +440,12 @@ static void os_cmddone(PCOMMAND pCmd)
POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv;
union ccb *ccb = ext->ccb;
KdPrint(("os_cmddone(%p, %d)", pCmd, pCmd->Result));
KdPrint(("<8>os_cmddone(%p, %d)", pCmd, pCmd->Result));
#if (__FreeBSD_version >= 1000510)
callout_stop(&ext->timeout);
#else
untimeout(hpt_timeout, pCmd, ccb->ccb_h.timeout_ch);
#endif
switch(pCmd->Result) {
case RETURN_SUCCESS:
ccb->ccb_h.status = CAM_REQ_CMP;
@ -483,14 +488,39 @@ static int os_buildsgl(PCOMMAND pCmd, PSG pSg, int logical)
{
POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv;
union ccb *ccb = ext->ccb;
if (logical) {
#if (__FreeBSD_version >= 1000510)
if(logical) {
os_set_sgptr(pSg, (HPT_U8 *)ccb->csio.data_ptr);
pSg->size = ccb->csio.dxfer_len;
pSg->eot = 1;
return TRUE;
}
#else
bus_dma_segment_t *sgList = (bus_dma_segment_t *)ccb->csio.data_ptr;
int idx;
if(logical) {
if (ccb->ccb_h.flags & CAM_DATA_PHYS)
panic("physical address unsupported");
if (ccb->ccb_h.flags & CAM_SCATTER_VALID) {
if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS)
panic("physical address unsupported");
for (idx = 0; idx < ccb->csio.sglist_cnt; idx++) {
os_set_sgptr(&pSg[idx], (HPT_U8 *)(HPT_UPTR)sgList[idx].ds_addr);
pSg[idx].size = sgList[idx].ds_len;
pSg[idx].eot = (idx==ccb->csio.sglist_cnt-1)? 1 : 0;
}
}
else {
os_set_sgptr(pSg, (HPT_U8 *)ccb->csio.data_ptr);
pSg->size = ccb->csio.dxfer_len;
pSg->eot = 1;
}
return TRUE;
}
#endif
/* since we have provided physical sg, nobody will ask us to build physical sg */
HPT_ASSERT(0);
return FALSE;
@ -527,7 +557,11 @@ static void hpt_io_dmamap_callback(void *arg, bus_dma_segment_t *segs, int nsegs
BUS_DMASYNC_PREWRITE);
}
}
#if (__FreeBSD_version >= 1000510)
callout_reset(&ext->timeout, HPT_OSM_TIMEOUT, hpt_timeout, pCmd);
#else
ext->ccb->ccb_h.timeout_ch = timeout(hpt_timeout, pCmd, HPT_OSM_TIMEOUT);
#endif
ldm_queue_cmd(pCmd);
}
@ -544,7 +578,7 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb)
else
cdb = ccb->csio.cdb_io.cdb_bytes;
KdPrint(("hpt_scsi_io: ccb %x id %d lun %d cdb %x-%x-%x",
KdPrint(("<8>hpt_scsi_io: ccb %x id %d lun %d cdb %x-%x-%x",
ccb,
ccb->ccb_h.target_id, ccb->ccb_h.target_lun,
*(HPT_U32 *)&cdb[0], *(HPT_U32 *)&cdb[4], *(HPT_U32 *)&cdb[8]
@ -603,30 +637,78 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb)
{
HPT_U8 *rbuf = ccb->csio.data_ptr;
HPT_U32 cap;
HPT_U8 sector_size_shift = 0;
HPT_U64 new_cap;
HPT_U32 sector_size = 0;
if (mIsArray(vd->type))
sector_size_shift = vd->u.array.sector_size_shift;
else{
if(vd->type == VD_RAW){
sector_size = vd->u.raw.logical_sector_size;
}
if (vd->capacity>0xfffffffful)
cap = 0xfffffffful;
switch (sector_size) {
case 0x1000:
KdPrint(("set 4k setctor size in READ_CAPACITY"));
sector_size_shift = 3;
break;
default:
break;
}
}
new_cap = vd->capacity >> sector_size_shift;
if (new_cap > 0xfffffffful)
cap = 0xffffffff;
else
cap = vd->capacity - 1;
cap = new_cap - 1;
rbuf[0] = (HPT_U8)(cap>>24);
rbuf[1] = (HPT_U8)(cap>>16);
rbuf[2] = (HPT_U8)(cap>>8);
rbuf[3] = (HPT_U8)cap;
rbuf[4] = 0;
rbuf[5] = 0;
rbuf[6] = 2;
rbuf[6] = 2 << sector_size_shift;
rbuf[7] = 0;
ccb->ccb_h.status = CAM_REQ_CMP;
break;
}
case REPORT_LUNS:
{
HPT_U8 *rbuf = ccb->csio.data_ptr;
memset(rbuf, 0, 16);
rbuf[3] = 8;
ccb->ccb_h.status = CAM_REQ_CMP;
break;
}
case SERVICE_ACTION_IN:
{
HPT_U8 *rbuf = ccb->csio.data_ptr;
HPT_U64 cap = vd->capacity - 1;
HPT_U64 cap = 0;
HPT_U8 sector_size_shift = 0;
HPT_U32 sector_size = 0;
if(mIsArray(vd->type))
sector_size_shift = vd->u.array.sector_size_shift;
else{
if(vd->type == VD_RAW){
sector_size = vd->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 = (vd->capacity >> sector_size_shift) - 1;
rbuf[0] = (HPT_U8)(cap>>56);
rbuf[1] = (HPT_U8)(cap>>48);
rbuf[2] = (HPT_U8)(cap>>40);
@ -637,7 +719,7 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb)
rbuf[7] = (HPT_U8)cap;
rbuf[8] = 0;
rbuf[9] = 0;
rbuf[10] = 2;
rbuf[10] = 2 << sector_size_shift;
rbuf[11] = 0;
ccb->ccb_h.status = CAM_REQ_CMP;
@ -654,7 +736,8 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb)
case 0x2f:
case 0x8f: /* VERIFY_16 */
{
int error;
HPT_U8 sector_size_shift = 0;
HPT_U32 sector_size = 0;
pCmd = ldm_alloc_cmds(vbus, vd->cmds_per_request);
if(!pCmd){
KdPrint(("Failed to allocate command!"));
@ -692,6 +775,27 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb)
pCmd->uCmd.Ide.nSectors = (HPT_U16) cdb[8] | ((HPT_U16)cdb[7]<<8);
break;
}
if(mIsArray(vd->type)) {
sector_size_shift = vd->u.array.sector_size_shift;
}
else{
if(vd->type == VD_RAW){
sector_size = vd->u.raw.logical_sector_size;
}
switch (sector_size) {
case 0x1000:
KdPrint(("<8>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;
switch (cdb[0]) {
case READ_6:
@ -711,20 +815,52 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb)
pCmd->target = vd;
pCmd->done = os_cmddone;
pCmd->buildsgl = os_buildsgl;
pCmd->psg = ext->psg;
pCmd->flags.physical_sg = 1;
error = bus_dmamap_load_ccb(vbus_ext->io_dmat,
ext->dma_map, ccb,
hpt_io_dmamap_callback, pCmd,
#if (__FreeBSD_version < 1000510)
if (ccb->ccb_h.flags & CAM_SCATTER_VALID) {
int idx;
bus_dma_segment_t *sgList = (bus_dma_segment_t *)ccb->csio.data_ptr;
if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS)
pCmd->flags.physical_sg = 1;
for (idx = 0; idx < ccb->csio.sglist_cnt; idx++) {
pCmd->psg[idx].addr.bus = sgList[idx].ds_addr;
pCmd->psg[idx].size = sgList[idx].ds_len;
pCmd->psg[idx].eot = (idx==ccb->csio.sglist_cnt-1)? 1 : 0;
}
ccb->ccb_h.timeout_ch = timeout(hpt_timeout, pCmd, HPT_OSM_TIMEOUT);
ldm_queue_cmd(pCmd);
}
else
#endif
{
int error;
pCmd->flags.physical_sg = 1;
#if (__FreeBSD_version >= 1000510)
error = bus_dmamap_load_ccb(vbus_ext->io_dmat,
ext->dma_map, ccb,
hpt_io_dmamap_callback, pCmd,
BUS_DMA_WAITOK
);
#else
error = bus_dmamap_load(vbus_ext->io_dmat,
ext->dma_map,
ccb->csio.data_ptr, ccb->csio.dxfer_len,
hpt_io_dmamap_callback, pCmd,
BUS_DMA_WAITOK
);
KdPrint(("bus_dmamap_load return %d", error));
if (error && error!=EINPROGRESS) {
os_printk("bus_dmamap_load error %d", error);
cmdext_put(ext);
ldm_free_cmds(pCmd);
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
xpt_done(ccb);
#endif
KdPrint(("<8>bus_dmamap_load return %d", error));
if (error && error!=EINPROGRESS) {
os_printk("bus_dmamap_load error %d", error);
cmdext_put(ext);
ldm_free_cmds(pCmd);
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
xpt_done(ccb);
}
}
return;
}
@ -742,11 +878,26 @@ static void hpt_action(struct cam_sim *sim, union ccb *ccb)
{
PVBUS_EXT vbus_ext = (PVBUS_EXT)cam_sim_softc(sim);
KdPrint(("hpt_action(fn=%d, id=%d)", ccb->ccb_h.func_code, ccb->ccb_h.target_id));
KdPrint(("<8>hpt_action(fn=%d, id=%d)", ccb->ccb_h.func_code, ccb->ccb_h.target_id));
#if (__FreeBSD_version >= 1000510)
hpt_assert_vbus_locked(vbus_ext);
#endif
switch (ccb->ccb_h.func_code) {
#if (__FreeBSD_version < 1000510)
case XPT_SCSI_IO:
hpt_lock_vbus(vbus_ext);
hpt_scsi_io(vbus_ext, ccb);
hpt_unlock_vbus(vbus_ext);
return;
case XPT_RESET_BUS:
hpt_lock_vbus(vbus_ext);
ldm_reset_vbus((PVBUS)vbus_ext->vbus);
hpt_unlock_vbus(vbus_ext);
break;
#else
case XPT_SCSI_IO:
hpt_scsi_io(vbus_ext, ccb);
return;
@ -754,7 +905,7 @@ static void hpt_action(struct cam_sim *sim, union ccb *ccb)
case XPT_RESET_BUS:
ldm_reset_vbus((PVBUS)vbus_ext->vbus);
break;
#endif
case XPT_GET_TRAN_SETTINGS:
case XPT_SET_TRAN_SETTINGS:
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
@ -813,15 +964,19 @@ static void hpt_pci_intr(void *arg)
static void hpt_poll(struct cam_sim *sim)
{
#if (__FreeBSD_version < 1000510)
hpt_pci_intr(cam_sim_softc(sim));
#else
PVBUS_EXT vbus_ext = (PVBUS_EXT)cam_sim_softc(sim);
hpt_assert_vbus_locked(vbus_ext);
ldm_intr((PVBUS)vbus_ext->vbus);
#endif
}
static void hpt_async(void * callback_arg, u_int32_t code, struct cam_path * path, void * arg)
{
KdPrint(("hpt_async"));
KdPrint(("<8>hpt_async"));
}
static int hpt_shutdown(device_t dev)
@ -867,7 +1022,7 @@ static void hpt_do_ioctl(IOCTL_ARG *ioctl_args)
{
PVBUS vbus;
PVBUS_EXT vbus_ext;
ldm_for_each_vbus(vbus, vbus_ext) {
__hpt_do_ioctl(vbus_ext, ioctl_args);
if (ioctl_args->result!=HPT_IOCTL_RESULT_WRONG_VBUS)
@ -1003,7 +1158,11 @@ static void hpt_final_init(void *dummy)
ldm_for_each_vbus(vbus, vbus_ext) {
/* make timer available here */
mtx_init(&vbus_ext->lock, "hptsleeplock", NULL, MTX_DEF);
#if (__FreeBSD_version < 1000510)
callout_handle_init(&vbus_ext->timer);
#else
callout_init_mtx(&vbus_ext->timer, &vbus_ext->lock, 0);
#endif
if (hpt_init_vbus(vbus_ext)) {
os_printk("fail to initialize hardware");
break; /* FIXME */
@ -1046,16 +1205,23 @@ static void hpt_final_init(void *dummy)
os_printk("Can't create dma map(%d)", i);
return ;
}
#if (__FreeBSD_version >= 1000510)
callout_init_mtx(&ext->timeout, &vbus_ext->lock, 0);
#endif
}
if ((devq = cam_simq_alloc(os_max_queue_comm)) == NULL) {
os_printk("cam_simq_alloc failed");
return ;
}
#if (__FreeBSD_version >= 1000510)
vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name,
vbus_ext, unit_number, &vbus_ext->lock, os_max_queue_comm, /*tagged*/8, devq);
#else
vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name,
vbus_ext, unit_number, &Giant, os_max_queue_comm, /*tagged*/8, devq);
#endif
unit_number++;
if (!vbus_ext->sim) {
os_printk("cam_sim_alloc failed");
@ -1100,8 +1266,11 @@ static void hpt_final_init(void *dummy)
os_printk("can't allocate interrupt");
return ;
}
#if (__FreeBSD_version >= 1000510)
if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM | INTR_MPSAFE,
#else
if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM,
#endif
NULL, hpt_pci_intr, vbus_ext, &hba->irq_handle))
{
os_printk("can't set up interrupt");
@ -1239,7 +1408,7 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, stru
case HPT_DO_IOCONTROL:
{
if (piop->Magic == HPT_IOCTL_MAGIC || piop->Magic == HPT_IOCTL_MAGIC32) {
KdPrint(("ioctl=%x in=%p len=%d out=%p len=%d\n",
KdPrint(("<8>ioctl=%x in=%p len=%d out=%p len=%d\n",
piop->dwIoControlCode,
piop->lpInBuffer,
piop->nInBufferSize,
@ -1268,8 +1437,16 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, stru
goto invalid;
}
#if __FreeBSD_version < 1000510
mtx_lock(&Giant);
#endif
hpt_do_ioctl(&ioctl_args);
#if __FreeBSD_version < 1000510
mtx_unlock(&Giant);
#endif
if (ioctl_args.result==HPT_IOCTL_RESULT_OK) {
if (piop->nOutBufferSize) {
if (copyout(ioctl_args.lpOutBuffer,
@ -1309,13 +1486,19 @@ static int hpt_rescan_bus(void)
union ccb *ccb;
PVBUS vbus;
PVBUS_EXT vbus_ext;
#if (__FreeBSD_version < 1000510)
mtx_lock(&Giant);
#endif
ldm_for_each_vbus(vbus, vbus_ext) {
if ((ccb = xpt_alloc_ccb()) == NULL)
{
return(ENOMEM);
}
#if (__FreeBSD_version < 1000510)
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(vbus_ext->sim),
#else
if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(vbus_ext->sim),
#endif
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP)
{
xpt_free_ccb(ccb);
@ -1323,6 +1506,9 @@ static int hpt_rescan_bus(void)
}
xpt_rescan(ccb);
}
return(0);
#if (__FreeBSD_version < 1000510)
mtx_unlock(&Giant);
#endif
return(0);
}

View File

@ -28,6 +28,7 @@
#include <dev/hpt27xx/hpt27xx_config.h>
#ifndef HPT_INTF_H
#define HPT_INTF_H
@ -111,6 +112,7 @@ typedef HPT_U32 DEVICEID;
#define PDT_HARDDISK 1
#define PDT_CDROM 2
#define PDT_TAPE 3
#define PDT_CHANGER 4
/*
* Some constants.
@ -158,6 +160,9 @@ typedef HPT_U32 DEVICEID;
#define ARRAY_FLAG_NEEDINITIALIZING 0x00001000 /* the array's initialization hasn't finished*/
#define ARRAY_FLAG_BROKEN_REDUNDANT 0x00002000 /* broken but redundant (raid6) */
#define ARRAY_FLAG_RAID15PLUS 0x80000000 /* display this RAID 1 as RAID 1.5 */
#define ARRAY_FLAG_ZERO_STARTING 0x40000000 /* start lba of all members of this array is 0 */
/*
* device flags
*/
@ -169,11 +174,20 @@ 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 */
#define DEVICE_FLAG_IS_SPARE 0x80000000 /* is a spare disk */
#define DEVICE_FLAG_SSD 0x00000100 /* SSD device */
#define DEVICE_FLAG_3G 0x10000000
#define DEVICE_FLAG_6G 0x20000000
/*
* array states used by hpt_set_array_state()
*/
@ -288,8 +302,15 @@ typedef HPT_U32 DEVICEID;
#define HPT_IOCTL_SET_PERFMON_STATUS HPT_CTL_CODE(64)
#define HPT_IOCTL_GET_PERFMON_DATA HPT_CTL_CODE(65)
#define HPT_IOCTL_IDE_PASS_THROUGH_V2 HPT_CTL_CODE(66)
#define HPT_IOCTL_GET_ENCLOSURE_INFO_V2 HPT_CTL_CODE(67)
#define HPT_IOCTL_GET_ENCLOSURE_INFO_V3 HPT_CTL_CODE(68)
#define HPT_IOCTL_GET_ENCLOSURE_INFO_V2 HPT_CTL_CODE(67)
#define HPT_IOCTL_GET_ENCLOSURE_INFO_V3 HPT_CTL_CODE(68)
#define HPT_IOCTL_ACCESS_CONFIG_REG HPT_CTL_CODE(69)
#define HPT_IOCTL_GET_ENCLOSURE_INFO_V4 HPT_CTL_CODE(70)
#define HPT_IOCTL_GET_ENCLOSURE_ELEMENT_INFO HPT_CTL_CODE(71)
#define HPT_IOCTL_DUMP_METADATA HPT_CTL_CODE(72)
#define HPT_IOCTL_GET_CONTROLLER_INFO_V2_EXT HPT_CTL_CODE(73)
#define HPT_IOCTL_GET_CONTROLLER_IDS HPT_CTL_CODE(100)
#define HPT_IOCTL_GET_DCB HPT_CTL_CODE(101)
@ -297,6 +318,13 @@ typedef HPT_U32 DEVICEID;
#define HPT_IOCTL_EPROM_IO HPT_CTL_CODE(102)
#define HPT_IOCTL_GET_CONTROLLER_VENID HPT_CTL_CODE(103)
#define HPT_IOCTL_GET_DRIVER_CAPABILITIES_CC HPT_CTL_CODE(200)
#define HPT_IOCTL_GET_CCS_INFO HPT_CTL_CODE(201)
#define HPT_IOCTL_CREATE_CC HPT_CTL_CODE(202)
#define HPT_IOCTL_DELETE_CC HPT_CTL_CODE(203)
#define HPT_IOCTL_REENABLE_ARRAY HPT_CTL_CODE(204)
/************************************************************************
* shared data structures
************************************************************************/
@ -345,6 +373,10 @@ typedef HPT_U32 DEVICEID;
#define HPT_SPIN_UP_MODE_FULL 1
#define HPT_SPIN_UP_MODE_STANDBY 2
#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;
@ -385,7 +417,10 @@ DRIVER_CAPABILITIES, *PDRIVER_CAPABILITIES;
typedef struct _DRIVER_CAPABILITIES_V2 {
DRIVER_CAPABILITIES v1;
HPT_U8 SupportedCachePolicies[16];
HPT_U32 reserved[17];
HPT_U32 ConfigRegSize; /* max sectors */
HPT_U32 SupportDiskCachePolicy; /* disable/enable disk cache policy */
HPT_U32 Flags;
HPT_U32 reserved[14];
}
DRIVER_CAPABILITIES_V2, *PDRIVER_CAPABILITIES_V2;
@ -423,6 +458,14 @@ typedef struct _CONTROLLER_INFO_V2 {
HPT_U32 ExFlags;
} CONTROLLER_INFO_V2, *PCONTROLLER_INFO_V2;
typedef struct _CONTROLLER_INFO_V2_EXT {
HPT_U8 MaxWidth;
HPT_U8 CurrentWidth;
HPT_U8 MaxSpeed;
HPT_U8 CurrentSpeed;
HPT_U8 reserve[64];
} CONTROLLER_INFO_V2_EXT, *PCONTROLLER_INFO_V2_EXT;
#define CEXF_IOPModel 1
#define CEXF_SDRAMSize 2
@ -447,6 +490,9 @@ typedef struct _CONTROLLER_INFO_V2 {
#define CEXF_FanSpeed 0x100000
#define CEXF_Core1p0v 0x200000
#define CEXF_Fan2Speed 0x400000
#define CEXF_Power1p0v 0x800000
#define CEXF_Power1p5v 0x1000000
#define CEXF_SASAddress 0x2000000
typedef struct _CONTROLLER_INFO_V3 {
HPT_U8 ChipType;
@ -485,7 +531,10 @@ typedef struct _CONTROLLER_INFO_V3 {
HPT_U16 DDR1p8vRef;
HPT_U16 Core1p0v;
HPT_U16 Fan2Speed;
HPT_U8 reserve[60];
HPT_U16 Power1p0v;
HPT_U16 Power1p5v;
HPT_U8 SASAddress[8];
HPT_U8 reserve[48];
}
CONTROLLER_INFO_V3, *PCONTROLLER_INFO_V3;
typedef char check_CONTROLLER_INFO_V3[sizeof(CONTROLLER_INFO_V3)==256? 1:-1];
@ -566,8 +615,8 @@ typedef struct _SES_ELEMENT_STATUS {
#define SES_STATUS_UNRECOVERABLE 0x04
#define SES_STATUS_NOTINSTALLED 0x05
#define SES_STATUS_UNKNOWN 0x06
#define SES_STATUS_NOTAVAILABLE 0x06
#define SES_STATUS_RESERVED 0x07
#define SES_STATUS_NOTAVAILABLE 0x07
#define SES_STATUS_RESERVED 0x08
typedef struct _ENCLOSURE_INFO_V2 {
@ -596,6 +645,20 @@ typedef struct _ENCLOSURE_INFO_V3 {
SES_ELEMENT_STATUS ElementStatus[MAX_ELEMENT_COUNT];
} ENCLOSURE_INFO_V3, *PENCLOSURE_INFO_V3;
typedef struct _ENCLOSURE_INFO_V4 {
HPT_U8 EnclosureType;
HPT_U8 NumberOfPhys;
HPT_U8 AttachedTo;
HPT_U8 Status;
HPT_U8 VendorId[8];
HPT_U8 ProductId[16];
HPT_U8 ProductRevisionLevel[4];
HPT_U32 PortPhyMap;
HPT_U32 UnitId; /*272x card has two Cores, unitId is used to distinguish them */
HPT_U32 ElementCount;
HPT_U32 reserved[32];
} ENCLOSURE_INFO_V4, *PENCLOSURE_INFO_V4;
#define ENCLOSURE_STATUS_OFFLINE 1
#define ENCLOSURE_TYPE_INTERNAL 0
@ -759,7 +822,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;
@ -1022,6 +1085,7 @@ __attribute__((packed)) LOGICAL_DEVICE_INFO_V4, *PLOGICAL_DEVICE_INFO_V4;
#define ADIF_WRITE_CACHE 8
#define ADIF_READ_AHEAD 0x10
#define ADIF_SPIN_UP_MODE 0x20
#define ADIF_SET_BAD 0x40
typedef struct _ALTERABLE_ARRAY_INFO {
HPT_U32 ValidFields; /* mark valid fields below */
@ -1042,7 +1106,8 @@ typedef struct _ALTERABLE_DEVICE_INFO_V2 {
HPT_U8 WriteCacheEnabled;
HPT_U8 ReadAheadEnabled;
HPT_U8 SpinUpMode;
HPT_U8 reserve[2];
HPT_U8 SetBadSector;
HPT_U8 reserve[1];
HPT_U32 reserve2[13]; /* pad to 64 bytes */
}__attribute__((packed))ALTERABLE_DEVICE_INFO_V2, *PALTERABLE_DEVICE_INFO_V2;
@ -1064,6 +1129,10 @@ typedef struct _ALTERABLE_DEVICE_INFO_V2 {
#define DIT_NCQ 4
#define DIT_IDENTIFY 5
#define DISK_CACHE_POLICY_UNCHANGE 0
#define DISK_CACHE_POLICY_ENABLE 1
#define DISK_CACHE_POLICY_DISABLE 2
/* param type is determined by target_type and info_type*/
typedef struct _SET_DEV_INFO
{
@ -1121,7 +1190,8 @@ typedef struct _CREATE_ARRAY_PARAMS_V2 {
typedef struct _CREATE_ARRAY_PARAMS_V3 {
HPT_U32 dwSize;
HPT_U8 revision; /*CREATE_ARRAY_PARAMS_V3_REVISION*/
HPT_U8 reserved[5];
HPT_U8 diskCachePolicy; /*unchange:0 enable:1 disable:2*/
HPT_U8 reserved[4];
HPT_U8 subDisks; /* RAIDn0 sub array */
HPT_U8 SectorSizeShift; /*sector size = 512B<<SectorSizeShift*/
HPT_U8 ArrayType; /* 1-level array type */
@ -1359,6 +1429,29 @@ typedef struct _HPT_PM_IOSTAT {
}
HPT_PM_IOSTAT, *PHPT_PM_IOSTAT;
/*
* disk config region
*/
typedef struct _ACCESS_CONFIG_REG {
DEVICEID id;
HPT_U16 start;
HPT_U8 sectors;
HPT_U8 read;
HPT_U32 Reserved;
#define ACCESS_CONFIG_REG_buffer(p) ((HPT_U8 *)(p) + sizeof(ACCESS_CONFIG_REG_PARAMS))
} __attribute__((packed))ACCESS_CONFIG_REG_PARAMS, *PACCESS_CONFIG_REG_PARAMS;
/*
* dump meta data
*/
typedef struct _DUMP_METADATA {
DEVICEID id;
HPT_U8 sectors;
HPT_U8 backsectors;
HPT_U8 offset;
HPT_U8 backoffset;
} __attribute__((packed))DUMP_METADATA_PARAMS, *PDUMP_METADATA_PARAMS;
/*
@ -1461,6 +1554,16 @@ int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo);
*/
int hpt_get_controller_info_v2(int id, PCONTROLLER_INFO_V2 pInfo);
/* hpt_get_controller_info_v2_ext
* Version compatibility: v2.0.0.0 or later
* Parameters:
* id Controller id
* pInfo pointer to CONTROLLER_INFO_V2_EXT buffer
* Returns:
* 0 Success, controller info is put into (*pInfo ).
*/
int hpt_get_controller_info_v2_ext(int id, PCONTROLLER_INFO_V2_EXT pInfo);
/* hpt_get_controller_info_v3
* Version compatibility: v2.0.0.0 or later
* Parameters:
@ -2090,6 +2193,9 @@ int hpt_get_enclosure_info_v2(int ctlr_id, int enc_id, PENCLOSURE_INFO_V2 pInfo)
int hpt_get_enclosure_info_v3(int ctlr_id, int enc_id, PENCLOSURE_INFO_V3 pInfo);
int hpt_get_enclosure_info_v4(int ctlr_id, int enc_id, PENCLOSURE_INFO_V4 pInfo);
int hpt_get_enclosure_element_info(int ctlr_id, int enc_id, int ele_id, PSES_ELEMENT_STATUS pInfo);
/* performance monitor interface
* Version compatibility: v2.1.0.0 or later
*/
@ -2102,6 +2208,24 @@ int hpt_get_perfmon_data(DEVICEID id, PHPT_PM_IOSTAT iostat);
*/
int hpt_get_controller_venid(int ctlr_id, HPT_U32 *venid);
/* hpt_access_config_reg
* access the reserved config space on disk
* Parameters:
* p - ACCESS_CONFIG_REG_PARAMS header pointer
* Returns:
* 0 Success
*/
int hpt_access_config_reg(PACCESS_CONFIG_REG_PARAMS p);
/* hpt_dump_metadata
* dump internal metadata
* Parameters:
* p - PDUMP_METADATA_PARAMS header pointer
* Returns:
* 0 Success
*/
int hpt_dump_metadata(PDUMP_METADATA_PARAMS p);
#endif
#pragma pack()

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* Copyright (c) 2005-2011 HighPoint Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -244,6 +244,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;
@ -267,6 +268,11 @@ typedef struct hpt_raw_disk
HPT_UINT df_ncq_set: 1;
HPT_UINT enable_ncq : 1;
HPT_UINT bad_sector : 1;
HPT_UINT df_sas : 1;
HPT_UINT df_tape : 1;
HPT_UINT df_changer : 1;
HIM * him;
int index;
PLDM_ADAPTER adapter;
@ -494,8 +500,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);
@ -507,6 +513,7 @@ int ldm_reset_vbus(PVBUS vbus);
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*/

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* Copyright (c) 2005-2011 HighPoint Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* Copyright (c) 2005-2011 HighPoint Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -153,7 +153,9 @@ typedef struct _os_cmdext {
struct _os_cmdext *next;
union ccb *ccb;
bus_dmamap_t dma_map;
#if (__FreeBSD_version >= 1000510)
struct callout timeout;
#endif
SG psg[os_max_sg_descriptors];
}
OS_CMDEXT, *POS_CMDEXT;
@ -174,9 +176,11 @@ typedef struct _vbus_ext {
OSM_TASK *tasks;
struct task worker;
#if (__FreeBSD_version >= 1000510)
struct callout timer;
#else
struct callout_handle timer;
#endif
eventhandler_tag shutdown_eh;
/* the LDM vbus instance continues */
@ -195,9 +199,14 @@ VBUS_EXT, *PVBUS_EXT;
#define HPT_SCAN_BUS _IO('H', 1)
#if __FreeBSD_version < 1000510
#define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi_giant,(task));
#else
#define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi,(task));
#endif
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);
}

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2011 HighPoint Technologies, Inc.
* Copyright (c) 2005-2011 HighPoint Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -53,6 +53,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;
#define CPU_TO_LE64(x) (x)
#define CPU_TO_LE32(x) (x)
@ -223,7 +224,20 @@ int os_printk(char *fmt, ...);
#if DBG
extern int hpt_dbg_level;
#define KdPrint(x) do { if (hpt_dbg_level) os_printk x; } while (0)
#define dbg_printk(fmt, args...) \
do {\
char *__p = fmt;\
int __level;\
if (__p[0]=='<' && __p[2]=='>') {\
__level = __p[1] - '0';\
__p += 3;\
} else\
__level = 7;\
if (hpt_dbg_level >= __level)\
os_printk(__p, ##args);\
} while (0)
#define KdPrint(x) do { dbg_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)