Create ata_param_fixup
Create a common fixup routine to do the canonical fixup of the ata_param fixup. Call it from both the ATA and the ATA over SCSI paths.
This commit is contained in:
parent
161d2a1796
commit
2afaed2d0f
@ -1238,3 +1238,28 @@ ata_zac_mgmt_in(struct ccb_ataio *ataio, uint32_t retries,
|
||||
ataio->aux = auxiliary;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ata_param_fixup(struct ata_params *ident_buf)
|
||||
{
|
||||
int16_t *ptr;
|
||||
|
||||
for (ptr = (int16_t *)ident_buf;
|
||||
ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) {
|
||||
*ptr = le16toh(*ptr);
|
||||
}
|
||||
if (strncmp(ident_buf->model, "FX", 2) &&
|
||||
strncmp(ident_buf->model, "NEC", 3) &&
|
||||
strncmp(ident_buf->model, "Pioneer", 7) &&
|
||||
strncmp(ident_buf->model, "SHARP", 5)) {
|
||||
ata_bswap(ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
|
||||
}
|
||||
ata_btrim(ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
|
||||
ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
|
||||
}
|
||||
|
@ -135,6 +135,7 @@ void ata_read_log(struct ccb_ataio *ataio, uint32_t retries,
|
||||
uint16_t block_count, uint32_t protocol,
|
||||
uint8_t *data_ptr, uint32_t dxfer_len, uint32_t timeout);
|
||||
|
||||
void ata_param_fixup(struct ata_params *ident_buf);
|
||||
void ata_bswap(int8_t *buf, int len);
|
||||
void ata_btrim(int8_t *buf, int len);
|
||||
void ata_bpack(int8_t *src, int8_t *dst, int len);
|
||||
|
@ -893,31 +893,13 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
|
||||
case PROBE_IDENTIFY:
|
||||
{
|
||||
struct ccb_pathinq cpi;
|
||||
int16_t *ptr;
|
||||
int veto = 0;
|
||||
|
||||
/*
|
||||
* Convert to host byte order, and fix the strings.
|
||||
*/
|
||||
ident_buf = &softc->ident_data;
|
||||
for (ptr = (int16_t *)ident_buf;
|
||||
ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) {
|
||||
*ptr = le16toh(*ptr);
|
||||
}
|
||||
if (strncmp(ident_buf->model, "FX", 2) &&
|
||||
strncmp(ident_buf->model, "NEC", 3) &&
|
||||
strncmp(ident_buf->model, "Pioneer", 7) &&
|
||||
strncmp(ident_buf->model, "SHARP", 5)) {
|
||||
ata_bswap(ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
|
||||
}
|
||||
ata_btrim(ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
|
||||
ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
|
||||
ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
|
||||
ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
|
||||
ata_param_fixup(ident_buf);
|
||||
|
||||
/*
|
||||
* Allow others to veto this ATA disk attachment. This
|
||||
|
@ -5192,7 +5192,7 @@ dadone_probeata(struct cam_periph *periph, union ccb *done_ccb)
|
||||
struct da_softc *softc;
|
||||
u_int32_t priority;
|
||||
int continue_probe;
|
||||
int error, i;
|
||||
int error;
|
||||
int16_t *ptr;
|
||||
|
||||
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n"));
|
||||
@ -5210,8 +5210,7 @@ dadone_probeata(struct cam_periph *periph, union ccb *done_ccb)
|
||||
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
|
||||
uint16_t old_rate;
|
||||
|
||||
for (i = 0; i < sizeof(*ata_params) / 2; i++)
|
||||
ptr[i] = le16toh(ptr[i]);
|
||||
ata_param_fixup(ata_params);
|
||||
if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM &&
|
||||
(softc->quirks & DA_Q_NO_UNMAP) == 0) {
|
||||
dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user