Exemplo n.º 1
0
struct lhd_softc *
attach_lhd_to_lamebus(int lhdno, struct lamebus_softc *sc)
{
	struct lhd_softc *lh;
	int slot = lamebus_probe(sc, LB_VENDOR_CS161, LBCS161_DISK,
				 LOW_VERSION, HIGH_VERSION);
	if (slot < 0) {
		/* None found */
		return NULL;
	}

	lh = kmalloc(sizeof(struct lhd_softc));
	if (lh==NULL) {
		/* Out of memory */
		return NULL;
	}

	/* Record what the lhd is attached to */
	lh->lh_busdata = sc;
	lh->lh_buspos = slot;
	lh->lh_unit = lhdno;

	/* Mark the slot in use and collect interrupts */
	lamebus_mark(sc, slot);
	lamebus_attach_interrupt(sc, slot, lh, lhd_irq);

	return lh;
}
Exemplo n.º 2
0
struct lser_softc *
attach_lser_to_lamebus(int lserno, struct lamebus_softc *sc)
{
	struct lser_softc *ls;
	int slot = lamebus_probe(sc, LB_VENDOR_CS161, LBCS161_SERIAL,
				 LOW_VERSION, HIGH_VERSION);
	if (slot < 0) {
		return NULL;
	}

	ls = kmalloc(sizeof(struct lser_softc));
	if (ls==NULL) {
		return NULL;
	}

	(void)lserno;  // unused

	ls->ls_busdata = sc;
	ls->ls_buspos = slot;

	lamebus_mark(sc, slot);
	lamebus_attach_interrupt(sc, slot, ls, lser_irq);

	return ls;
}
Exemplo n.º 3
0
struct emu_softc *
attach_emu_to_lamebus(int emuno, struct lamebus_softc *sc)
{
	struct emu_softc *es;
	int slot = lamebus_probe(sc, LB_VENDOR_CS161, LBCS161_EMUFS,
				 LOW_VERSION, HIGH_VERSION);
	if (slot < 0) {
		return NULL;
	}

	es = kmalloc(sizeof(struct emu_softc));
	if (es==NULL) {
		return NULL;
	}

	es->e_busdata = sc;
	es->e_buspos = slot;
	es->e_unit = emuno;

	lamebus_mark(sc, slot);
	lamebus_attach_interrupt(sc, slot, es, emu_irq);

	return es;
}