Home | History | Annotate | Line # | Download | only in dev
hb.c revision 1.1
      1  1.1  tsubai 
      2  1.1  tsubai #include <sys/param.h>
      3  1.1  tsubai #include <sys/systm.h>
      4  1.1  tsubai #include <sys/device.h>
      5  1.1  tsubai 
      6  1.1  tsubai #include <machine/autoconf.h>
      7  1.1  tsubai #include <machine/adrsmap.h>
      8  1.1  tsubai 
      9  1.1  tsubai static int	hb_match __P((struct device *, struct cfdata *, void *));
     10  1.1  tsubai static void	hb_attach __P((struct device *, struct device *, void *));
     11  1.1  tsubai static int	hb_print __P((void *, const char *));
     12  1.1  tsubai 
     13  1.1  tsubai struct cfattach hb_ca = {
     14  1.1  tsubai 	sizeof(struct device), hb_match, hb_attach
     15  1.1  tsubai };
     16  1.1  tsubai 
     17  1.1  tsubai extern struct cfdriver hb_cd;
     18  1.1  tsubai 
     19  1.1  tsubai static int
     20  1.1  tsubai hb_match(parent, cf, aux)
     21  1.1  tsubai 	struct device *parent;
     22  1.1  tsubai 	struct cfdata *cf;
     23  1.1  tsubai 	void *aux;
     24  1.1  tsubai {
     25  1.1  tsubai 	struct confargs *ca = aux;
     26  1.1  tsubai 
     27  1.1  tsubai 	if (strcmp(ca->ca_name, hb_cd.cd_name) != 0)
     28  1.1  tsubai 		return 0;
     29  1.1  tsubai 
     30  1.1  tsubai 	return 1;
     31  1.1  tsubai }
     32  1.1  tsubai 
     33  1.1  tsubai static char *hbdevs[] = {
     34  1.1  tsubai 	"clock",
     35  1.1  tsubai 	"fb",
     36  1.1  tsubai 	"zsc",
     37  1.1  tsubai 	"kb",
     38  1.1  tsubai 	"ms",
     39  1.1  tsubai 	"le",
     40  1.1  tsubai 	"sc",
     41  1.1  tsubai 	NULL
     42  1.1  tsubai };
     43  1.1  tsubai 
     44  1.1  tsubai static void
     45  1.1  tsubai hb_attach(parent, self, aux)
     46  1.1  tsubai 	struct device *parent;
     47  1.1  tsubai 	struct device *self;
     48  1.1  tsubai 	void *aux;
     49  1.1  tsubai {
     50  1.1  tsubai 	struct confargs ca;
     51  1.1  tsubai 	char **p = hbdevs;
     52  1.1  tsubai 
     53  1.1  tsubai 	printf("\n");
     54  1.1  tsubai 	bzero(&ca, sizeof(ca));
     55  1.1  tsubai 
     56  1.1  tsubai 	while (*p) {
     57  1.1  tsubai 		ca.ca_name = *p;
     58  1.1  tsubai 		config_found(self, &ca, hb_print);
     59  1.1  tsubai 		p++;
     60  1.1  tsubai 	}
     61  1.1  tsubai }
     62  1.1  tsubai 
     63  1.1  tsubai /*
     64  1.1  tsubai  * Print out the confargs.  The (parent) name is non-NULL
     65  1.1  tsubai  * when there was no match found by config_found().
     66  1.1  tsubai  */
     67  1.1  tsubai static int
     68  1.1  tsubai hb_print(args, name)
     69  1.1  tsubai 	void *args;
     70  1.1  tsubai 	const char *name;
     71  1.1  tsubai {
     72  1.1  tsubai #if 0
     73  1.1  tsubai 	struct confargs *ca = args;
     74  1.1  tsubai #endif
     75  1.1  tsubai 
     76  1.1  tsubai 	/* Be quiet about empty HB locations. */
     77  1.1  tsubai 	if (name)
     78  1.1  tsubai 		return(QUIET);
     79  1.1  tsubai 
     80  1.1  tsubai #if 0
     81  1.1  tsubai 	if (ca->ca_addr != -1)
     82  1.1  tsubai 		printf(" addr 0x%x", ca->ca_addr);
     83  1.1  tsubai #endif
     84  1.1  tsubai 
     85  1.1  tsubai 	return(UNCONF);
     86  1.1  tsubai }
     87  1.1  tsubai 
     88