Convert to use cam_calc_geometry().
authorPeter Avalos <pavalos@dragonflybsd.org>
Tue, 3 Jul 2007 20:55:42 +0000 (20:55 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Tue, 3 Jul 2007 20:55:42 +0000 (20:55 +0000)
Obtained-from:  FreeBSD

sys/dev/disk/aic7xxx/aic79xx_osm.c
sys/dev/disk/aic7xxx/aic7xxx_osm.c

index 69a0431..9d20c67 100644 (file)
@@ -31,8 +31,8 @@
  *
  * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic79xx_osm.c#27 $
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.3.2.4 2003/06/10 03:26:07 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.13 2007/06/04 17:21:55 dillon Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.14 2003/06/14 22:17:39 njl Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx_osm.c,v 1.14 2007/07/03 20:55:42 pavalos Exp $
  */
 
 #include "aic79xx_osm.h"
@@ -539,26 +539,10 @@ ahd_action(struct cam_sim *sim, union ccb *ccb)
        }
        case XPT_CALC_GEOMETRY:
        {
-               struct    ccb_calc_geometry *ccg;
-               uint32_t size_mb;
-               uint32_t secs_per_cylinder;
                int       extended;
 
-               ccg = &ccb->ccg;
-               size_mb = ccg->volume_size
-                       / ((1024L * 1024L) / ccg->block_size);
                extended = ahd->flags & AHD_EXTENDED_TRANS_A;
-               
-               if (size_mb > 1024 && extended) {
-                       ccg->heads = 255;
-                       ccg->secs_per_track = 63;
-               } else {
-                       ccg->heads = 64;
-                       ccg->secs_per_track = 32;
-               }
-               secs_per_cylinder = ccg->heads * ccg->secs_per_track;
-               ccg->cylinders = ccg->volume_size / secs_per_cylinder;
-               ccb->ccb_h.status = CAM_REQ_CMP;
+               cam_calc_geometry(&ccb->ccg, extended);
                xpt_done(ccb);
                break;
        }
index 1fa47e1..822c853 100644 (file)
@@ -30,8 +30,8 @@
  *
  * $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic7xxx_osm.c#13 $
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.27.2.6 2003/06/10 03:26:09 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_osm.c,v 1.13 2007/06/04 17:21:55 dillon Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx_osm.c,v 1.37 2003/06/14 22:17:39 njl Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx_osm.c,v 1.14 2007/07/03 20:55:42 pavalos Exp $
  */
 
 #include "aic7xxx_osm.h"
@@ -807,28 +807,12 @@ ahc_action(struct cam_sim *sim, union ccb *ccb)
        }
        case XPT_CALC_GEOMETRY:
        {
-               struct    ccb_calc_geometry *ccg;
-               uint32_t size_mb;
-               uint32_t secs_per_cylinder;
                int       extended;
 
-               ccg = &ccb->ccg;
-               size_mb = ccg->volume_size
-                       / ((1024L * 1024L) / ccg->block_size);
                extended = SIM_IS_SCSIBUS_B(ahc, sim)
                        ? ahc->flags & AHC_EXTENDED_TRANS_B
                        : ahc->flags & AHC_EXTENDED_TRANS_A;
-               
-               if (size_mb > 1024 && extended) {
-                       ccg->heads = 255;
-                       ccg->secs_per_track = 63;
-               } else {
-                       ccg->heads = 64;
-                       ccg->secs_per_track = 32;
-               }
-               secs_per_cylinder = ccg->heads * ccg->secs_per_track;
-               ccg->cylinders = ccg->volume_size / secs_per_cylinder;
-               ccb->ccb_h.status = CAM_REQ_CMP;
+               cam_calc_geometry(&ccb->ccg, extended);
                xpt_done(ccb);
                break;
        }