Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/scsi/scsi_da.c
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#include <cam/cam.h> | #include <cam/cam.h> | ||||
#include <cam/cam_ccb.h> | #include <cam/cam_ccb.h> | ||||
#include <cam/cam_periph.h> | #include <cam/cam_periph.h> | ||||
#include <cam/cam_xpt_periph.h> | #include <cam/cam_xpt_periph.h> | ||||
#ifdef _KERNEL | |||||
#include <cam/cam_xpt_internal.h> | |||||
#endif /* _KERNEL */ | |||||
#include <cam/cam_sim.h> | #include <cam/cam_sim.h> | ||||
#include <cam/cam_iosched.h> | #include <cam/cam_iosched.h> | ||||
#include <cam/scsi/scsi_message.h> | #include <cam/scsi/scsi_message.h> | ||||
#include <cam/scsi/scsi_da.h> | #include <cam/scsi/scsi_da.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 3,533 Lines • ▼ Show 20 Lines | if (!scsi_vpd_supported_page(periph, SVPD_ATA_INFORMATION)) { | ||||
*/ | */ | ||||
softc->state = DA_STATE_PROBE_ZONE; | softc->state = DA_STATE_PROBE_ZONE; | ||||
goto skipstate; | goto skipstate; | ||||
} | } | ||||
daprobedone(periph, start_ccb); | daprobedone(periph, start_ccb); | ||||
break; | break; | ||||
} | } | ||||
ata_params = &periph->path->device->ident_data; | ata_params = (struct ata_params*) | ||||
malloc(sizeof(*ata_params), M_SCSIDA,M_NOWAIT|M_ZERO); | |||||
if (ata_params == NULL) { | |||||
xpt_print(periph->path, "Couldn't malloc ata_params " | |||||
"data\n"); | |||||
/* da_free_periph??? */ | |||||
break; | |||||
} | |||||
scsi_ata_identify(&start_ccb->csio, | scsi_ata_identify(&start_ccb->csio, | ||||
/*retries*/da_retry_count, | /*retries*/da_retry_count, | ||||
/*cbfcnp*/dadone_probeata, | /*cbfcnp*/dadone_probeata, | ||||
/*tag_action*/MSG_SIMPLE_Q_TAG, | /*tag_action*/MSG_SIMPLE_Q_TAG, | ||||
/*data_ptr*/(u_int8_t *)ata_params, | /*data_ptr*/(u_int8_t *)ata_params, | ||||
/*dxfer_len*/sizeof(*ata_params), | /*dxfer_len*/sizeof(*ata_params), | ||||
/*sense_len*/SSD_FULL_SIZE, | /*sense_len*/SSD_FULL_SIZE, | ||||
/*timeout*/da_default_timeout * 1000); | /*timeout*/da_default_timeout * 1000); | ||||
▲ Show 20 Lines • Show All 1,553 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
dadone_probeata(struct cam_periph *periph, union ccb *done_ccb) | dadone_probeata(struct cam_periph *periph, union ccb *done_ccb) | ||||
{ | { | ||||
struct ata_params *ata_params; | struct ata_params *ata_params; | ||||
struct ccb_scsiio *csio; | struct ccb_scsiio *csio; | ||||
struct da_softc *softc; | struct da_softc *softc; | ||||
u_int32_t priority; | u_int32_t priority; | ||||
int continue_probe; | int continue_probe; | ||||
int error; | int error, i; | ||||
int16_t *ptr; | int16_t *ptr; | ||||
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n")); | CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("dadone_probeata\n")); | ||||
softc = (struct da_softc *)periph->softc; | softc = (struct da_softc *)periph->softc; | ||||
priority = done_ccb->ccb_h.pinfo.priority; | priority = done_ccb->ccb_h.pinfo.priority; | ||||
csio = &done_ccb->csio; | csio = &done_ccb->csio; | ||||
ata_params = (struct ata_params *)csio->data_ptr; | ata_params = (struct ata_params *)csio->data_ptr; | ||||
ptr = (uint16_t *)ata_params; | ptr = (uint16_t *)ata_params; | ||||
continue_probe = 0; | continue_probe = 0; | ||||
error = 0; | error = 0; | ||||
cam_periph_assert(periph, MA_OWNED); | cam_periph_assert(periph, MA_OWNED); | ||||
if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { | ||||
uint16_t old_rate; | uint16_t old_rate; | ||||
ata_param_fixup(ata_params); | for (i = 0; i < sizeof(*ata_params) / 2; i++) | ||||
ptr[i] = le16toh(ptr[i]); | |||||
if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM && | if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM && | ||||
(softc->quirks & DA_Q_NO_UNMAP) == 0) { | (softc->quirks & DA_Q_NO_UNMAP) == 0) { | ||||
dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1); | dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1); | ||||
if (ata_params->max_dsm_blocks != 0) | if (ata_params->max_dsm_blocks != 0) | ||||
softc->trim_max_ranges = min( | softc->trim_max_ranges = min( | ||||
softc->trim_max_ranges, | softc->trim_max_ranges, | ||||
ata_params->max_dsm_blocks * | ata_params->max_dsm_blocks * | ||||
ATA_DSM_BLK_RANGES); | ATA_DSM_BLK_RANGES); | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | else if (error != 0) { | ||||
/*relsim_flags*/0, | /*relsim_flags*/0, | ||||
/*reduction*/0, | /*reduction*/0, | ||||
/*timeout*/0, | /*timeout*/0, | ||||
/*getcount_only*/0); | /*getcount_only*/0); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
free(ata_params, M_SCSIDA); | |||||
if ((softc->zone_mode == DA_ZONE_HOST_AWARE) | if ((softc->zone_mode == DA_ZONE_HOST_AWARE) | ||||
|| (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { | || (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { | ||||
/* | /* | ||||
* If the ATA IDENTIFY failed, we could be talking | * If the ATA IDENTIFY failed, we could be talking | ||||
* to a SCSI drive, although that seems unlikely, | * to a SCSI drive, although that seems unlikely, | ||||
* since the drive did report that it supported the | * since the drive did report that it supported the | ||||
* ATA Information VPD page. If the ATA IDENTIFY | * ATA Information VPD page. If the ATA IDENTIFY | ||||
* succeeded, and the SAT layer doesn't support | * succeeded, and the SAT layer doesn't support | ||||
▲ Show 20 Lines • Show All 1,242 Lines • Show Last 20 Lines |