static void
vrpmuattach(device_t parent, device_t self, void *aux)
{
	struct vrpmu_softc *sc = device_private(self);
	struct vrip_attach_args *va = aux;
#if NVRBCU > 0
	int cpuid;
#endif /* NVRBCU > 0 */

	bus_space_tag_t iot = va->va_iot;
	bus_space_handle_t ioh;

	if (bus_space_map(iot, va->va_addr, 1, 0, &ioh)) {
		printf(": can't map bus space\n");
		return;
	}

	sc->sc_iot = iot;
	sc->sc_ioh = ioh;

	if (!(sc->sc_handler = 
	    vrip_intr_establish(va->va_vc, va->va_unit, 0, IPL_TTY,
		vrpmu_intr, sc))) {
		printf (": can't map interrupt line.\n");
		return;
	}
	if (!vrip_intr_establish(va->va_vc, va->va_unit, 1, IPL_TTY,
	    vrpmu_intr, sc)) {
		printf (": can't map interrupt line.\n");
		return;
	}

	printf("\n");
	/* dump current intrrupt states */
	vrpmu_dump_intr(sc);
	DDUMP_REGS(DEBUG_BOOT, sc);
	/* clear interrupt status */
	vrpmu_write(sc, PMUINT_REG_W, PMUINT_ALL);
	vrpmu_write(sc, PMUINT2_REG_W, PMUINT2_ALL);
#if NVRBCU > 0
	cpuid = vrbcu_vrip_getcpuid();
	if (cpuid >= BCUREVID_RID_4111){
		vrpmu_write(sc, PMUWAIT_REG_W, PMUWAIT_DEFAULT);
	}
#endif /* NVRBCU */

	this_pmu = sc;
}
示例#2
0
void
vr4181ip_comintr_establish(vrip_chipset_tag_t vc, int unit, int line,
			   int level, int (*ih_fun)(void *), void *ih_arg)
{
	int	i;
	
	if (!registered) {
		if (!vrip_intr_establish(vc, unit, 0, IPL_TTY,
					 vr4181ip_comintr, intrhands)) {
			panic("vr4181ip_comintr_establish: "
			      "can't map interrupt line.");
		}
		registered = 1;
	}

	for (i = 0; i < MAXCOMINTR; i++) {
		if (intrhands[i].ih_fun == NULL) {
			intrhands[i].ih_fun = ih_fun;
			intrhands[i].ih_arg = ih_arg;
			break;
		}
	}
	if (i >= MAXCOMINTR)
		panic("too many vr4181 SIU");
}
static void
vrkiuattach(device_t parent, device_t self, void *aux)
{
	struct vrkiu_softc *sc = device_private(self);
	struct vrip_attach_args *va = aux;
	struct hpckbd_attach_args haa;
	int isconsole, res;

	bus_space_tag_t iot = va->va_iot;
	bus_space_handle_t ioh;

	if (va->va_parent_ioh != 0)
		res = bus_space_subregion(iot, va->va_parent_ioh, va->va_addr,
		    va->va_size, &ioh);
	else
		res = bus_space_map(iot, va->va_addr, 1, 0, &ioh);
	if (res != 0) {
		printf(": can't map bus space\n");
		return;
	}

	isconsole = vrkiu_is_console(iot, ioh);
	if (isconsole) {
		sc->sc_chip = vrkiu_consdata;
	} else {
		sc->sc_chip = &sc->sc_chip_body;
		vrkiu_init(sc->sc_chip, iot, ioh);
	}
	sc->sc_chip->kc_sc = sc;

	if (!(sc->sc_handler = 
	    vrip_intr_establish(va->va_vc, va->va_unit, 0, IPL_TTY,
		vrkiu_intr, sc))) {
		printf (": can't map interrupt line.\n");
		return;
	}
	/* Level2 register setting */
	vrip_intr_setmask2(va->va_vc, sc->sc_handler, KIUINT_KDATRDY, 1);

	printf("\n");

	/* attach hpckbd */
	haa.haa_ic = &sc->sc_chip->kc_if;
	config_found(self, &haa, hpckbd_print);
}