Exemplo n.º 1
0
/*
 * 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);
}
Exemplo n.º 2
0
/*
 * 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
}
Exemplo n.º 3
0
/* 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();
	}
}