1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Add support for the unmapped i/o to mfi(4).

Tested by:	Nicholas Esborn <nick@desert.net>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2014-05-29 16:20:34 +00:00
parent bf28fdf53f
commit c33ce50343
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266848
5 changed files with 25 additions and 15 deletions

View File

@ -2122,6 +2122,8 @@ mfi_build_cdb(int readop, uint8_t byte2, u_int64_t lba, u_int32_t block_count, u
return cdb_len;
}
extern char *unmapped_buf;
static struct mfi_command *
mfi_build_syspdio(struct mfi_softc *sc, struct bio *bio)
{
@ -2145,11 +2147,11 @@ mfi_build_syspdio(struct mfi_softc *sc, struct bio *bio)
pass->header.cmd = MFI_CMD_PD_SCSI_IO;
switch (bio->bio_cmd & 0x03) {
case BIO_READ:
flags = MFI_CMD_DATAIN;
flags = MFI_CMD_DATAIN | MFI_CMD_BIO;
readop = 1;
break;
case BIO_WRITE:
flags = MFI_CMD_DATAOUT;
flags = MFI_CMD_DATAOUT | MFI_CMD_BIO;
readop = 0;
break;
default:
@ -2174,7 +2176,7 @@ mfi_build_syspdio(struct mfi_softc *sc, struct bio *bio)
pass->sense_addr_hi = (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32);
cm->cm_complete = mfi_bio_complete;
cm->cm_private = bio;
cm->cm_data = bio->bio_data;
cm->cm_data = unmapped_buf;
cm->cm_len = bio->bio_bcount;
cm->cm_sg = &pass->sgl;
cm->cm_total_frame_size = MFI_PASS_FRAME_SIZE;
@ -2205,11 +2207,11 @@ mfi_build_ldio(struct mfi_softc *sc, struct bio *bio)
switch (bio->bio_cmd & 0x03) {
case BIO_READ:
io->header.cmd = MFI_CMD_LD_READ;
flags = MFI_CMD_DATAIN;
flags = MFI_CMD_DATAIN | MFI_CMD_BIO;
break;
case BIO_WRITE:
io->header.cmd = MFI_CMD_LD_WRITE;
flags = MFI_CMD_DATAOUT;
flags = MFI_CMD_DATAOUT | MFI_CMD_BIO;
break;
default:
/* TODO: what about BIO_DELETE??? */
@ -2230,7 +2232,7 @@ mfi_build_ldio(struct mfi_softc *sc, struct bio *bio)
io->lba_lo = bio->bio_pblkno & 0xffffffff;
cm->cm_complete = mfi_bio_complete;
cm->cm_private = bio;
cm->cm_data = bio->bio_data;
cm->cm_data = unmapped_buf;
cm->cm_len = bio->bio_bcount;
cm->cm_sg = &io->sgl;
cm->cm_total_frame_size = MFI_IO_FRAME_SIZE;
@ -2316,6 +2318,10 @@ mfi_mapcmd(struct mfi_softc *sc, struct mfi_command *cm)
error = bus_dmamap_load_ccb(sc->mfi_buffer_dmat,
cm->cm_dmamap, cm->cm_data, mfi_data_cb, cm,
polled);
else if (cm->cm_flags & MFI_CMD_BIO)
error = bus_dmamap_load_bio(sc->mfi_buffer_dmat,
cm->cm_dmamap, cm->cm_private, mfi_data_cb, cm,
polled);
else
error = bus_dmamap_load(sc->mfi_buffer_dmat,
cm->cm_dmamap, cm->cm_data, cm->cm_len,

View File

@ -218,7 +218,7 @@ mfip_cam_action(struct cam_sim *sim, union ccb *ccb)
cpi->version_num = 1;
cpi->hba_inquiry = PI_TAG_ABLE;
cpi->target_sprt = 0;
cpi->hba_misc = PIM_NOBUSRESET|PIM_SEQSCAN;
cpi->hba_misc = PIM_NOBUSRESET | PIM_SEQSCAN | PIM_UNMAPPED;
cpi->hba_eng_cnt = 0;
cpi->max_target = MFI_SCSI_MAX_TARGETS;
cpi->max_lun = MFI_SCSI_MAX_LUNS;

View File

@ -169,6 +169,7 @@ mfi_disk_attach(device_t dev)
sc->ld_disk->d_fwheads = 64;
sc->ld_disk->d_fwsectors = 32;
}
sc->ld_disk->d_flags = DISKFLAG_UNMAPPED_BIO;
disk_create(sc->ld_disk, DISK_VERSION);
return (0);

View File

@ -143,6 +143,7 @@ mfi_syspd_attach(device_t dev)
sc->pd_disk->d_fwheads = 64;
sc->pd_disk->d_fwsectors = 32;
}
sc->pd_disk->d_flags = DISKFLAG_UNMAPPED_BIO;
disk_create(sc->pd_disk, DISK_VERSION);
device_printf(dev, " SYSPD volume attached\n");

View File

@ -104,10 +104,11 @@ struct mfi_command {
#define MFI_CMD_POLLED (1<<4)
#define MFI_CMD_SCSI (1<<5)
#define MFI_CMD_CCB (1<<6)
#define MFI_CMD_TBOLT (1<<7)
#define MFI_ON_MFIQ_FREE (1<<8)
#define MFI_ON_MFIQ_READY (1<<9)
#define MFI_ON_MFIQ_BUSY (1<<10)
#define MFI_CMD_BIO (1<<7)
#define MFI_CMD_TBOLT (1<<8)
#define MFI_ON_MFIQ_FREE (1<<9)
#define MFI_ON_MFIQ_READY (1<<10)
#define MFI_ON_MFIQ_BUSY (1<<11)
#define MFI_ON_MFIQ_MASK (MFI_ON_MFIQ_FREE | MFI_ON_MFIQ_READY| \
MFI_ON_MFIQ_BUSY)
#define MFI_CMD_FLAGS_FMT "\20" \
@ -117,10 +118,11 @@ struct mfi_command {
"\4COMPLETED" \
"\5POLLED" \
"\6SCSI" \
"\7TBOLT" \
"\10Q_FREE" \
"\11Q_READY" \
"\12Q_BUSY"
"\7BIO" \
"\10TBOLT" \
"\11Q_FREE" \
"\12Q_READY" \
"\13Q_BUSY"
uint8_t retry_for_fw_reset;
void (* cm_complete)(struct mfi_command *cm);
void *cm_private;