kernel/cam: Make si_iosize_max overridable by drivers.
authorSascha Wildner <saw@online.de>
Thu, 2 Aug 2012 22:14:28 +0000 (00:14 +0200)
committerSascha Wildner <saw@online.de>
Fri, 3 Aug 2012 01:33:13 +0000 (03:33 +0200)
sys/bus/cam/cam_ccb.h
sys/bus/cam/scsi/scsi_da.c

index c19d5ca..2b172b5 100644 (file)
@@ -26,7 +26,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_ccb.h,v 1.15.2.3 2003/07/29 04:00:34 njl Exp $
- * $DragonFly: src/sys/bus/cam/cam_ccb.h,v 1.17 2008/02/10 00:01:01 pavalos Exp $
  */
 
 #ifndef _CAM_CAM_CCB_H
@@ -561,6 +560,7 @@ struct ccb_pathinq {
                struct ccb_pathinq_settings_sas sas;
                char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE];
        } xport_specific;
+       u_int           maxio;          /* Max supported I/O size, in bytes. */
 };
 
 /* Path Statistics CCB */
index 0c83d3c..60658a3 100644 (file)
@@ -1196,6 +1196,7 @@ daregister(struct cam_periph *periph, void *arg)
        TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph);
 
        /* Check if the SIM does not want 6 byte commands */
+       bzero(&cpi, sizeof(cpi));
        xpt_setup_ccb(&cpi.ccb_h, periph->path, /*priority*/1);
        cpi.ccb_h.func_code = XPT_PATH_INQ;
        xpt_action((union ccb *)&cpi);
@@ -1250,7 +1251,10 @@ daregister(struct cam_periph *periph, void *arg)
         */
        CAM_SIM_UNLOCK(periph->sim);
        disk_create(periph->unit_number, &softc->disk, &da_ops);
-       softc->disk.d_rawdev->si_iosize_max = MAXPHYS;
+       if (cpi.maxio == 0 || cpi.maxio > MAXPHYS)
+               softc->disk.d_rawdev->si_iosize_max = MAXPHYS;
+       else
+               softc->disk.d_rawdev->si_iosize_max = cpi.maxio;
        CAM_SIM_LOCK(periph->sim);
 
        /*