Пример #1
0
void
emc_status(struct scsi_xfer *xs)
{
	struct scsi_link *link = xs->sc_link;
	struct emc_softc *sc = link->device_softc;

	scsi_init_inquiry(xs, SI_EVPD, EMC_VPD_SP_INFO,
	    sc->sc_pg, sizeof(*sc->sc_pg));

	xs->done = emc_status_done;

	scsi_xs_exec(xs);
}
Пример #2
0
int
safte_match(struct device *parent, void *match, void *aux)
{
	struct scsi_inquiry_data *inqbuf;
	struct scsi_attach_args	*sa = aux;
	struct scsi_inquiry_data *inq = sa->sa_inqbuf;
	struct scsi_xfer *xs;
	struct safte_inq *si;
	int error, flags = 0, length;

	if (inq == NULL)
		return (0);

	/* match on dell enclosures */
	if ((inq->device & SID_TYPE) == T_PROCESSOR &&
	    SCSISPC(inq->version) == 3)
		return (2);

	if ((inq->device & SID_TYPE) != T_PROCESSOR ||
	    SCSISPC(inq->version) != 2 ||
	    (inq->response_format & SID_ANSII) != 2)
		return (0);

	length = inq->additional_length + SAFTE_EXTRA_OFFSET;
	if (length < SAFTE_INQ_LEN)
		return (0);
	if (length > sizeof(*inqbuf))
		length = sizeof(*inqbuf);

	inqbuf = dma_alloc(sizeof(*inqbuf), PR_NOWAIT | PR_ZERO);
	if (inqbuf == NULL)
		return (0);

	memset(inqbuf->extra, ' ', sizeof(inqbuf->extra));

	if (cold)
		flags |= SCSI_AUTOCONF;
	xs = scsi_xs_get(sa->sa_sc_link, flags | SCSI_DATA_IN);
	if (xs == NULL)
		goto fail;

	xs->retries = 2;
	xs->timeout = 10000;

	scsi_init_inquiry(xs, 0, 0, inqbuf, length);

	error = scsi_xs_sync(xs);
	scsi_xs_put(xs);

	if (error)
		goto fail;

	si = (struct safte_inq *)&inqbuf->extra;
	if (memcmp(si->ident, SAFTE_IDENT, sizeof(si->ident)) == 0) {
		dma_free(inqbuf, sizeof(*inqbuf));
		return (2);
	}

fail:
	dma_free(inqbuf, sizeof(*inqbuf));
	return (0);
}