Exemplo n.º 1
0
/*
 * Attach the on-chip peripheral bus.
 */
static void
opb_attach(struct device *parent, struct device *self, void *aux)
{
	struct plb_attach_args *paa = aux;
	struct opb_attach_args oaa;
	bus_space_tag_t tag;
	int i, pvr;

	printf("\n");
	pvr = mfpvr() >> 16;

	tag = opb_get_bus_space_tag();

	for (i = 0; opb_devs[i].name != NULL; i++) {
		if (opb_devs[i].pvr != pvr)
			continue;
		oaa.opb_name = opb_devs[i].name;
		oaa.opb_addr = opb_devs[i].addr;
		oaa.opb_instance = opb_devs[i].instance;
		oaa.opb_irq = opb_devs[i].irq;
		oaa.opb_bt = tag;
		oaa.opb_dmat = paa->plb_dmat;

		(void) config_found_sm_loc(self, "opb", NULL, &oaa, opb_print,
					   opb_submatch);
	}
}
Exemplo n.º 2
0
/*
 * consinit:
 * initialize the system console.
 * XXX - shouldn't deal with this initted thing, but then,
 * it shouldn't be called from initppc either.
 */
void
consinit(void)
{
	static int initted = 0;
#if (NCOM > 0)
	bus_space_tag_t tag;
#endif

	if (initted)
		return;
	initted = 1;

#if (NCOM > 0)
	/* We *know* the com-console attaches to opb */
	tag = opb_get_bus_space_tag();

	if (comcnattach(tag, CONADDR, CONSPEED, COM_FREQ * 6,
	    COM_TYPE_NORMAL, comcnmode))
		panic("can't init serial console @%x", CONADDR);
	else
		return;
#endif
	panic("console device missing -- serial console not in kernel");
	/* Of course, this is moot if there is no console... */
}
Exemplo n.º 3
0
void
kgdb_port_init(void)
{
#if (NCOM > 0)
	if(!strcmp(kgdb_devname, "com")) {
		bus_space_tag_t tag = opb_get_bus_space_tag();
		com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ * 6,
		    COM_TYPE_NORMAL, comkgdbmode);
	}
#endif
}
Exemplo n.º 4
0
Arquivo: opb.c Projeto: ryo/netbsd-src
/*
 * Attach the on-chip peripheral bus.
 */
static void
opb_attach(device_t parent, device_t self, void *aux)
{
	struct opb_softc *sc = device_private(self);
	struct plb_attach_args *paa = aux;
	struct opb_attach_args oaa;
	int i, pvr;

	aprint_naive("\n");
	aprint_normal("\n");
	pvr = mfpvr() >> 16;

	sc->sc_dev = self;
	sc->sc_iot = opb_get_bus_space_tag();

	for (i = 0; opb_params[i].pvr != 0 && opb_params[i].pvr != pvr; i++)
		;
	if (opb_params[i].pvr == 0)
		panic("opb_get_bus_space_tag: no params for this CPU!");
	opb_get_frequency = opb_params[i].opb_get_frequency;
#ifdef EMAC_ZMII_PHY
	if (opb_params[i].zmii_base != 0)
		bus_space_map(sc->sc_iot, opb_params[i].zmii_base, ZMII0_SIZE,
		    0, &sc->sc_zmiih);
#endif
#ifdef EMAC_RGMII_PHY
	if (opb_params[i].rgmii_base != 0)
		bus_space_map(sc->sc_iot, opb_params[i].rgmii_base, RGMII0_SIZE,
		    0, &sc->sc_rgmiih);
#endif

	for (i = 0; opb_devs[i].name != NULL; i++) {
		if (opb_devs[i].pvr != pvr)
			continue;
		oaa.opb_name = opb_devs[i].name;
		oaa.opb_addr = opb_devs[i].addr;
		oaa.opb_instance = opb_devs[i].instance;
		oaa.opb_irq = opb_devs[i].irq;
		oaa.opb_bt = sc->sc_iot;
		oaa.opb_dmat = paa->plb_dmat;
		oaa.opb_flags = opb_devs[i].flags;

		(void) config_found_sm_loc(self, "opb", NULL, &oaa, opb_print,
					   opb_submatch);
	}
}