PERFORCE change 165141 for review
Alexander Motin
mav at FreeBSD.org
Thu Jun 25 09:43:33 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=165141
Change 165141 by mav at mav_mavbook on 2009/06/25 09:42:58
Rename all ATA disk driver internals from da... to ada... to avoid
confuses.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#10 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_da.c#10 (text+ko) ====
@@ -63,38 +63,38 @@
#define ATA_MAX_28BIT_LBA 268435455UL
typedef enum {
- DA_STATE_NORMAL
-} da_state;
+ ADA_STATE_NORMAL
+} ada_state;
typedef enum {
- DA_FLAG_PACK_INVALID = 0x001,
- DA_FLAG_CAN_48BIT = 0x002,
- DA_FLAG_CAN_FLUSHCACHE = 0x004,
- DA_FLAG_CAN_NCQ = 0x008,
- DA_FLAG_TAGGED_QUEUING = 0x010,
- DA_FLAG_NEED_OTAG = 0x020,
- DA_FLAG_WENT_IDLE = 0x040,
- DA_FLAG_RETRY_UA = 0x080,
- DA_FLAG_OPEN = 0x100,
- DA_FLAG_SCTX_INIT = 0x200
-} da_flags;
+ ADA_FLAG_PACK_INVALID = 0x001,
+ ADA_FLAG_CAN_48BIT = 0x002,
+ ADA_FLAG_CAN_FLUSHCACHE = 0x004,
+ ADA_FLAG_CAN_NCQ = 0x008,
+ ADA_FLAG_TAGGED_QUEUING = 0x010,
+ ADA_FLAG_NEED_OTAG = 0x020,
+ ADA_FLAG_WENT_IDLE = 0x040,
+ ADA_FLAG_RETRY_UA = 0x080,
+ ADA_FLAG_OPEN = 0x100,
+ ADA_FLAG_SCTX_INIT = 0x200
+} ada_flags;
typedef enum {
- DA_Q_NONE = 0x00,
- DA_Q_NO_SYNC_CACHE = 0x01,
- DA_Q_NO_6_BYTE = 0x02,
- DA_Q_NO_PREVENT = 0x04
-} da_quirks;
+ ADA_Q_NONE = 0x00,
+ ADA_Q_NO_SYNC_CACHE = 0x01,
+ ADA_Q_NO_6_BYTE = 0x02,
+ ADA_Q_NO_PREVENT = 0x04
+} ada_quirks;
typedef enum {
- DA_CCB_PROBE = 0x01,
- DA_CCB_PROBE2 = 0x02,
- DA_CCB_BUFFER_IO = 0x03,
- DA_CCB_WAITING = 0x04,
- DA_CCB_DUMP = 0x05,
- DA_CCB_TYPE_MASK = 0x0F,
- DA_CCB_RETRY_UA = 0x10
-} da_ccb_state;
+ ADA_CCB_PROBE = 0x01,
+ ADA_CCB_PROBE2 = 0x02,
+ ADA_CCB_BUFFER_IO = 0x03,
+ ADA_CCB_WAITING = 0x04,
+ ADA_CCB_DUMP = 0x05,
+ ADA_CCB_TYPE_MASK = 0x0F,
+ ADA_CCB_RETRY_UA = 0x10
+} ada_ccb_state;
/* Offsets into our private area for storing information */
#define ccb_state ppriv_field0
@@ -108,13 +108,13 @@
u_int64_t sectors; /* total number sectors */
};
-struct da_softc {
+struct ada_softc {
struct bio_queue_head bio_queue;
- SLIST_ENTRY(da_softc) links;
+ SLIST_ENTRY(ada_softc) links;
LIST_HEAD(, ccb_hdr) pending_ccbs;
- da_state state;
- da_flags flags;
- da_quirks quirks;
+ ada_state state;
+ ada_flags flags;
+ ada_quirks quirks;
int ordered_tag_count;
int outstanding_cmds;
struct disk_params params;
@@ -126,65 +126,65 @@
struct callout sendordered_c;
};
-struct da_quirk_entry {
+struct ada_quirk_entry {
struct scsi_inquiry_pattern inq_pat;
- da_quirks quirks;
+ ada_quirks quirks;
};
-//static struct da_quirk_entry da_quirk_table[] =
+//static struct ada_quirk_entry ada_quirk_table[] =
//{
//};
-static disk_strategy_t dastrategy;
-//static dumper_t dadump;
-static periph_init_t dainit;
-static void daasync(void *callback_arg, u_int32_t code,
+static disk_strategy_t adastrategy;
+//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);
-static void dasysctlinit(void *context, int pending);
-static periph_ctor_t daregister;
-static periph_dtor_t dacleanup;
-static periph_start_t dastart;
-static periph_oninv_t daoninvalidate;
-static void dadone(struct cam_periph *periph,
+static void adasysctlinit(void *context, int pending);
+static periph_ctor_t adaregister;
+static periph_dtor_t adacleanup;
+static periph_start_t adastart;
+static periph_oninv_t adaoninvalidate;
+static void adadone(struct cam_periph *periph,
union ccb *done_ccb);
-static int daerror(union ccb *ccb, u_int32_t cam_flags,
+static int adaerror(union ccb *ccb, u_int32_t cam_flags,
u_int32_t sense_flags);
-static void dasetgeom(struct cam_periph *periph,
+static void adasetgeom(struct cam_periph *periph,
struct ccb_getdev *cgd);
-static timeout_t dasendorderedtag;
-static void dashutdown(void *arg, int howto);
+static timeout_t adasendorderedtag;
+static void adashutdown(void *arg, int howto);
-#ifndef DA_DEFAULT_TIMEOUT
-#define DA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */
+#ifndef ADA_DEFAULT_TIMEOUT
+#define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */
#endif
-#ifndef DA_DEFAULT_RETRY
-#define DA_DEFAULT_RETRY 4
+#ifndef ADA_DEFAULT_RETRY
+#define ADA_DEFAULT_RETRY 4
#endif
-#ifndef DA_DEFAULT_SEND_ORDERED
-#define DA_DEFAULT_SEND_ORDERED 1
+#ifndef ADA_DEFAULT_SEND_ORDERED
+#define ADA_DEFAULT_SEND_ORDERED 1
#endif
-static int da_retry_count = DA_DEFAULT_RETRY;
-static int da_default_timeout = DA_DEFAULT_TIMEOUT;
-static int da_send_ordered = DA_DEFAULT_SEND_ORDERED;
+static int ada_retry_count = ADA_DEFAULT_RETRY;
+static int ada_default_timeout = ADA_DEFAULT_TIMEOUT;
+static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED;
SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0,
"CAM Direct Access Disk driver");
SYSCTL_INT(_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RW,
- &da_retry_count, 0, "Normal I/O retry count");
-TUNABLE_INT("kern.cam.ada.retry_count", &da_retry_count);
+ &ada_retry_count, 0, "Normal I/O retry count");
+TUNABLE_INT("kern.cam.ada.retry_count", &ada_retry_count);
SYSCTL_INT(_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RW,
- &da_default_timeout, 0, "Normal I/O timeout (in seconds)");
-TUNABLE_INT("kern.cam.ada.default_timeout", &da_default_timeout);
-SYSCTL_INT(_kern_cam_ada, OID_AUTO, da_send_ordered, CTLFLAG_RW,
- &da_send_ordered, 0, "Send Ordered Tags");
-TUNABLE_INT("kern.cam.ada.da_send_ordered", &da_send_ordered);
+ &ada_default_timeout, 0, "Normal I/O timeout (in seconds)");
+TUNABLE_INT("kern.cam.ada.default_timeout", &ada_default_timeout);
+SYSCTL_INT(_kern_cam_ada, OID_AUTO, ada_send_ordered, CTLFLAG_RW,
+ &ada_send_ordered, 0, "Send Ordered Tags");
+TUNABLE_INT("kern.cam.ada.ada_send_ordered", &ada_send_ordered);
/*
- * DA_ORDEREDTAG_INTERVAL determines how often, relative
+ * ADA_ORDEREDTAG_INTERVAL determines how often, relative
* to the default timeout, we check to see whether an ordered
* tagged transaction is appropriate to prevent simple tag
* starvation. Since we'd like to ensure that there is at least
@@ -195,13 +195,13 @@
* meets the requirement "don't send an ordered tag" test so it takes
* us two intervals to determine that a tag must be sent.
*/
-#ifndef DA_ORDEREDTAG_INTERVAL
-#define DA_ORDEREDTAG_INTERVAL 4
+#ifndef ADA_ORDEREDTAG_INTERVAL
+#define ADA_ORDEREDTAG_INTERVAL 4
#endif
static struct periph_driver adadriver =
{
- dainit, "ada",
+ adainit, "ada",
TAILQ_HEAD_INITIALIZER(adadriver.units), /* generation */ 0
};
@@ -210,10 +210,10 @@
MALLOC_DEFINE(M_ATADA, "ata_da", "ata_da buffers");
static int
-daopen(struct disk *dp)
+adaopen(struct disk *dp)
{
struct cam_periph *periph;
- struct da_softc *softc;
+ struct ada_softc *softc;
int unit;
int error;
@@ -234,16 +234,16 @@
}
unit = periph->unit_number;
- softc = (struct da_softc *)periph->softc;
- softc->flags |= DA_FLAG_OPEN;
+ softc = (struct ada_softc *)periph->softc;
+ softc->flags |= ADA_FLAG_OPEN;
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE,
- ("daopen: disk=%s%d (unit %d)\n", dp->d_name, dp->d_unit,
+ ("adaopen: disk=%s%d (unit %d)\n", dp->d_name, dp->d_unit,
unit));
- if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) {
+ if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) {
/* Invalidate our pack information. */
- softc->flags &= ~DA_FLAG_PACK_INVALID;
+ softc->flags &= ~ADA_FLAG_PACK_INVALID;
}
cam_periph_unhold(periph);
@@ -252,10 +252,10 @@
}
static int
-daclose(struct disk *dp)
+adaclose(struct disk *dp)
{
struct cam_periph *periph;
- struct da_softc *softc;
+ struct ada_softc *softc;
int error;
periph = (struct cam_periph *)dp->d_drv1;
@@ -269,9 +269,9 @@
return (error);
}
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
- softc->flags &= ~DA_FLAG_OPEN;
+ softc->flags &= ~ADA_FLAG_OPEN;
cam_periph_unhold(periph);
cam_periph_unlock(periph);
cam_periph_release(periph);
@@ -284,17 +284,17 @@
* only one physical transfer.
*/
static void
-dastrategy(struct bio *bp)
+adastrategy(struct bio *bp)
{
struct cam_periph *periph;
- struct da_softc *softc;
+ struct ada_softc *softc;
periph = (struct cam_periph *)bp->bio_disk->d_drv1;
if (periph == NULL) {
biofinish(bp, NULL, ENXIO);
return;
}
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
cam_periph_lock(periph);
@@ -314,7 +314,7 @@
/*
* If the device has been made invalid, error out
*/
- if ((softc->flags & DA_FLAG_PACK_INVALID)) {
+ if ((softc->flags & ADA_FLAG_PACK_INVALID)) {
cam_periph_unlock(periph);
biofinish(bp, NULL, ENXIO);
return;
@@ -335,10 +335,10 @@
}
#if 0
static int
-dadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length)
+adadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length)
{
struct cam_periph *periph;
- struct da_softc *softc;
+ struct ada_softc *softc;
u_int secsize;
struct ccb_scsiio csio;
struct disk *dp;
@@ -347,11 +347,11 @@
periph = dp->d_drv1;
if (periph == NULL)
return (ENXIO);
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
cam_periph_lock(periph);
secsize = softc->params.secsize;
- if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) {
+ if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) {
cam_periph_unlock(periph);
return (ENXIO);
}
@@ -359,10 +359,10 @@
if (length > 0) {
periph->flags |= CAM_PERIPH_POLLED;
xpt_setup_ccb(&csio.ccb_h, periph->path, /*priority*/1);
- csio.ccb_h.ccb_state = DA_CCB_DUMP;
+ csio.ccb_h.ccb_state = ADA_CCB_DUMP;
scsi_read_write(&csio,
/*retries*/1,
- dadone,
+ adadone,
0,//MSG_ORDERED_Q_TAG,
/*read*/FALSE,
/*byte2*/0,
@@ -372,7 +372,7 @@
/*data_ptr*/(u_int8_t *) virtual,
/*dxfer_len*/length,
/*sense_len*/SSD_FULL_SIZE,
- DA_DEFAULT_TIMEOUT * 1000);
+ ADA_DEFAULT_TIMEOUT * 1000);
xpt_polled_action((union ccb *)&csio);
if ((csio.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
@@ -397,7 +397,7 @@
#endif
static void
-dainit(void)
+adainit(void)
{
cam_status status;
@@ -405,33 +405,33 @@
* Install a global async callback. This callback will
* receive async callbacks like "new device found".
*/
- status = xpt_register_async(AC_FOUND_DEVICE, daasync, NULL, NULL);
+ status = xpt_register_async(AC_FOUND_DEVICE, adaasync, NULL, NULL);
if (status != CAM_REQ_CMP) {
- printf("da: Failed to attach master async callback "
+ printf("ada: Failed to attach master async callback "
"due to status 0x%x!\n", status);
- } else if (da_send_ordered) {
+ } else if (ada_send_ordered) {
/* Register our shutdown event handler */
- if ((EVENTHANDLER_REGISTER(shutdown_post_sync, dashutdown,
+ if ((EVENTHANDLER_REGISTER(shutdown_post_sync, adashutdown,
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
- printf("dainit: shutdown event registration failed!\n");
+ printf("adainit: shutdown event registration failed!\n");
}
}
static void
-daoninvalidate(struct cam_periph *periph)
+adaoninvalidate(struct cam_periph *periph)
{
- struct da_softc *softc;
+ struct ada_softc *softc;
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
/*
* De-register any async callbacks.
*/
- xpt_register_async(0, daasync, periph, periph->path);
+ xpt_register_async(0, adaasync, periph, periph->path);
- softc->flags |= DA_FLAG_PACK_INVALID;
+ softc->flags |= ADA_FLAG_PACK_INVALID;
/*
* Return all queued I/O with ENXIO.
@@ -445,11 +445,11 @@
}
static void
-dacleanup(struct cam_periph *periph)
+adacleanup(struct cam_periph *periph)
{
- struct da_softc *softc;
+ struct ada_softc *softc;
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
xpt_print(periph->path, "removing device entry\n");
cam_periph_unlock(periph);
@@ -457,7 +457,7 @@
/*
* If we can't free the sysctl tree, oh well...
*/
- if ((softc->flags & DA_FLAG_SCTX_INIT) != 0
+ if ((softc->flags & ADA_FLAG_SCTX_INIT) != 0
&& sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
xpt_print(periph->path, "can't remove sysctl context\n");
}
@@ -469,7 +469,7 @@
}
static void
-daasync(void *callback_arg, u_int32_t code,
+adaasync(void *callback_arg, u_int32_t code,
struct cam_path *path, void *arg)
{
struct cam_periph *periph;
@@ -498,32 +498,32 @@
* this device and start the probe
* process.
*/
- status = cam_periph_alloc(daregister, daoninvalidate,
- dacleanup, dastart,
+ status = cam_periph_alloc(adaregister, adaoninvalidate,
+ adacleanup, adastart,
"ada", CAM_PERIPH_BIO,
- cgd->ccb_h.path, daasync,
+ cgd->ccb_h.path, adaasync,
AC_FOUND_DEVICE, cgd);
if (status != CAM_REQ_CMP
&& status != CAM_REQ_INPROG)
- printf("daasync: Unable to attach to new device "
+ printf("adaasync: Unable to attach to new device "
"due to status 0x%x\n", status);
break;
}
case AC_SENT_BDR:
case AC_BUS_RESET:
{
- struct da_softc *softc;
+ struct ada_softc *softc;
struct ccb_hdr *ccbh;
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
/*
* Don't fail on the expected unit attention
* that will occur.
*/
- softc->flags |= DA_FLAG_RETRY_UA;
+ softc->flags |= ADA_FLAG_RETRY_UA;
LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
- ccbh->ccb_state |= DA_CCB_RETRY_UA;
+ ccbh->ccb_state |= ADA_CCB_RETRY_UA;
/* FALLTHROUGH*/
}
default:
@@ -533,27 +533,27 @@
}
static void
-dasysctlinit(void *context, int pending)
+adasysctlinit(void *context, int pending)
{
struct cam_periph *periph;
- struct da_softc *softc;
+ struct ada_softc *softc;
char tmpstr[80], tmpstr2[80];
periph = (struct cam_periph *)context;
if (cam_periph_acquire(periph) != CAM_REQ_CMP)
return;
- softc = (struct da_softc *)periph->softc;
- snprintf(tmpstr, sizeof(tmpstr), "CAM DA unit %d", periph->unit_number);
+ softc = (struct ada_softc *)periph->softc;
+ snprintf(tmpstr, sizeof(tmpstr), "CAM ADA unit %d", periph->unit_number);
snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number);
sysctl_ctx_init(&softc->sysctl_ctx);
- softc->flags |= DA_FLAG_SCTX_INIT;
+ softc->flags |= ADA_FLAG_SCTX_INIT;
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
SYSCTL_STATIC_CHILDREN(_kern_cam_ada), OID_AUTO, tmpstr2,
CTLFLAG_RD, 0, tmpstr);
if (softc->sysctl_tree == NULL) {
- printf("dasysctlinit: unable to allocate sysctl tree\n");
+ printf("adasysctlinit: unable to allocate sysctl tree\n");
cam_periph_release(periph);
return;
}
@@ -562,9 +562,9 @@
}
static cam_status
-daregister(struct cam_periph *periph, void *arg)
+adaregister(struct cam_periph *periph, void *arg)
{
- struct da_softc *softc;
+ struct ada_softc *softc;
struct ccb_pathinq cpi;
struct ccb_getdev *cgd;
char announce_buf[80];
@@ -573,37 +573,37 @@
cgd = (struct ccb_getdev *)arg;
if (periph == NULL) {
- printf("daregister: periph was NULL!!\n");
+ printf("adaregister: periph was NULL!!\n");
return(CAM_REQ_CMP_ERR);
}
if (cgd == NULL) {
- printf("daregister: no getdev CCB, can't register device\n");
+ printf("adaregister: no getdev CCB, can't register device\n");
return(CAM_REQ_CMP_ERR);
}
- softc = (struct da_softc *)malloc(sizeof(*softc), M_DEVBUF,
+ softc = (struct ada_softc *)malloc(sizeof(*softc), M_DEVBUF,
M_NOWAIT|M_ZERO);
if (softc == NULL) {
- printf("daregister: Unable to probe new device. "
+ printf("adaregister: Unable to probe new device. "
"Unable to allocate softc\n");
return(CAM_REQ_CMP_ERR);
}
LIST_INIT(&softc->pending_ccbs);
- softc->state = DA_STATE_NORMAL;
+ softc->state = ADA_STATE_NORMAL;
bioq_init(&softc->bio_queue);
if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
- softc->flags |= DA_FLAG_CAN_48BIT;
+ softc->flags |= ADA_FLAG_CAN_48BIT;
if (cgd->ident_data.support.command2 & ATA_SUPPORT_FLUSHCACHE)
- softc->flags |= DA_FLAG_CAN_FLUSHCACHE;
+ softc->flags |= ADA_FLAG_CAN_FLUSHCACHE;
if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ &&
cgd->ident_data.queue >= 31)
- softc->flags |= DA_FLAG_CAN_NCQ;
+ softc->flags |= ADA_FLAG_CAN_NCQ;
// if ((cgd->inq_data.flags & SID_CmdQue) != 0)
-// softc->flags |= DA_FLAG_TAGGED_QUEUING;
+// softc->flags |= ADA_FLAG_TAGGED_QUEUING;
periph->softc = softc;
@@ -611,15 +611,15 @@
* See if this device has any quirks.
*/
// match = cam_quirkmatch((caddr_t)&cgd->inq_data,
-// (caddr_t)da_quirk_table,
-// sizeof(da_quirk_table)/sizeof(*da_quirk_table),
-// sizeof(*da_quirk_table), scsi_inquiry_match);
+// (caddr_t)ada_quirk_table,
+// sizeof(ada_quirk_table)/sizeof(*ada_quirk_table),
+// sizeof(*ada_quirk_table), scsi_inquiry_match);
match = NULL;
if (match != NULL)
- softc->quirks = ((struct da_quirk_entry *)match)->quirks;
+ softc->quirks = ((struct ada_quirk_entry *)match)->quirks;
else
- softc->quirks = DA_Q_NONE;
+ softc->quirks = ADA_Q_NONE;
/* Check if the SIM does not want queued commands */
xpt_setup_ccb(&cpi.ccb_h, periph->path, /*priority*/1);
@@ -627,19 +627,19 @@
xpt_action((union ccb *)&cpi);
if (cpi.ccb_h.status != CAM_REQ_CMP ||
(cpi.hba_inquiry & PI_TAG_ABLE) == 0)
- softc->flags &= ~DA_FLAG_CAN_NCQ;
+ softc->flags &= ~ADA_FLAG_CAN_NCQ;
- TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph);
+ TASK_INIT(&softc->sysctl_task, 0, adasysctlinit, periph);
/*
* Register this media as a disk
*/
mtx_unlock(periph->sim->mtx);
softc->disk = disk_alloc();
- softc->disk->d_open = daopen;
- softc->disk->d_close = daclose;
- softc->disk->d_strategy = dastrategy;
-// softc->disk->d_dump = dadump;
+ softc->disk->d_open = adaopen;
+ softc->disk->d_close = adaclose;
+ softc->disk->d_strategy = adastrategy;
+// softc->disk->d_dump = adadump;
softc->disk->d_name = "ada";
softc->disk->d_drv1 = periph;
if (cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48)
@@ -648,10 +648,10 @@
softc->disk->d_maxsize = 255 * 512; /* 28bit ATA command limit */
softc->disk->d_unit = periph->unit_number;
softc->disk->d_flags = 0;
- if (softc->flags & DA_FLAG_CAN_FLUSHCACHE)
+ if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE)
softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
- dasetgeom(periph, cgd);
+ adasetgeom(periph, cgd);
dp = &softc->params;
snprintf(announce_buf, sizeof(announce_buf),
"%juMB (%ju %u byte sectors: %dH %dS/T "
@@ -686,11 +686,11 @@
* not attach the device on failure.
*/
xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE,
- daasync, periph, periph->path);
+ adaasync, periph, periph->path);
/*
- * Take an exclusive refcount on the periph while dastart is called
- * to finish the probe. The reference will be dropped in dadone at
+ * Take an exclusive refcount on the periph while adastart is called
+ * to finish the probe. The reference will be dropped in adadone at
* the end of probe.
*/
// (void)cam_periph_hold(periph, PRIBIO);
@@ -702,21 +702,21 @@
*/
callout_init_mtx(&softc->sendordered_c, periph->sim->mtx, 0);
callout_reset(&softc->sendordered_c,
- (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL,
- dasendorderedtag, softc);
+ (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL,
+ adasendorderedtag, softc);
return(CAM_REQ_CMP);
}
static void
-dastart(struct cam_periph *periph, union ccb *start_ccb)
+adastart(struct cam_periph *periph, union ccb *start_ccb)
{
- struct da_softc *softc;
+ struct ada_softc *softc;
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
switch (softc->state) {
- case DA_STATE_NORMAL:
+ case ADA_STATE_NORMAL:
{
/* Pull a buffer from the queue and get going on it */
struct bio *bp;
@@ -728,7 +728,7 @@
if (periph->immediate_priority <= periph->pinfo.priority) {
CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE,
("queuing for immediate ccb\n"));
- start_ccb->ccb_h.ccb_state = DA_CCB_WAITING;
+ start_ccb->ccb_h.ccb_state = ADA_CCB_WAITING;
SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h,
periph_links.sle);
periph->immediate_priority = CAM_PRIORITY_NONE;
@@ -741,8 +741,8 @@
bioq_remove(&softc->bio_queue, bp);
- if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) {
- softc->flags &= ~DA_FLAG_NEED_OTAG;
+ if ((softc->flags & ADA_FLAG_NEED_OTAG) != 0) {
+ softc->flags &= ~ADA_FLAG_NEED_OTAG;
softc->ordered_tag_count++;
tag_code = 0;//MSG_ORDERED_Q_TAG;
} else {
@@ -756,16 +756,16 @@
uint16_t count = bp->bio_bcount / softc->params.secsize;
cam_fill_ataio(ataio,
- da_retry_count,
- dadone,
+ ada_retry_count,
+ adadone,
bp->bio_cmd == BIO_READ ?
CAM_DIR_IN : CAM_DIR_OUT,
tag_code,
bp->bio_data,
bp->bio_bcount,
- da_default_timeout*1000);
+ ada_default_timeout*1000);
- if (softc->flags & DA_FLAG_CAN_NCQ) {
+ if (softc->flags & ADA_FLAG_CAN_NCQ) {
if (bp->bio_cmd == BIO_READ) {
ata_ncq_cmd(ataio, ATA_READ_FPDMA_QUEUED,
lba, count);
@@ -773,7 +773,7 @@
ata_ncq_cmd(ataio, ATA_WRITE_FPDMA_QUEUED,
lba, count);
}
- } else if ((softc->flags & DA_FLAG_CAN_48BIT) &&
+ } else if ((softc->flags & ADA_FLAG_CAN_48BIT) &&
(lba + count >= ATA_MAX_28BIT_LBA ||
count >= 256)) {
if (bp->bio_cmd == BIO_READ) {
@@ -797,20 +797,20 @@
case BIO_FLUSH:
cam_fill_ataio(ataio,
1,
- dadone,
+ adadone,
CAM_DIR_NONE,
tag_code,
NULL,
0,
- da_default_timeout*1000);
+ ada_default_timeout*1000);
- if (softc->flags & DA_FLAG_CAN_48BIT)
+ if (softc->flags & ADA_FLAG_CAN_48BIT)
ata_48bit_cmd(ataio, ATA_FLUSHCACHE48, 0, 0, 0);
else
ata_48bit_cmd(ataio, ATA_FLUSHCACHE, 0, 0, 0);
break;
}
- start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO;
+ start_ccb->ccb_h.ccb_state = ADA_CCB_BUFFER_IO;
/*
* Block out any asyncronous callbacks
@@ -821,9 +821,9 @@
softc->outstanding_cmds++;
/* We expect a unit attention from this device */
- if ((softc->flags & DA_FLAG_RETRY_UA) != 0) {
- start_ccb->ccb_h.ccb_state |= DA_CCB_RETRY_UA;
- softc->flags &= ~DA_FLAG_RETRY_UA;
+ if ((softc->flags & ADA_FLAG_RETRY_UA) != 0) {
+ start_ccb->ccb_h.ccb_state |= ADA_CCB_RETRY_UA;
+ softc->flags &= ~ADA_FLAG_RETRY_UA;
}
start_ccb->ccb_h.ccb_bp = bp;
@@ -842,15 +842,15 @@
}
static void
-dadone(struct cam_periph *periph, union ccb *done_ccb)
+adadone(struct cam_periph *periph, union ccb *done_ccb)
{
- struct da_softc *softc;
+ struct ada_softc *softc;
struct ccb_ataio *ataio;
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
ataio = &done_ccb->ataio;
- switch (ataio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) {
- case DA_CCB_BUFFER_IO:
+ switch (ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) {
+ case ADA_CCB_BUFFER_IO:
{
struct bio *bp;
@@ -858,7 +858,7 @@
if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
int error;
- error = daerror(done_ccb, CAM_RETRY_SELTO, 0);
+ error = adaerror(done_ccb, CAM_RETRY_SELTO, 0);
if (error == ERESTART) {
/*
* A retry was scheuled, so
@@ -879,7 +879,7 @@
*/
xpt_print(periph->path,
"Invalidating pack\n");
- softc->flags |= DA_FLAG_PACK_INVALID;
+ softc->flags |= ADA_FLAG_PACK_INVALID;
}
/*
@@ -918,18 +918,18 @@
LIST_REMOVE(&done_ccb->ccb_h, periph_links.le);
softc->outstanding_cmds--;
if (softc->outstanding_cmds == 0)
- softc->flags |= DA_FLAG_WENT_IDLE;
+ softc->flags |= ADA_FLAG_WENT_IDLE;
biodone(bp);
break;
}
- case DA_CCB_WAITING:
+ case ADA_CCB_WAITING:
{
/* Caller will release the CCB */
wakeup(&done_ccb->ccb_h.cbfcnp);
return;
}
- case DA_CCB_DUMP:
+ case ADA_CCB_DUMP:
/* No-op. We're polling */
return;
default:
@@ -939,22 +939,22 @@
}
static int
-daerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
+adaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
{
- struct da_softc *softc;
+ struct ada_softc *softc;
struct cam_periph *periph;
periph = xpt_path_periph(ccb->ccb_h.path);
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
return(cam_periph_error(ccb, cam_flags, sense_flags,
&softc->saved_ccb));
}
static void
-dasetgeom(struct cam_periph *periph, struct ccb_getdev *cgd)
+adasetgeom(struct cam_periph *periph, struct ccb_getdev *cgd)
{
- struct da_softc *softc = (struct da_softc *)periph->softc;
+ struct ada_softc *softc = (struct ada_softc *)periph->softc;
struct disk_params *dp = &softc->params;
u_int64_t lbasize48;
u_int32_t lbasize;
@@ -995,58 +995,58 @@
}
static void
-dasendorderedtag(void *arg)
+adasendorderedtag(void *arg)
{
- struct da_softc *softc = arg;
+ struct ada_softc *softc = arg;
- if (da_send_ordered) {
+ if (ada_send_ordered) {
if ((softc->ordered_tag_count == 0)
- && ((softc->flags & DA_FLAG_WENT_IDLE) == 0)) {
- softc->flags |= DA_FLAG_NEED_OTAG;
+ && ((softc->flags & ADA_FLAG_WENT_IDLE) == 0)) {
+ softc->flags |= ADA_FLAG_NEED_OTAG;
}
if (softc->outstanding_cmds > 0)
- softc->flags &= ~DA_FLAG_WENT_IDLE;
+ softc->flags &= ~ADA_FLAG_WENT_IDLE;
softc->ordered_tag_count = 0;
}
/* Queue us up again */
callout_reset(&softc->sendordered_c,
- (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL,
- dasendorderedtag, softc);
+ (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL,
+ adasendorderedtag, softc);
}
/*
- * Step through all DA peripheral drivers, and if the device is still open,
+ * Step through all ADA peripheral drivers, and if the device is still open,
* sync the disk cache to physical media.
*/
static void
-dashutdown(void * arg, int howto)
+adashutdown(void * arg, int howto)
{
struct cam_periph *periph;
- struct da_softc *softc;
+ struct ada_softc *softc;
TAILQ_FOREACH(periph, &adadriver.units, unit_links) {
// union ccb ccb;
cam_periph_lock(periph);
- softc = (struct da_softc *)periph->softc;
+ softc = (struct ada_softc *)periph->softc;
#if 0
/*
* We only sync the cache if the drive is still open, and
* if the drive is capable of it..
*/
- if (((softc->flags & DA_FLAG_OPEN) == 0)
- || (softc->quirks & DA_Q_NO_SYNC_CACHE)) {
+ if (((softc->flags & ADA_FLAG_OPEN) == 0)
+ || (softc->quirks & ADA_Q_NO_SYNC_CACHE)) {
cam_periph_unlock(periph);
continue;
}
xpt_setup_ccb(&ccb.ccb_h, periph->path, /*priority*/1);
- ccb.ccb_h.ccb_state = DA_CCB_DUMP;
+ ccb.ccb_h.ccb_state = ADA_CCB_DUMP;
scsi_synchronize_cache(&ccb.csio,
/*retries*/1,
- /*cbfcnp*/dadone,
+ /*cbfcnp*/adadone,
0,//MSG_SIMPLE_Q_TAG,
/*begin_lba*/0, /* whole disk */
/*lb_count*/0,
More information about the p4-projects
mailing list