/* * we make sure to only init things once. this is somewhat * tricky regarding the console. */ int grfccmatch(device_t parent, cfdata_t cf, void *aux) { static int ccconunit = -1; char *mainbus_name = aux; extern const struct cdevsw view_cdevsw; /* * allow only one cc console */ if (amiga_realconfig == 0 && ccconunit != -1) return(0); if (matchname("grfcc", mainbus_name) == 0) return(0); if (amiga_realconfig == 0 || ccconunit != cf->cf_unit) { if (grfcc_probe() == 0) return(0); viewprobe(); /* * XXX nasty hack. opens view[0] and never closes. */ if ((*view_cdevsw.d_open)(0, 0, 0, NULL)) return(0); if (amiga_realconfig == 0) { ccconunit = cf->cf_unit; cfdata = cf; } } return(1); }
/* * This gets called if this device is used as the console. */ void amidisplaycc_cninit(struct consdev * cd) { void * cookie; long attr; int x; int y; /* Yeah, we got the console! */ /* * This will do the basic stuff we also need. */ config_console(); grfcc_probe(); #if NVIEW>0 viewprobe(); #endif /* * Set up wscons to handle the details. * It will then call us back when it needs something * display-specific. It will also set up cn_tab properly, * something which we failed to do at amidisplaycc_cnprobe(). */ /* * The alloc_screen knows to allocate the first screen statically. */ amidisplaycc_alloc_screen(NULL, &amidisplaycc_screentab[0].wsdescr, &cookie, &x, &y, &attr); wsdisplay_cnattach(&amidisplaycc_screentab[0].wsdescr, cookie, x, y, attr); #if NKBD>0 /* tell kbd device it is used as console keyboard */ kbd_cnattach(); #endif }
/* ARGSUSED */ static void amidisplaycc_attach(struct device *pdp, struct device *dp, void *auxp) { struct wsemuldisplaydev_attach_args waa; struct amidisplaycc_softc * adp; adp = (struct amidisplaycc_softc*)dp; grfcc_probe(); #if NVIEW>0 viewprobe(); #endif /* * Attach only at real configuration time. Console init is done at * the amidisplaycc_cninit function above. */ if (adp) { printf(": Amiga custom chip graphics %s", aga_enable ? "(AGA)" : ""); if (amidisplaycc_consolescreen.isconsole) { adp->currentscreen = &amidisplaycc_consolescreen; printf(" (console)"); } else adp->currentscreen = NULL; printf("\n"); adp->ison = 1; /* * Mapped screen properties. * Would need a way to configure. */ adp->gfxview = NULL; adp->gfxon = 0; adp->gfxwidth = 640; adp->gfxheight = 480; if (aga_enable) adp->gfxdepth = 8; else adp->gfxdepth = 4; if (NELEMS(amidisplaycc_screentab) != NELEMS(amidisplaycc_screens)) panic("invalid screen definitions"); waa.scrdata = &amidisplaycc_screenlist; waa.console = amidisplaycc_consolescreen.isconsole; waa.accessops = &amidisplaycc_accessops; waa.accesscookie = dp; config_found(dp, &waa, wsemuldisplaydevprint); bzero(adp->fonts, sizeof(adp->fonts)); /* Initialize an alternate system for finding fonts. */ wsfont_init(); } }
int grfetmatch(device_t parent, cfdata_t cf, void *aux) { static int card_probed = -1; static int did_consinit = 0; grf_auxp_t *grf_auxp = aux; extern const struct cdevsw view_cdevsw; if (card_probed <= 0) { if (card_probed == 0) /* Probed but failed */ return 0; card_probed = 0; /* * Check if the layers we depend on exist */ if (!(machineid & ATARI_HADES)) return 0; if (!et_probe_card()) return 0; if (grfabs_probe(&et_probe_video) == 0) return 0; viewprobe(); card_probed = 1; /* Probed and found */ } if (atari_realconfig == 0) { /* * Early console init. Only match first unit. */ if (did_consinit) return 0; if ((*view_cdevsw.d_open)(cf->cf_unit, 0, 0, NULL)) return 0; cfdata_grf = cf; did_consinit = 1; return 1; } /* * Normal config. When we are called directly from the grfbus, * we only match the first unit. The attach function will call us for * the other configured units. */ if (grf_auxp->from_bus_match && ((did_consinit > 1) || !et_probe_card())) return 0; if (!grf_auxp->from_bus_match && (grf_auxp->unit != cf->cf_unit)) return 0; /* * Final constraint: each grf needs a view.... */ if ((cfdata_grf == NULL) || (did_consinit > 1)) { if ((*view_cdevsw.d_open)(cf->cf_unit, 0, 0, NULL)) return 0; } did_consinit = 2; return 1; }