From owner-p4-projects@FreeBSD.ORG Thu Jun 25 11:53:08 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 88DFD10657B2; Thu, 25 Jun 2009 11:53:08 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EF8910657B0 for ; Thu, 25 Jun 2009 11:53:08 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 11B508FC14 for ; Thu, 25 Jun 2009 11:53:08 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PBr7nc079491 for ; Thu, 25 Jun 2009 11:53:07 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5PBr7uL079489 for perforce@freebsd.org; Thu, 25 Jun 2009 11:53:07 GMT (envelope-from mav@freebsd.org) Date: Thu, 25 Jun 2009 11:53:07 GMT Message-Id: <200906251153.n5PBr7uL079489@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Cc: Subject: PERFORCE change 165151 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 11:53:10 -0000 http://perforce.freebsd.org/chv.cgi?CH=165151 Change 165151 by mav@mav_mavbook on 2009/06/25 11:52:53 Implement kernel dumping to ada. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#13 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#13 (text+ko) ==== @@ -136,7 +136,7 @@ //}; static disk_strategy_t adastrategy; -//static dumper_t adadump; +static dumper_t adadump; static periph_init_t adainit; static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); @@ -333,15 +333,17 @@ return; } -#if 0 + static int adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length) { struct cam_periph *periph; struct ada_softc *softc; u_int secsize; - struct ccb_scsiio csio; + struct ccb_ataio ataio; struct disk *dp; + uint64_t lba; + uint16_t count; dp = arg; periph = dp->d_drv1; @@ -350,6 +352,8 @@ softc = (struct ada_softc *)periph->softc; cam_periph_lock(periph); secsize = softc->params.secsize; + lba = offset / secsize; + count = length / secsize; if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { cam_periph_unlock(periph); @@ -358,43 +362,39 @@ if (length > 0) { periph->flags |= CAM_PERIPH_POLLED; - xpt_setup_ccb(&csio.ccb_h, periph->path, /*priority*/1); - csio.ccb_h.ccb_state = ADA_CCB_DUMP; - scsi_read_write(&csio, - /*retries*/1, - adadone, - 0,//MSG_ORDERED_Q_TAG, - /*read*/FALSE, - /*byte2*/0, - /*minimum_cmd_size*/ softc->minimum_cmd_size, - offset / secsize, - length / secsize, - /*data_ptr*/(u_int8_t *) virtual, - /*dxfer_len*/length, - /*sense_len*/SSD_FULL_SIZE, - ADA_DEFAULT_TIMEOUT * 1000); - xpt_polled_action((union ccb *)&csio); + xpt_setup_ccb(&ataio.ccb_h, periph->path, /*priority*/1); + ataio.ccb_h.ccb_state = ADA_CCB_DUMP; + cam_fill_ataio(&ataio, + 0, + adadone, + CAM_DIR_OUT, + 0, + (u_int8_t *) virtual, + length, + ada_default_timeout*1000); + if ((softc->flags & ADA_FLAG_CAN_48BIT) && + (lba + count >= ATA_MAX_28BIT_LBA || + count >= 256)) { + ata_48bit_cmd(&ataio, ATA_WRITE_DMA48, + 0, lba, count); + } else { + ata_36bit_cmd(&ataio, ATA_WRITE_DMA, + 0, lba, count); + } + xpt_polled_action((union ccb *)&ataio); - if ((csio.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if ((ataio.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { printf("Aborting dump due to I/O error.\n"); - if ((csio.ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - scsi_sense_print(&csio); - else - printf("status == 0x%x, scsi status == 0x%x\n", - csio.ccb_h.status, csio.scsi_status); - periph->flags |= CAM_PERIPH_POLLED; + cam_periph_unlock(periph); return(EIO); } cam_periph_unlock(periph); return(0); } - periph->flags &= ~CAM_PERIPH_POLLED; cam_periph_unlock(periph); return (0); } -#endif static void adainit(void) @@ -639,7 +639,7 @@ softc->disk->d_open = adaopen; softc->disk->d_close = adaclose; softc->disk->d_strategy = adastrategy; -// softc->disk->d_dump = adadump; + softc->disk->d_dump = adadump; softc->disk->d_name = "ada"; softc->disk->d_drv1 = periph; if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)