From owner-freebsd-scsi@FreeBSD.ORG Thu Aug 4 23:30:17 2005 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 05EDE16A41F for ; Thu, 4 Aug 2005 23:30:17 +0000 (GMT) (envelope-from ken@nargothrond.kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BF1B43D45 for ; Thu, 4 Aug 2005 23:30:14 +0000 (GMT) (envelope-from ken@nargothrond.kdm.org) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.12.11/8.12.11) with ESMTP id j74NUCq3059705; Thu, 4 Aug 2005 17:30:12 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.12.11/8.12.5/Submit) id j74NUCng059704; Thu, 4 Aug 2005 17:30:12 -0600 (MDT) (envelope-from ken) Date: Thu, 4 Aug 2005 17:30:12 -0600 From: "Kenneth D. Merry" To: "Heck, Steve" Message-ID: <20050804233012.GA59646@nargothrond.kdm.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i X-Virus-Scanned: ClamAV 0.86.1/1003/Thu Aug 4 08:43:24 2005 on nargothrond.kdm.org X-Virus-Status: Clean Cc: freebsd-scsi@freebsd.org Subject: Re: [cam_periph_mapmen:?] X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2005 23:30:17 -0000 On Thu, Aug 04, 2005 at 18:18:39 -0400, Heck, Steve wrote: > I am having problems Writing to a SCSI tape drive. > > First the Block Size is being set to 65536 Bytes by Mode Select which succeeds. > > printf ("Data compression enabled.\n"); > > buf_data1c[0] = 0x00; > buf_data1c[1] = 0x00; > buf_data1c[2] = 0x10; > buf_data1c[3] = 0x08; > buf_data1c[4] = 0x7f; > buf_data1c[5] = 0x00; > buf_data1c[6] = 0x00; > buf_data1c[7] = 0x00; > buf_data1c[8] = 0x00; > buf_data1c[9] = 0x01; > buf_data1c[10] = 0x00; > buf_data1c[11] = 0x00; > buf_data1c[12] = 0x0f; > buf_data1c[13] = 0x0e; > buf_data1c[14] = 0xc0; > buf_data1c[15] = 0x80; > buf_data1c[16] = 0x00; > buf_data1c[17] = 0x00; > buf_data1c[18] = 0x00; > buf_data1c[19] = 0x00; > buf_data1c[20] = 0x00; > buf_data1c[21] = 0x00; > buf_data1c[22] = 0x00; > buf_data1c[23] = 0x00; > buf_data1c[24] = 0x00; > buf_data1c[25] = 0x00; > buf_data1c[26] = 0x00; > buf_data1c[27] = 0x00; > > //unsigned char header[len]; > memset( header, 0, len ); > memset(&ccb,0,sizeof(ccb)); > ccb.ccb_h.path_id = cam->path_id; > ccb.ccb_h.target_id = cam->target_id; > ccb.ccb_h.target_lun = cam->target_lun; > cam_fill_csio (&(ccb.csio), 1, NULL, CAM_DIR_OUT, MSG_SIMPLE_Q_TAG, buf_data1c, sizeof(buf_data1c), sizeof(ccb.csio.sense_data), 0, 30*1000); > ccb.csio.cdb_len = 6; > ccb.csio.cdb_io.cdb_bytes[0] = 0x15; // Mode Select > ccb.csio.cdb_io.cdb_bytes[1] = 0x10; > ccb.csio.cdb_io.cdb_bytes[4] = 0x1c; > ccb.csio.cdb_io.cdb_bytes[5] = 0x00; > > //int ret; > if ((ret = cam_send_ccb(cam, &ccb)) < 0) > { > printf("cam_send_ccb: failed\n"); > cam_close_device(cam); > return -1; > } > > > The problem occurs when I try to Write one Fixed Block. > > > unsigned char wbuf_data[65536] > > memset( header, 0, len ); > memset(&ccb,0,sizeof(ccb)); > ccb.ccb_h.path_id = cam->path_id; > ccb.ccb_h.target_id = cam->target_id; > ccb.ccb_h.target_lun = cam->target_lun; > cam_fill_csio (&(ccb.csio), 1, NULL, CAM_DIR_OUT, MSG_SIMPLE_Q_TAG, wbuf_data, sizeof(wbuf_data), sizeof(ccb.csio.sense_data), 0, 900*1000); > ccb.csio.cdb_len = 6; > ccb.csio.cdb_io.cdb_bytes[0] = 0x0a; // Write > ccb.csio.cdb_io.cdb_bytes[1] = 0x01; > ccb.csio.cdb_io.cdb_bytes[4] = 0x01; > ccb.csio.cdb_io.cdb_bytes[5] = 0x00; > > if ((ret = cam_send_ccb(cam, &ccb)) < 0) > { > printf("cam_send_ccb: failed\n"); > cam_close_device(cam); > return -1; > } > > I get this error: > > cam_periph_mapmem: attempt to map 68480 bytes, which is greater that DFLTPHYS(65536) > > cam_send_ccb: failed > > I do not see the Write cdb being sent when I make a SCSI trace. > > Any help would be appreciated. Here's the comment/code in question: /* * The userland data pointer passed in may not be page * aligned. vmapbuf() truncates the address to a page * boundary, so if the address isn't page aligned, we'll * need enough space for the given transfer length, plus * whatever extra space is necessary to make it to the page * boundary. */ if ((lengths[i] + (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK)) > DFLTPHYS){ printf("cam_periph_mapmem: attempt to map %lu bytes, " "which is greater than DFLTPHYS(%d)\n", (long)(lengths[i] + (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK)), DFLTPHYS); return(E2BIG); } If you make sure your data buffer is page aligned, you should be able to send a 64K request down through the passthrough driver. Ken -- Kenneth Merry ken@FreeBSD.org