void hil_gsc_attach(device_t parent, device_t self, void *aux) { struct hil_gsc_softc *gsc = device_private(self); struct hil_softc *sc = &gsc->sc_hs; struct gsc_attach_args *ga = aux; int pagezero_cookie; sc->sc_dev = self; sc->sc_bst = ga->ga_iot; if (bus_space_map(ga->ga_iot, ga->ga_hpa, HILMAPSIZE, 0, &sc->sc_bsh)) { aprint_error(": couldn't map hil controller\n"); return; } pagezero_cookie = hp700_pagezero_map(); gsc->sc_hil_console = ga->ga_dp.dp_mod == PAGE0->mem_kbd.pz_dp.dp_mod && memcmp(ga->ga_dp.dp_bc, PAGE0->mem_kbd.pz_dp.dp_bc, 6) == 0; hp700_pagezero_unmap(pagezero_cookie); hil_attach(sc, &gsc->sc_hil_console); gsc->sc_ih = hp700_intr_establish(IPL_TTY, hil_intr, sc, ga->ga_ir, ga->ga_irq); config_interrupts(self, hil_attach_deferred); }
void com_gsc_attach(device_t parent, device_t self, void *aux) { struct com_gsc_softc *gsc = device_private(self); struct com_softc *sc = &gsc->sc_com; struct gsc_attach_args *ga = aux; int pagezero_cookie; bus_space_tag_t iot; bus_space_handle_t ioh; bus_addr_t iobase; sc->sc_dev = self; sc->sc_hwflags = 0; sc->sc_swflags = 0; iot = ga->ga_iot; iobase = (bus_addr_t)ga->ga_hpa + COMGSC_OFFSET; sc->sc_frequency = COMGSC_FREQUENCY; /* Test if this is the console. Compare either HPA or device path. */ pagezero_cookie = hp700_pagezero_map(); if ((hppa_hpa_t)PAGE0->mem_cons.pz_hpa == ga->ga_hpa ) { /* * This port is the console. In this case we must call * comcnattach() and later com_is_console() to initialize * everything properly. */ if (comcnattach(iot, iobase, B9600, sc->sc_frequency, COM_TYPE_NORMAL, (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8) != 0) { aprint_error(": can't comcnattach\n"); hp700_pagezero_unmap(pagezero_cookie); return; } } hp700_pagezero_unmap(pagezero_cookie); /* * Get the already initialized console ioh via com_is_console() if * this is the console or map the I/O space if this isn't the console. */ if (!com_is_console(iot, iobase, &ioh) && bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh) != 0) { aprint_error(": can't map I/O space\n"); return; } COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase); com_attach_subr(sc); gsc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_TTY, comintr, sc, ga->ga_int_reg, ga->ga_irq); }
void gscattach(struct device *parent, struct device *self, void *aux) { struct gsc_softc *sc = (struct gsc_softc *)self; struct gsc_attach_args *ga = aux; sc->sc_ga = *ga; if (machine_ledaddr) printf(": %sleds", machine_ledword? "word" : ""); printf ("\n"); /* Add the I/O subsystem's interrupt register. */ ga->ga_int_reg->int_reg_dev = parent->dv_xname; sc->sc_ih = hp700_intr_establish(&sc->sc_dev, IPL_NONE, NULL, ga->ga_int_reg, &int_reg_cpu, ga->ga_irq); pdc_scanbus(self, &ga->ga_ca, gsc_module_callback); }