In tc_fb_cnattach(): match from a table, and add #ifdef'ed out glue for the

px/pxg devices.
This commit is contained in:
ad 2000-12-22 13:33:57 +00:00
parent 024d36d353
commit 4368af2854
1 changed files with 46 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcasic.c,v 1.30 2000/06/05 21:47:32 thorpej Exp $ */
/* $NetBSD: tcasic.c,v 1.31 2000/12/22 13:33:57 ad Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.30 2000/06/05 21:47:32 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.31 2000/12/22 13:33:57 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -173,11 +173,41 @@ tcasicprint(aux, pnp)
#include "cfb.h"
#include "sfb.h"
#ifdef notyet
#include "px.h"
#include "pxg.h"
#endif
extern int sfb_cnattach __P((tc_addr_t));
extern int cfb_cnattach __P((tc_addr_t));
extern void sfb_cnattach __P((tc_addr_t));
extern void cfb_cnattach __P((tc_addr_t));
extern void px_cnattach __P((tc_addr_t));
extern void pxg_cnattach __P((tc_addr_t));
extern int tc_checkslot __P((tc_addr_t, char *));
struct cnboards {
const char *cb_tcname;
int (*cb_cnattach)(tc_addr_t);
} static cnboards[] = {
#if NSFB > 0
{ "PMAGB-BA", sfb_cnattach },
#endif
#if NCFB > 0
{ "PMAG-BA ", cfb_cnattach },
#endif
#ifdef notyet
#if NPX > 0
{ "PMAG-CA ", px_cnattach },
#endif
#if NPXG > 0
{ "PMAG-DA ", pxg_cnattach },
{ "PMAG-FA ", pxg_cnattach },
{ "PMAG-FB ", pxg_cnattach },
{ "PMAGB-FA", pxg_cnattach },
{ "PMAGB-FB", pxg_cnattach },
#endif
#endif
};
/*
* tc_fb_cnattach --
* Attempt to attach the appropriate display driver to the
@ -188,23 +218,19 @@ tc_fb_cnattach(tcaddr)
tc_addr_t tcaddr;
{
char tcname[TC_ROM_LLEN];
int i;
if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0)) {
return EINVAL;
}
if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0))
return (EINVAL);
#if NSFB > 0
if (strncmp("PMAGB-BA", tcname, TC_ROM_LLEN) == 0) {
sfb_cnattach(tcaddr);
return 0;
}
#endif
#if NCFB > 0
if (strncmp("PMAG-BA ", tcname, TC_ROM_LLEN) == 0) {
cfb_cnattach(tcaddr);
return 0;
}
#endif
return ENXIO;
for (i = 0; i < sizeof(cnboards) / sizeof(cnboards[0]); i++)
if (strncmp(tcname, cnboards[i].cb_tcname, TC_ROM_LLEN) == 0)
break;
if (i == sizeof(cnboards) / sizeof(cnboards[0]))
return (ENXIO);
(cnboards[i].cb_cnattach)(tcaddr);
return (0);
}
#endif /* if NWSDISPLAY > 0 */