Example #1
0
void
emc_attach(struct device *parent, struct device *self, void *aux)
{
	struct emc_softc *sc = (struct emc_softc *)self;
	struct scsi_attach_args *sa = aux;
	struct scsi_link *link = sa->sa_sc_link;
	int sp;

	printf("\n");

	/* init link */
	link->device_softc = sc;

	/* init path */
	scsi_xsh_set(&sc->sc_path.p_xsh, link, emc_mpath_start);
	sc->sc_path.p_link = link;

	/* init status handler */
	scsi_xsh_set(&sc->sc_xsh, link, emc_status);
	sc->sc_pg = dma_alloc(sizeof(*sc->sc_pg), PR_WAITOK);

	/* let's go */

	if (emc_sp_info(sc, &sp)) {
		printf("%s: unable to get sp info\n", DEVNAME(sc));
		return;
	}

	if (mpath_path_attach(&sc->sc_path, sp, &emc_mpath_ops) != 0)
		printf("%s: unable to attach path\n", DEVNAME(sc));
}
Example #2
0
void
sym_attach(struct device *parent, struct device *self, void *aux)
{
	struct sym_softc *sc = (struct sym_softc *)self;
	struct scsi_attach_args *sa = aux;
	struct scsi_link *link = sa->sa_sc_link;
	struct scsi_inquiry_data *inq = sa->sa_inqbuf;
	const struct mpath_ops *ops = &sym_mpath_sym_ops;
	struct sym_device *s;
	int i;

	printf("\n");

	/* check if we're an assymetric access device */
	for (i = 0; i < nitems(asym_devices); i++) {
		s = &asym_devices[i];

		if (bcmp(s->vendor, inq->vendor, strlen(s->vendor)) == 0 &&
		    bcmp(s->product, inq->product, strlen(s->product)) == 0) {
			ops = &sym_mpath_asym_ops;
			break;
		}
	}

	/* init link */
	link->device_softc = sc;

	/* init path */
	scsi_xsh_set(&sc->sc_path.p_xsh, link, sym_mpath_start);
	sc->sc_path.p_link = link;

	if (mpath_path_attach(&sc->sc_path, ops) != 0)
		printf("%s: unable to attach path\n", DEVNAME(sc));
}
Example #3
0
void
sym_attach(struct device *parent, struct device *self, void *aux)
{
	struct sym_softc *sc = (struct sym_softc *)self;
	struct scsi_attach_args *sa = aux;
	struct scsi_link *link = sa->sa_sc_link;

	printf("\n");

	/* init link */
	link->device_softc = sc;

	/* init path */
	scsi_xsh_set(&sc->sc_path.p_xsh, link, sym_mpath_start);
	sc->sc_path.p_link = link;
	sc->sc_path.p_ops = &sym_mpath_ops;

	if (mpath_path_attach(&sc->sc_path) != 0)
		printf("%s: unable to attach path\n", DEVNAME(sc));
}
Example #4
0
void
emc_attach(struct device *parent, struct device *self, void *aux)
{
	char model[256], serial[256];
	struct emc_softc *sc = (struct emc_softc *)self;
	struct scsi_attach_args *sa = aux;
	struct scsi_link *link = sa->sa_sc_link;

	printf("\n");

	/* init link */
	link->device_softc = sc;

	/* init path */
	scsi_xsh_set(&sc->sc_path.p_xsh, link, emc_mpath_start);
	sc->sc_path.p_link = link;
	sc->sc_path.p_ops = &emc_mpath_ops;

	if (emc_sp_info(sc)) {
		printf("%s: unable to get sp info\n", DEVNAME(sc));
		return;
	}

	if (emc_inquiry(sc, model, serial) != 0) {
		printf("%s: unable to get inquiry data\n", DEVNAME(sc));
		return;
	}

	printf("%s: %s %s SP-%c port %d\n", DEVNAME(sc), model, serial,
	    sc->sc_sp + 'A', sc->sc_port);

	if (sc->sc_lun_state == EMC_SP_INFO_LUN_STATE_OWNED) {
		if (mpath_path_attach(&sc->sc_path) != 0)
			printf("%s: unable to attach path\n", DEVNAME(sc));
	}
}