Merge common XPT_CALC_GEOMETRY functions into a single convenience function.
Devices below may experience a change in geometry. * Due to a bug, aic(4) never used extended geometry. Changes all drives >1G to now use extended translation. * sbp(4) drives exactly 1 GB in size now no longer use extended geometry. * umass(4) drives exactly 1 GB in size now no longer use extended geometry. For all other controllers in this commit, this should be a no-op. PR: Submitted by: Looked over by: scottl Approved by: Obtained from: MFC after:
This commit is contained in:
parent
af2401690b
commit
c996d2bc71
@ -360,3 +360,28 @@ cam_error_print(struct cam_device *device, union ccb *ccb,
|
||||
}
|
||||
|
||||
#endif /* _KERNEL/!_KERNEL */
|
||||
|
||||
/*
|
||||
* Common calculate geometry fuction
|
||||
*
|
||||
* Caller should set ccg->volume_size and block_size.
|
||||
* The extended parameter should be zero if extended translation
|
||||
* should not be used.
|
||||
*/
|
||||
void
|
||||
cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended)
|
||||
{
|
||||
uint32_t size_mb, secs_per_cylinder;
|
||||
|
||||
size_mb = ccg->volume_size / ((1024L * 1024L) / ccg->block_size);
|
||||
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;
|
||||
ccg->ccb_h.status = CAM_REQ_CMP;
|
||||
}
|
||||
|
@ -979,6 +979,8 @@ cam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries,
|
||||
csio->init_id = init_id;
|
||||
}
|
||||
|
||||
void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _CAM_CAM_CCB_H */
|
||||
|
Loading…
Reference in New Issue
Block a user