static int
uda1341_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	if (config_match(parent, cf, NULL) > 0)
		config_attach(parent, cf, NULL, uda1341_print);
	return 0;
}
Esempio n. 2
0
static int
bcmccb_find(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct bcmccb_attach_args * const ccbaa = aux;

	if (strcmp(cf->cf_name, ccbaa->ccbaa_loc.loc_name) != 0)
		return 0;

	const bool is_bcmeth_p = strcmp(cf->cf_name, "bcmeth") == 0;
	const bool is_bcmpax_p = !is_bcmeth_p && strcmp(cf->cf_name, "bcmpax") == 0;
	if (cf->cf_loc[BCMCCBCF_PORT] != BCMCCBCF_PORT_DEFAULT
	    && (cf->cf_loc[BCMCCBCF_PORT] != ccbaa->ccbaa_loc.loc_port
		|| (!is_bcmeth_p && !is_bcmpax_p)))
		return 0;

	ccbaa->ccbaa_loc.loc_mdio = cf->cf_loc[BCMCCBCF_MDIO];
	ccbaa->ccbaa_loc.loc_phy = cf->cf_loc[BCMCCBCF_PHY];
	if (!is_bcmeth_p) {
		const bool is_mdio_default_p = ccbaa->ccbaa_loc.loc_mdio == BCMCCBCF_MDIO_DEFAULT;
		const bool is_phy_default_p = ccbaa->ccbaa_loc.loc_phy == BCMCCBCF_PHY_DEFAULT;
		if (!is_mdio_default_p || !is_phy_default_p)
			return 0;
	}

	return config_match(parent, cf, ccbaa);
}
Esempio n. 3
0
static int
ocp_search(struct device *parent, struct cfdata *cf,
	     const int *ldesc, void *aux)
{
	struct ocp_softc *sc = (struct ocp_softc *)parent;
	struct ocp_attach_args aa;

	switch (cf->cf_loc[OCPCF_MULT]) {
	case 1:
		aa.ocp_iot = &omap_bs_tag;
		break;
	case 2:
		aa.ocp_iot = &omap_a2x_bs_tag;
		break;
	case 4:
		aa.ocp_iot = &omap_a4x_bs_tag;
		break;
	default:
		panic("Unsupported OCP multiplier.");
		break;
	}
	aa.ocp_dmac = sc->sc_dmac;
	aa.ocp_addr = cf->cf_loc[OCPCF_ADDR];
	aa.ocp_size = cf->cf_loc[OCPCF_SIZE];
	aa.ocp_intr = cf->cf_loc[OCPCF_INTR];

	if (config_match(parent, cf, &aa))
		config_attach(parent, cf, &aa, ocp_print);

	return 0;
}
Esempio n. 4
0
static int
mfp_search(device_t parent, cfdata_t cf, const int *loc, void *aux)
{
	if (config_match(parent, cf, __UNCONST(cf->cf_name)) > 0)
		config_attach(parent, cf, __UNCONST(cf->cf_name), NULL);
	return 0;
}
Esempio n. 5
0
static int
nor_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct nor_softc * const sc = device_private(parent);
	struct nor_chip * const chip = &sc->sc_chip;
	struct flash_attach_args faa;

	faa.partinfo.part_offset = cf->cf_loc[FLASHBUSCF_OFFSET];

	if (cf->cf_loc[FLASHBUSCF_SIZE] == 0) {
		faa.partinfo.part_size =
		    chip->nc_size - faa.partinfo.part_offset;
	} else {
		faa.partinfo.part_size = cf->cf_loc[FLASHBUSCF_SIZE];
	}

	if (cf->cf_loc[FLASHBUSCF_READONLY])
		faa.partinfo.part_flags = FLASH_PART_READONLY;
	else
		faa.partinfo.part_flags = 0;

	faa.flash_if = &sc->sc_flash_if;

	if (config_match(parent, cf, &faa)) {
		if (config_attach(parent, cf, &faa, nor_print) != NULL) {
			return 0;
		} else {
			return 1;
		}
	}

	return 1;
}
Esempio n. 6
0
static int
mainbus_search(struct device *parent, struct cfdata *cf,
	       const int *ldesc, void *aux)
{
	if (config_match(parent, cf, aux) > 0)
		config_attach(parent, cf, aux, NULL);
	return 0;
}
Esempio n. 7
0
static int
mainbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{

	if (config_match(parent, cf, NULL) > 0)
		config_attach(parent, cf, NULL, NULL);
	return 0;
}
Esempio n. 8
0
static int
obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct obio_softc * const sc = device_private(parent);
	struct obio_attach_args oa;

	/* Set up the attach args. */
	if (cf->cf_loc[OBIOCF_NOBYTEACC] == 1) {
		if (cf->cf_loc[OBIOCF_MULT] == 1)
			oa.obio_iot = &nobyteacc_bs_tag;
		else
			panic("nobyteacc specified for device with "
				"non-byte multiplier\n");
	} else {
		switch (cf->cf_loc[OBIOCF_MULT]) {
		case 1:
			oa.obio_iot = &omap_bs_tag;
			break;
		case 2:
			oa.obio_iot = &omap_a2x_bs_tag;
			break;
		case 4:
			oa.obio_iot = &omap_a4x_bs_tag;
			break;
		default:
			panic("Unsupported EMIFS multiplier.");
			break;
		}
	}

	oa.obio_dmat = sc->sc_dmat;
	oa.obio_addr = cf->cf_loc[OBIOCF_ADDR];
	oa.obio_size = cf->cf_loc[OBIOCF_SIZE];
	oa.obio_intr = cf->cf_loc[OBIOCF_INTR];
	oa.obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];
	oa.obio_edmabase = cf->cf_loc[OBIOCF_EDMABASE];

#if defined(OMAP2)
	if ((oa.obio_addr >= sc->sc_base)
	&&  (oa.obio_addr < (sc->sc_base + sc->sc_size))) {
		/* XXX
		 * if size was specified, then check it too
		 * otherwise just assume it is OK
		 */
		if ((oa.obio_size != OBIOCF_SIZE_DEFAULT)
		&&  ((oa.obio_addr + oa.obio_size)
			>= (sc->sc_base + sc->sc_size)))
				return 1;		/* NG */
		if (config_match(parent, cf, &oa)) {
			config_attach(parent, cf, &oa, obio_print);
			return 0;			/* love it */
		}
	}
#endif

	return UNCONF;	/* NG */
}
Esempio n. 9
0
static int
amdpcib_search(device_t parent, cfdata_t cf, const int *locs, void *aux)
{

	if (config_match(parent, cf, aux))
		config_attach_loc(parent, cf, locs, aux, NULL);

	return 0;
}
Esempio n. 10
0
int
g2bussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{

	if (config_match(parent, cf, aux) > 0)
		config_attach(parent, cf, aux, g2busprint);

	return 0;
}
static int
L3i_search(device_t parent, cfdata_t cf,
	     const int *ldesc, void *aux)
{
	struct L3i_softc *sc = device_private(parent);
	struct L3i_attach_args aa;

	/* Set up the attach args. */
	if (cf->cf_loc[L3iCF_NOBYTEACC] == 1) {
		if (cf->cf_loc[L3iCF_MULT] == 1)
			aa.L3i_iot = &nobyteacc_bs_tag;
		else
			panic("nobyteacc specified for device with "
				"non-byte multiplier\n");
	} else {
		switch (cf->cf_loc[L3iCF_MULT]) {
		case 1:
			aa.L3i_iot = &omap_bs_tag;
			break;
		case 2:
			aa.L3i_iot = &omap_a2x_bs_tag;
			break;
		case 4:
			aa.L3i_iot = &omap_a4x_bs_tag;
			break;
		default:
			panic("Unsupported EMIFS multiplier.");
			break;
		}
	}

	aa.L3i_dmac = sc->sc_dmac;
	aa.L3i_addr = cf->cf_loc[L3iCF_ADDR];
	aa.L3i_size = cf->cf_loc[L3iCF_SIZE];
	aa.L3i_intr = cf->cf_loc[L3iCF_INTR];

#if defined(OMAP2)
	if ((aa.L3i_addr >= OMAP2_L3i_BASE)
	&&  (aa.L3i_addr < (OMAP2_L4_CORE_BASE + OMAP2_L3i_SIZE))) {
		/* XXX
		 * if size was specified, then check it too
		 * otherwise just assume it is OK
		 */
		if ((aa.L3i_size != L3iCF_SIZE_DEFAULT)
		&&  ((aa.L3i_addr + aa.L3i_size)
			>= (OMAP2_L4_CORE_BASE + OMAP2_L3i_SIZE)))
				return 1;		/* NG */
		if (config_match(parent, cf, &aa)) {
			config_attach(parent, cf, &aa, L3i_print);
			return 0;			/* love it */
		}
	}
#endif

	return 1;	/* NG */
}
Esempio n. 12
0
static int
mainbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
	struct mainbus_attach_args *maa = aux;

	if (cf->cf_loc[MAINBUSCF_ADDR] != maa->mb_addr)
		return (0);

	return (config_match(parent, cf, aux));
}
Esempio n. 13
0
static int
smbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
	struct smbus_attach_args *sa = aux;

	if (cf->cf_loc[SMBUSCF_DEV] != SMBUSCF_DEV_DEFAULT &&
	    cf->cf_loc[SMBUSCF_DEV] != sa->sa_device)
		return (0);

	return (config_match(parent, cf, aux));
}
Esempio n. 14
0
File: pbus.c Progetto: MarginC/kame
static int
pbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
{
	struct pbus_attach_args *pba = aux;

	if (cf->cf_loc[PBUSCF_ADDR] != PBUSCF_ADDR_DEFAULT &&
	    cf->cf_loc[PBUSCF_ADDR] != pba->pb_addr)
		return (0);

	return (config_match(parent, cf, aux));
}
Esempio n. 15
0
File: opb.c Progetto: ryo/netbsd-src
static int
opb_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct opb_attach_args *oaa = aux;

	if (cf->cf_loc[OPBCF_ADDR] != OPBCF_ADDR_DEFAULT &&
	    cf->cf_loc[OPBCF_ADDR] != oaa->opb_addr)
		return 0;

	return config_match(parent, cf, aux);
}
Esempio n. 16
0
static int
zbbus_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct zbbus_attach_args *zap = aux;

	if (cf->cf_loc[ZBBUSCF_BUSID] != ZBBUSCF_BUSID_DEFAULT &&
	    cf->cf_loc[ZBBUSCF_BUSID] != zap->za_locs.za_busid)
		return (0);

	return (config_match(parent, cf, aux));
}
Esempio n. 17
0
static int
podulebus_submatch(struct device *parent, struct cfdata *cf,
		   const int *ldesc, void *aux)
{
	struct podulebus_attach_args *pa = aux;

	if (cf->cf_loc[PODULEBUSCF_SLOT] == PODULEBUSCF_SLOT_DEFAULT ||
	    cf->cf_loc[PODULEBUSCF_SLOT] == pa->pa_slotnum)
		return config_match(parent, cf, aux);
	return 0;
}
Esempio n. 18
0
static int
mainbus_submatch(device_t parent, cfdata_t cf,
		 const int *ldesc, void *aux)
{
	struct mainbus_attach_args *ma = aux;

	if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT &&
	    cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr)
		return (0);

	return (config_match(parent, cf, aux));
}
Esempio n. 19
0
int
ucomsubmatch(device_t parent, cfdata_t cf,
	     const int *ldesc, void *aux)
{
	struct ucom_attach_args *uca = aux;

	if (uca->portno != UCOM_UNK_PORTNO &&
	    cf->cf_loc[UCOMBUSCF_PORTNO] != UCOMBUSCF_PORTNO_DEFAULT &&
	    cf->cf_loc[UCOMBUSCF_PORTNO] != uca->portno)
		return (0);
	return (config_match(parent, cf, aux));
}
Esempio n. 20
0
int
cs80bussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct cs80bus_softc *sc = device_private(parent);
	struct cs80bus_attach_args *ca = aux;

	/*
	 * Set punit if operator specified one in the kernel
	 * configuration file.
	 */
	if (cf->cs80buscf_punit != CS80BUSCF_PUNIT_DEFAULT &&
	    cf->cs80buscf_punit < CS80BUS_NPUNITS)
		ca->ca_punit = cf->cs80buscf_punit;
	else
		/* default punit */
		ca->ca_punit = 0;

	DPRINTF(DBG_FOLLOW, ("cs80bussearch: id=0x%x slave=%d punit=%d\n",
	    ca->ca_id, ca->ca_slave, ca->ca_punit));

	if (config_match(parent, cf, ca) > 0) {

		DPRINTF(DBG_FOLLOW,
		    ("cs80bussearch: got id=0x%x slave=%d punit %d\n",
		    ca->ca_id, ca->ca_slave, ca->ca_punit));

		/*
		 * The device probe has succeeded, and filled in
		 * the punit information.  Make sure the configuration
		 * allows for this slave/punit combination.
		 */
		if (cf->cs80buscf_slave != CS80BUSCF_SLAVE_DEFAULT &&
		    cf->cs80buscf_slave != ca->ca_slave)
			goto out;
		if (cf->cs80buscf_punit != CS80BUSCF_PUNIT_DEFAULT &&
		    cf->cs80buscf_punit != ca->ca_punit)
			goto out;

		/*
		 * Allocate the device's address from the bus's
		 * resource map.
		 */
		if (cs80bus_alloc(sc, ca->ca_slave, ca->ca_punit))
			goto out;

		/*
		 * This device is allowed; attach it.
		 */
		config_attach(parent, cf, ca, cs80busprint);
	}
out:
	return (0);
}
Esempio n. 21
0
int
ubasearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct	uba_softc *sc = device_private(parent);
	struct	uba_attach_args ua;
	int	i, csr, vec, br;

	csr = cf->cf_loc[UBACF_CSR];
	if (sc->uh_used[ubdevreg(csr)])
		return 0; /* something are already at this address */

	ua.ua_ioh = ubdevreg(csr) + sc->uh_ioh;
	ua.ua_iot = sc->uh_iot;
	ua.ua_dmat = sc->uh_dmat;

	if (badaddr((void *)ua.ua_ioh, 2) ||
	    (sc->uh_errchk ? (*sc->uh_errchk)(sc):0))
		goto forgetit;

	scb_vecref(0, 0); /* Clear vector ref */
	i = config_match(parent, cf, &ua);

	if (sc->uh_errchk)
		if ((*sc->uh_errchk)(sc))
			goto forgetit;
	if (i == 0)
		goto forgetit;

	i = scb_vecref(&vec, &br);
	if (i == 0)
		goto fail;
	if (vec == 0)
		goto fail;

	ua.ua_br = br;
	ua.ua_cvec = vec;
	ua.ua_iaddr = csr;
	ua.ua_evcnt = NULL;

	sc->uh_used[ubdevreg(csr)] = 1;

	config_attach(parent, cf, &ua, ubaprint);
	return 0;

fail:
	printf("%s%d at %s csr %o %s\n",
	    cf->cf_name, cf->cf_unit, device_xname(parent),
	    csr, (i ? "zero vector" : "didn't interrupt"));

forgetit:
	return 0;
}
static int
obio_find(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct obio_attach_args * const oa = aux;

	if (oa->obio_addr != OBIOCF_ADDR_DEFAULT
	    && oa->obio_addr != cf->cf_loc[OBIOCF_ADDR])
		return 0;
	if (oa->obio_size != OBIOCF_SIZE_DEFAULT
	    && oa->obio_size != cf->cf_loc[OBIOCF_SIZE])
		return 0;
	if (oa->obio_intr != OBIOCF_INTR_DEFAULT
	    && oa->obio_intr != cf->cf_loc[OBIOCF_INTR])
		return 0;
	if (oa->obio_intrbase != OBIOCF_INTRBASE_DEFAULT
	    && oa->obio_intrbase != cf->cf_loc[OBIOCF_INTRBASE])
		return 0;

	/* Set up the attach args. */
	if (cf->cf_loc[OBIOCF_NOBYTEACC] == 1) {
#if 0
		if (cf->cf_loc[OBIOCF_MULT] == 1)
			oa->obio_iot = &nobyteacc_bs_tag;
		else
#endif
			panic("nobyteacc specified for device with "
				"non-byte multiplier\n");
	} else {
		switch (cf->cf_loc[OBIOCF_MULT]) {
		case 1:
			oa->obio_iot = &gemini_bs_tag;
			break;
#if 0
		case 2:
			oa->obio_iot = &gemini_a2x_bs_tag;
			break;
#endif
		case 4:
			oa->obio_iot = &gemini_a4x_bs_tag;
			break;
		default:
			panic("Unsupported obio bus multiplier.");
			break;
		}
	}
	oa->obio_addr = cf->cf_loc[OBIOCF_ADDR];
	oa->obio_size = cf->cf_loc[OBIOCF_SIZE];
	oa->obio_intr = cf->cf_loc[OBIOCF_INTR];
	oa->obio_intrbase = cf->cf_loc[OBIOCF_INTRBASE];

	return config_match(parent, cf, oa);
}
static int
s3c2440_i2s_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct s3c2440_i2s_attach_args ia;
	DPRINTF(("%s\n", __func__));

	ia.i2sa_handle = device_private(parent);

	if (config_match(parent, cf, &ia))
		config_attach(parent, cf, &ia, s3c2440_i2s_print);

	return 1;
}
Esempio n. 24
0
static int
awinio_find(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	const struct awinio_attach_args * const aio = aux;
	const struct awin_locators * const loc = &aio->aio_loc;
	const int port = cf->cf_loc[AWINIOCF_PORT];

	if (strcmp(cf->cf_name, loc->loc_name)
	    || (port != AWINIOCF_PORT_DEFAULT && port != loc->loc_port))
		return 0;

	return config_match(parent, cf, aux);
}
Esempio n. 25
0
int
at91bus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct at91bus_attach_args *sa = aux;

	sa->sa_addr = cf->cf_loc[AT91BUSCF_ADDR];
	sa->sa_size = cf->cf_loc[AT91BUSCF_SIZE];
	sa->sa_pid  = cf->cf_loc[AT91BUSCF_PID];

	if (config_match(parent, cf, aux) > 0)
		config_attach(parent, cf, aux, at91bus_print);

	return (0);
}
Esempio n. 26
0
int
at91bus_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct at91bus_attach_args *sa = aux;

	if (cf->cf_loc[AT91BUSCF_ADDR] == ldesc[AT91BUSCF_ADDR]
	    && cf->cf_loc[AT91BUSCF_PID] == ldesc[AT91BUSCF_PID]) {
		sa->sa_addr = cf->cf_loc[AT91BUSCF_ADDR];
		sa->sa_size = cf->cf_loc[AT91BUSCF_SIZE];
		sa->sa_pid  = cf->cf_loc[AT91BUSCF_PID];
		return (config_match(parent, cf, aux));
	} else
		return (0);
}
Esempio n. 27
0
int 
obio_submatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct confargs *ca = aux;

	/*
	 * Note that a defaulted address locator can never match
	 * the value of ca->ca_paddr set by the obio_attach loop.
	 * Without this diagnostic, any device with a defaulted
	 * address locator would always be silently unmatched.
	 * Therefore, just disallow default addresses on OBIO.
	 */
#ifdef	DIAGNOSTIC
	if (cf->cf_paddr == -1)
		panic("%s: invalid address for: %s%d",
		    __func__, cf->cf_name, cf->cf_unit);
#endif

	/*
	 * Note that obio_attach calls config_found_sm() with
	 * this function as the "submatch" and ca->ca_paddr
	 * set to each of the possible OBIO locations, so we
	 * want to reject any unmatched address here.
	 */
	if (cf->cf_paddr != ca->ca_paddr)
		return 0;

	/*
	 * Note that the Sun3 does not really support vectored
	 * interrupts on OBIO, but the locator is permitted for
	 * consistency with the Sun3X.  Verify its absence...
	 */
#ifdef	DIAGNOSTIC
	if (cf->cf_intvec != -1)
		panic("%s: %s%d can not have a vector",
		    __func__, cf->cf_name, cf->cf_unit);
#endif

	/*
	 * Copy the locators into our confargs for the child.
	 * Note: ca->ca_bustype was set by our parent driver
	 * (mainbus) and ca->ca_paddr was set by obio_attach.
	 */
	ca->ca_intpri = cf->cf_intpri;
	ca->ca_intvec = -1;

	/* Now call the match function of the potential child. */
	return config_match(parent, cf, aux);
}
/*
 * config_search_ia() callback function.
 */
static int
apbh_search_cb(device_t parent, cfdata_t cf, const int *locs, void *aux)
{
	struct apb_attach_args *aa = aux;

	aa->aa_name = cf->cf_name;
	aa->aa_addr = cf->cf_loc[APBHCF_ADDR];
	aa->aa_size = cf->cf_loc[APBHCF_SIZE];
	aa->aa_irq = cf->cf_loc[APBHCF_IRQ];

	if (config_match(parent, cf, aux) > 0)
		config_attach(parent, cf, aux, apbh_print);

	return 0;
}
Esempio n. 29
0
File: i2c.c Progetto: MarginC/kame
static int
iic_search(struct device *parent, struct cfdata *cf, void *aux)
{
	struct iic_softc *sc = (void *) parent;
	struct i2c_attach_args ia;

	ia.ia_tag = sc->sc_tag;
	ia.ia_addr = cf->cf_loc[IICCF_ADDR];
	ia.ia_size = cf->cf_loc[IICCF_SIZE];

	if (config_match(parent, cf, &ia) > 0)
		config_attach(parent, cf, &ia, iic_print);

	return (0);
}
Esempio n. 30
0
static int
rsbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
	struct rsbus_softc *sc = device_private(parent);
	struct rsbus_attach_args sa;

	sa.sa_iot = sc->sc_iot;
	sa.sa_addr = cf->cf_loc[RSBUSCF_ADDR];
	sa.sa_size = cf->cf_loc[RSBUSCF_SIZE];
	sa.sa_intr = cf->cf_loc[RSBUSCF_IRQ];

	if (config_match(parent, cf, &sa) > 0)
		config_attach(parent, cf, &sa, rsbus_print);

	return (0);
}