xref: /openbsd-src/sys/arch/sh/dev/shb.c (revision 3836e7c723d9c621d1bfafcdf2fb1c68075fdb93)
1*3836e7c7Smiod /*	$OpenBSD: shb.c,v 1.4 2024/11/05 18:58:59 miod Exp $	*/
295c7671fSmiod /*	$NetBSD: shb.c,v 1.10 2005/12/11 12:18:58 christos Exp $	*/
395c7671fSmiod 
495c7671fSmiod /*-
595c7671fSmiod  * Copyright (c) 2002 The NetBSD Foundation, Inc.
695c7671fSmiod  * All rights reserved.
795c7671fSmiod  *
895c7671fSmiod  * Redistribution and use in source and binary forms, with or without
995c7671fSmiod  * modification, are permitted provided that the following conditions
1095c7671fSmiod  * are met:
1195c7671fSmiod  * 1. Redistributions of source code must retain the above copyright
1295c7671fSmiod  *    notice, this list of conditions and the following disclaimer.
1395c7671fSmiod  * 2. Redistributions in binary form must reproduce the above copyright
1495c7671fSmiod  *    notice, this list of conditions and the following disclaimer in the
1595c7671fSmiod  *    documentation and/or other materials provided with the distribution.
1695c7671fSmiod  *
1795c7671fSmiod  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1895c7671fSmiod  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1995c7671fSmiod  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2095c7671fSmiod  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2195c7671fSmiod  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2295c7671fSmiod  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2395c7671fSmiod  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2495c7671fSmiod  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2595c7671fSmiod  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2695c7671fSmiod  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2795c7671fSmiod  * POSSIBILITY OF SUCH DAMAGE.
2895c7671fSmiod  */
2995c7671fSmiod 
3095c7671fSmiod #include <sys/param.h>
3195c7671fSmiod #include <sys/systm.h>
3295c7671fSmiod #include <sys/device.h>
3395c7671fSmiod 
3495c7671fSmiod #include <machine/autoconf.h>
3595c7671fSmiod 
3695c7671fSmiod int shb_match(struct device *, void *, void *);
3795c7671fSmiod void shb_attach(struct device *, struct device *, void *);
3895c7671fSmiod int shb_print(void *, const char *);
3995c7671fSmiod int shb_search(struct device *, void *, void *);
4095c7671fSmiod 
41471aeecfSnaddy const struct cfattach shb_ca = {
4295c7671fSmiod 	sizeof(struct device), shb_match, shb_attach
4395c7671fSmiod };
4495c7671fSmiod 
4595c7671fSmiod struct cfdriver shb_cd = {
46*3836e7c7Smiod 	NULL, "shb", DV_DULL
4795c7671fSmiod };
4895c7671fSmiod 
4995c7671fSmiod int
5095c7671fSmiod shb_match(struct device *parent, void *vcf, void *aux)
5195c7671fSmiod {
5295c7671fSmiod 	extern struct cfdriver shb_cd;
5395c7671fSmiod 	struct mainbus_attach_args *ma = aux;
5495c7671fSmiod 
5595c7671fSmiod 	if (strcmp(ma->ma_name, shb_cd.cd_name) != 0)
5695c7671fSmiod 		return (0);
5795c7671fSmiod 
5895c7671fSmiod 	return (1);
5995c7671fSmiod }
6095c7671fSmiod 
6195c7671fSmiod void
6295c7671fSmiod shb_attach(struct device *parent, struct device *self, void *aux)
6395c7671fSmiod {
6495c7671fSmiod 	printf("\n");
6595c7671fSmiod 
6695c7671fSmiod 	config_search(shb_search, self, aux);
6795c7671fSmiod }
6895c7671fSmiod 
6995c7671fSmiod int
7095c7671fSmiod shb_search(struct device *parent, void *vcf, void *aux)
7195c7671fSmiod {
7295c7671fSmiod 	struct cfdata *cf = vcf;
7395c7671fSmiod 
7495c7671fSmiod 	if ((*cf->cf_attach->ca_match)(parent, cf, NULL) == 0)
7595c7671fSmiod 		return (0);
7695c7671fSmiod 	config_attach(parent, cf, NULL, shb_print);
7795c7671fSmiod 	return (1);
7895c7671fSmiod }
7995c7671fSmiod 
8095c7671fSmiod int
8195c7671fSmiod shb_print(void *aux, const char *pnp)
8295c7671fSmiod {
8395c7671fSmiod 	return (UNCONF);
8495c7671fSmiod }
85